Project

General

Profile

Actions

Bug #901

open

Some liblttng-ctl don't return LTTNG_OK on success

Added by Jérémie Galarneau over 9 years ago. Updated over 1 year ago.

Status:
In Progress
Priority:
Normal
Target version:
-
Start date:
08/05/2015
Due date:
% Done:

0%

Estimated time:

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".

Actions #1

Updated by Jérémie Galarneau over 9 years ago

lttng_create_session_live(...)

has the same problem.

Actions #2

Updated by Jérémie Galarneau over 9 years ago

  • Target version set to 22
Actions #3

Updated by Jérémie Galarneau over 9 years ago

  • Status changed from New to Confirmed
Actions #4

Updated by Jérémie Galarneau over 9 years ago

  • Target version changed from 22 to 2.8
Actions #5

Updated by Jérémie Galarneau over 9 years ago

  • Assignee set to Jérémie Galarneau
Actions #6

Updated by Jérémie Galarneau over 8 years ago

  • Target version changed from 2.8 to 2.9
Actions #7

Updated by Erica Bugden over 1 year 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?

Actions #8

Updated by Mathieu Desnoyers over 1 year 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.

Actions #9

Updated by Jérémie Galarneau over 1 year 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.

Actions

Also available in: Atom PDF