From: Jérémie Galarneau Date: Tue, 8 May 2018 16:00:41 +0000 (-0400) Subject: Cleanup: send_fds functions are not const-correct X-Git-Tag: v2.11.0-rc1~245 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=ac2f30af91cd6d9c382698038b525b54845dbe11;p=lttng-tools.git Cleanup: send_fds functions are not const-correct Signed-off-by: Jérémie Galarneau --- diff --git a/src/bin/lttng-sessiond/consumer.c b/src/bin/lttng-sessiond/consumer.c index 44dc35d6b..4a19c9347 100644 --- a/src/bin/lttng-sessiond/consumer.c +++ b/src/bin/lttng-sessiond/consumer.c @@ -735,7 +735,8 @@ error: * * The consumer socket lock must be held by the caller. */ -int consumer_send_fds(struct consumer_socket *sock, int *fds, size_t nb_fd) +int consumer_send_fds(struct consumer_socket *sock, const int *fds, + size_t nb_fd) { int ret; @@ -973,7 +974,7 @@ void consumer_init_streams_sent_comm_msg(struct lttcomm_consumer_msg *msg, */ int consumer_send_stream(struct consumer_socket *sock, struct consumer_output *dst, struct lttcomm_consumer_msg *msg, - int *fds, size_t nb_fd) + const int *fds, size_t nb_fd) { int ret; diff --git a/src/bin/lttng-sessiond/consumer.h b/src/bin/lttng-sessiond/consumer.h index d875f2c6d..b1189cc87 100644 --- a/src/bin/lttng-sessiond/consumer.h +++ b/src/bin/lttng-sessiond/consumer.h @@ -222,12 +222,13 @@ void consumer_output_get(struct consumer_output *obj); void consumer_output_put(struct consumer_output *obj); int consumer_set_network_uri(struct consumer_output *obj, struct lttng_uri *uri); -int consumer_send_fds(struct consumer_socket *sock, int *fds, size_t nb_fd); +int consumer_send_fds(struct consumer_socket *sock, const int *fds, + size_t nb_fd); int consumer_send_msg(struct consumer_socket *sock, struct lttcomm_consumer_msg *msg); int consumer_send_stream(struct consumer_socket *sock, struct consumer_output *dst, struct lttcomm_consumer_msg *msg, - int *fds, size_t nb_fd); + const int *fds, size_t nb_fd); int consumer_send_channel(struct consumer_socket *sock, struct lttcomm_consumer_msg *msg); int consumer_send_relayd_socket(struct consumer_socket *consumer_sock, diff --git a/src/common/unix.c b/src/common/unix.c index 2f4df68e6..41525b691 100644 --- a/src/common/unix.c +++ b/src/common/unix.c @@ -374,7 +374,7 @@ int lttcomm_close_unix_sock(int sock) * Returns the size of data sent, or negative error value. */ LTTNG_HIDDEN -ssize_t lttcomm_send_fds_unix_sock(int sock, int *fds, size_t nb_fd) +ssize_t lttcomm_send_fds_unix_sock(int sock, const int *fds, size_t nb_fd) { struct msghdr msg; struct cmsghdr *cmptr; diff --git a/src/common/unix.h b/src/common/unix.h index 886b40e73..58038ffe5 100644 --- a/src/common/unix.h +++ b/src/common/unix.h @@ -39,7 +39,7 @@ int lttcomm_close_unix_sock(int sock); /* Send a message accompanied by fd(s) over a unix socket. */ LTTNG_HIDDEN -ssize_t lttcomm_send_fds_unix_sock(int sock, int *fds, size_t nb_fd); +ssize_t lttcomm_send_fds_unix_sock(int sock, const int *fds, size_t nb_fd); /* Recv a message accompanied by fd(s) from a unix socket */ LTTNG_HIDDEN ssize_t lttcomm_recv_fds_unix_sock(int sock, int *fds, size_t nb_fd);