X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fconsumer.c;h=552ff95cb2b08711624d5a2ad76261cc789b0535;hp=d282f59c9266e1b22fc0aa581576c8e30d3fd32d;hb=700741dccd632e2520da055406582f39ab403795;hpb=a2814ea7573bf5edd5323d6f89c48ff14105db69 diff --git a/src/bin/lttng-sessiond/consumer.c b/src/bin/lttng-sessiond/consumer.c index d282f59c9..552ff95cb 100644 --- a/src/bin/lttng-sessiond/consumer.c +++ b/src/bin/lttng-sessiond/consumer.c @@ -93,7 +93,8 @@ error: * * Return 0 on success else a negative value on error. */ -int consumer_socket_send(struct consumer_socket *socket, void *msg, size_t len) +int consumer_socket_send( + struct consumer_socket *socket, const void *msg, size_t len) { int fd; ssize_t size; @@ -861,7 +862,7 @@ error: * The consumer socket lock must be held by the caller. */ int consumer_send_msg(struct consumer_socket *sock, - struct lttcomm_consumer_msg *msg) + const struct lttcomm_consumer_msg *msg) { int ret; @@ -1721,6 +1722,32 @@ error: return ret; } +int consumer_open_channel_packets(struct consumer_socket *socket, uint64_t key) +{ + int ret; + const struct lttcomm_consumer_msg msg = { + .cmd_type = LTTNG_CONSUMER_OPEN_CHANNEL_PACKETS, + .u.open_channel_packets.key = key, + }; + + assert(socket); + + DBG("Consumer open channel packets: channel key = %" PRIu64, key); + + health_code_update(); + + pthread_mutex_lock(socket->lock); + ret = consumer_send_msg(socket, &msg); + pthread_mutex_unlock(socket->lock); + if (ret < 0) { + goto error_socket; + } + +error_socket: + health_code_update(); + return ret; +} + int consumer_clear_channel(struct consumer_socket *socket, uint64_t key) { int ret;