Bug #901
openSome liblttng-ctl don't return LTTNG_OK on success
0%
Description
It appears that some liblttng-ctl functions, such as lttng_create_session_snapshot() have conflicting return code conventions.
In this specific case, the header under lttng/session.h asserts that the function will
/* [...] * Return 0 on success else a negative LTTng error code. */
while the header in lttng-ctl.c affirms that it
/* [...] * Returns LTTNG_OK on success or a negative error code. */
and the function actually returns
ret = lttng_ctl_ask_sessiond_varlen(&lsm, uris, ...
which, itself will
/* [...] Return size of data (only payload, not header) or a negative error code. */
This pattern is used in multiple places which breaks code which checks for "ret == LTTNG_OK" instead of "ret < 0".
Updated by Jérémie Galarneau over 8 years ago
lttng_create_session_live(...)
has the same problem.
Updated by Jérémie Galarneau over 8 years ago
- Status changed from New to Confirmed
Updated by Jérémie Galarneau over 8 years ago
- Target version changed from 22 to 2.8
Updated by Jérémie Galarneau almost 8 years ago
- Target version changed from 2.8 to 2.9
Updated by Erica Bugden 10 months ago
- Status changed from Confirmed to In Progress
- Target version deleted (
2.9)
The following commit seems to at least partially address this bug:
Are there other commands that also require this correction that we could list here? Or should this be marked as resolved?
Updated by Mathieu Desnoyers 10 months ago
The task to do here would be to review all of the lttng-ctl public APIs to identify if such discrepancy between comments, prototype, implementation, and usage still exist. This is a time-consuming task, but not a difficult one.
Updated by Jérémie Galarneau 9 months ago
Somewhat loosely related, Philippe never got around to completing this documentation patch, but it documents some of the return conventions (and a lot of other things):
https://review.lttng.org/c/lttng-tools/+/6308
I feel merging it would improve the documentation significantly, even if it is incomplete. However, it needs to be rebased.