lib: Make graph listeners return an error status
Currently, if a graph listener fails for some reason (for example, an
uncaught exception in Python), no error is reported to the initial
caller, so it has no way to handle the failure properly. If a listener
fails, we can't really trust that the execution will proceed as
intended, so it is likely that the caller wants to exit with an error
too.
All the listener typedefs are updated to return a new type,
bt_graph_listener_status. If any listener fails, the graph is put in
"faulty" state and we return an error up the stack.
If a listener fails, the action is not rolled back. This means that if
a port added listener fails, the port that was added is not removed. If
a ports connected listener fails, the connection is not undone.
A few call sites needed to be updated. An interesting one is in
cli/babeltrace.c. Where we previously aborted, we can now return an
error and exit cleanly.
The Python bindings is another user of the listener API. I have
modified the functions in native_bt_graph.i to keep the code building,
but the errors are currently not propagated from the Python callback.
This will be done in a subsequent patch.
Change-Id: I115773c405162f7b1c617cf4a8302b980315e14d
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1316
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Tested-by: jenkins
This page took 0.02592 seconds and 4 git commands to generate.