From 9a318688b5958debecae5560842109d77abd996e Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?= Date: Wed, 14 Feb 2018 17:44:05 -0500 Subject: [PATCH] Document consumer socket locking assumptions MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérémie Galarneau --- src/bin/lttng-sessiond/consumer.c | 6 ++++++ src/bin/lttng-sessiond/kernel-consumer.c | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/src/bin/lttng-sessiond/consumer.c b/src/bin/lttng-sessiond/consumer.c index 126b01a44..5cbd42f63 100644 --- a/src/bin/lttng-sessiond/consumer.c +++ b/src/bin/lttng-sessiond/consumer.c @@ -731,6 +731,8 @@ error: /* * Send file descriptor to consumer via sock. + * + * The consumer socket lock must be held by the caller. */ int consumer_send_fds(struct consumer_socket *sock, int *fds, size_t nb_fd) { @@ -755,6 +757,8 @@ error: /* * Consumer send communication message structure to consumer. + * + * The consumer socket lock must be held by the caller. */ int consumer_send_msg(struct consumer_socket *sock, struct lttcomm_consumer_msg *msg) @@ -778,6 +782,8 @@ error: /* * Consumer send channel communication message structure to consumer. + * + * The consumer socket lock must be held by the caller. */ int consumer_send_channel(struct consumer_socket *sock, struct lttcomm_consumer_msg *msg) diff --git a/src/bin/lttng-sessiond/kernel-consumer.c b/src/bin/lttng-sessiond/kernel-consumer.c index 0f59aa24f..bc481e5c4 100644 --- a/src/bin/lttng-sessiond/kernel-consumer.c +++ b/src/bin/lttng-sessiond/kernel-consumer.c @@ -178,6 +178,8 @@ error: /* * Sending metadata to the consumer with command ADD_CHANNEL and ADD_STREAM. + * + * The consumer socket lock must be held by the caller. */ int kernel_consumer_add_metadata(struct consumer_socket *sock, struct ltt_kernel_session *session, unsigned int monitor) @@ -336,6 +338,8 @@ error: /* * Send all stream fds of kernel channel to the consumer. + * + * The consumer socket lock must be held by the caller. */ int kernel_consumer_send_channel_stream(struct consumer_socket *sock, struct ltt_kernel_channel *channel, struct ltt_kernel_session *session, @@ -388,6 +392,8 @@ error: /* * Send all stream fds of the kernel session to the consumer. + * + * The consumer socket lock must be held by the caller. */ int kernel_consumer_send_session(struct consumer_socket *sock, struct ltt_kernel_session *session) -- 2.34.1