chcpu: refactor#4396
Open
cgoesche wants to merge 9 commits into
Open
Conversation
866dbde to
860ac42
Compare
Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
Previously, cpu_enable() and cpu_configure() compared the number of fails with ctx->maxcpus and if equal it returned -1, which culminated over to an exit code of 1 (failure). Otherwise, if there were fails but less than ctx->maxcpus the fucntions return code 1 would result in an exit code 64 indicating partial success. Since ctx->maxcpus describes the maximum number of CPUs supported by the kernel, in practice, this failure mode isn't really useful as it means that a user would need to fail the configuration of every possible CPU. This is why chcpu(8) almost always returns 64. It is better to store the actual amount of requested CPUs and then compare the amount of fails to it and provide more meaningful exit codes. Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
Let's stay consistent with the function contract and return -1 and print a warning with warn[x]() in case of failure. Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a temporary copy of my
chcpu_testsbranch which saved the refactor work and bug fixes that were initially added to PR #4390 . However, as suggested by @karelzak it is better to keep it simple and introduce these fixes in another iteration. Once the initial PR is merged, this branch will be rebased and commits will be adjusted accordingly to properly implement the changes.