use umf_result in ctl - #1370
Merged
Merged
Conversation
KFilipek
approved these changes
Jun 13, 2025
There was a problem hiding this comment.
Pull Request Overview
This PR updates the controller (ctl) APIs to use the new umf_result_t return type and standardized result codes (such as UMF_RESULT_SUCCESS and UMF_RESULT_ERROR_INVALID_ARGUMENT) instead of plain integers. The changes span various modules including unit tests, debug handlers, provider modules, pool management, and the ctl core functions to improve API consistency and error handling.
Reviewed Changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| test/ctl/ctl_unittest.cpp | Updated test assertions to compare against UMF_RESULT_SUCCESS |
| test/ctl/ctl_debug.c | Changed handler return types to umf_result_t and updated error codes |
| src/provider/provider_os_memory.c | Adjusted read handler to return UMF_RESULT_SUCCESS instead of int |
| src/provider/provider_ctl_stats_impl.h | Updated stats handlers to return umf_result_t |
| src/pool/pool_disjoint.c | Modified name handlers to return standardized error codes |
| src/memory_provider.c | Updated subtree handler to use umf_result_t |
| src/memory_pool.c | Revised pool query and subtree functions for umf_result_t returns |
| src/libumf.c | Adjusted ctl query calls and removed redundant ternary error mapping |
| src/ctl/ctl.h | Updated function prototypes to use umf_result_t |
| src/ctl/ctl.c | Refactored query execution and config load functions to use umf_result_t |
Comments suppressed due to low confidence (3)
test/ctl/ctl_unittest.cpp:51
- [nitpick] Consider checking for a specific error code rather than merely asserting not equal to UMF_RESULT_SUCCESS, to make the failure condition more explicit.
ASSERT_NE(ctl_query(ctl_handler, NULL, CTL_QUERY_PROGRAMMATIC, "debug.heap.non_existent", CTL_QUERY_READ, &value, sizeof(value)), UMF_RESULT_SUCCESS);
src/ctl/ctl.c:364
- [nitpick] Consider clarifying the error propagation logic by mapping specific errors from lower-level functions instead of defaulting to UMF_RESULT_ERROR_UNKNOWN.
umf_result_t ret = UMF_RESULT_ERROR_UNKNOWN;
src/libumf.c:117
- [nitpick] Review the change from using a ternary operator for error mapping to returning the raw result from ctl_query; ensure this behavior aligns with the intended error handling semantics.
return ctl_query(NULL, ctx, CTL_QUERY_PROGRAMMATIC, name, CTL_QUERY_WRITE, arg, size);
bratpiorka
approved these changes
Jun 16, 2025
lukaszstolarczuk
approved these changes
Jun 16, 2025
lukaszstolarczuk
left a comment
Collaborator
There was a problem hiding this comment.
PLease re-base
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.
fixes: #1365
Description
Checklist