Allow get_next_notification to return when interrupted
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 4 Oct 2018 21:50:27 +0000 (17:50 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 4 Oct 2018 22:13:28 +0000 (18:13 -0400)
commitf83bcd90ceb5ce659ffe9d7747d6f3366a09748a
tree4cc47b6ef9dd0ba4e71724f549555ec58c0b9975
parent03732c3281c0cfbfd5f1a6b7723c577cab43bab3
Allow get_next_notification to return when interrupted

Applications (and scripts) which consume a given set of notifications
indefinitely may fail to exit if a SIGTERM handler is registered.

lttng_notification_channel_get_next_notification() blocks indefinitely
on recvmsg() until a new notification is available. The wrapper that
is used to do so automatically restarts the recvmsg() if it is
interrupted, thus not allowing clients a change to cleanly exit.

This change causes the notification channel to wait for a message to
be available using select() before starting the actual reception of
the data and return LTTNG_NOTIFICATION_CHANNEL_STATUS_INTERRUTPED if a
signal occurs during the wait.

If data is available, it is assumed that the message is well-formed
and can promptly be received in its entirety. The goal of this change
is to give a monitoring application a chance to leave the
get_next_notification() function and check if it should exit.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
include/lttng/notification/channel.h
src/lib/lttng-ctl/channel.c
This page took 0.026614 seconds and 4 git commands to generate.