forked from darshan-hpc/darshan
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MAINT: improve C accum error handling
* returning `-1` from a public API C function isn't sufficient to provide useful error information when working in Python/CFFI--it only tells you something went wrong if you check for a return code in the first place (which isn't normally done in Python anyway--normally you end execution at the error point and `exit()` with an appropriate error message) * when there are multiple conditions that can trigger the `-1` return value, the situation is even worse, one literally has to `printf` sprinkle the source to figure out what went wrong where * as a compromise, I'll leave the `-1` approach in since that is quite common in standard `C`, but I'm going to add in prints to `stderr` so that Python can then intercept the `-1` and refer the user to `stderr` * also, `darshan_accumulator_inject()` assumed that the `module_id` was reasonable because it was set/checked in `darshan_accumulator_create()`, however my experience in darshan-hpcgh-839 was that the accumulator memory location can get freed, or not properly set at CFFI boundary after calling the creation function, so I think the assumption that a previous function was called and worked perfectly is too fragile--I'm adding error handling to prevent a hard segfault on nonsense values of that structure member as a result
- Loading branch information
1 parent
045b9bd
commit ca4f3ea
Showing
3 changed files
with
78 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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