X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=include%2Flttng-sessiond-comm.h;h=d9919add7d491878f76af02ec7578a517ef79efd;hp=fcdc5a2cf72331234e11dc161e1179e1bb164630;hb=3bd1e0819b577ffcb44acd7c2f8e02ff09654b7b;hpb=f84efadf55274918ca038a4e06e0a8af1a320654 diff --git a/include/lttng-sessiond-comm.h b/include/lttng-sessiond-comm.h index fcdc5a2cf..d9919add7 100644 --- a/include/lttng-sessiond-comm.h +++ b/include/lttng-sessiond-comm.h @@ -28,7 +28,6 @@ #include #include -#include #define LTTNG_RUNDIR "/var/run/lttng" @@ -117,19 +116,19 @@ enum lttcomm_return_code { LTTCOMM_UST_SESS_FAIL, /* UST create session failed */ LTTCOMM_UST_CHAN_NOT_FOUND, /* UST channel not found */ LTTCOMM_UST_CHAN_FAIL, /* UST create channel failed */ - KCONSUMERD_COMMAND_SOCK_READY, /* when kconsumerd command socket ready */ - KCONSUMERD_SUCCESS_RECV_FD, /* success on receiving fds */ - KCONSUMERD_ERROR_RECV_FD, /* error on receiving fds */ - KCONSUMERD_POLL_ERROR, /* Error in polling thread in kconsumerd */ - KCONSUMERD_POLL_NVAL, /* Poll on closed fd */ - KCONSUMERD_POLL_HUP, /* All fds have hungup */ - KCONSUMERD_EXIT_SUCCESS, /* kconsumerd exiting normally */ - KCONSUMERD_EXIT_FAILURE, /* kconsumerd exiting on error */ - KCONSUMERD_OUTFD_ERROR, /* error opening the tracefile */ - KCONSUMERD_SPLICE_EBADF, /* EBADF from splice(2) */ - KCONSUMERD_SPLICE_EINVAL, /* EINVAL from splice(2) */ - KCONSUMERD_SPLICE_ENOMEM, /* ENOMEM from splice(2) */ - KCONSUMERD_SPLICE_ESPIPE, /* ESPIPE from splice(2) */ + CONSUMERD_COMMAND_SOCK_READY, /* when consumerd command socket ready */ + CONSUMERD_SUCCESS_RECV_FD, /* success on receiving fds */ + CONSUMERD_ERROR_RECV_FD, /* error on receiving fds */ + CONSUMERD_POLL_ERROR, /* Error in polling thread in kconsumerd */ + CONSUMERD_POLL_NVAL, /* Poll on closed fd */ + CONSUMERD_POLL_HUP, /* All fds have hungup */ + CONSUMERD_EXIT_SUCCESS, /* kconsumerd exiting normally */ + CONSUMERD_EXIT_FAILURE, /* kconsumerd exiting on error */ + CONSUMERD_OUTFD_ERROR, /* error opening the tracefile */ + CONSUMERD_SPLICE_EBADF, /* EBADF from splice(2) */ + CONSUMERD_SPLICE_EINVAL, /* EINVAL from splice(2) */ + CONSUMERD_SPLICE_ENOMEM, /* ENOMEM from splice(2) */ + CONSUMERD_SPLICE_ESPIPE, /* ESPIPE from splice(2) */ /* MUST be last element */ LTTCOMM_NR, /* Last element */ }; @@ -186,26 +185,34 @@ struct lttcomm_lttng_msg { }; /* - * Data structures for the kconsumerd communications - * - * The header structure is sent to the kconsumerd daemon to inform - * how many lttcomm_kconsumerd_msg it is about to receive + * lttcomm_consumer_msg is the message sent from sessiond to consumerd + * to either add a channel, add a stream, update a stream, or stop + * operation. */ -struct lttcomm_kconsumerd_header { - uint32_t payload_size; - uint32_t cmd_type; /* enum kconsumerd_command */ +struct lttcomm_consumer_msg { + uint32_t cmd_type; /* enum consumerd_command */ + union { + struct { + int channel_key; + uint64_t max_sb_size; /* the subbuffer size for this channel */ + /* shm_fd and wait_fd are sent as ancillary data */ + uint64_t mmap_len; + } channel; + struct { + int channel_key; + int stream_key; + /* shm_fd and wait_fd are sent as ancillary data */ + uint32_t state; /* enum lttcomm_consumer_fd_state */ + enum lttng_event_output output; /* use splice or mmap to consume this fd */ + uint64_t mmap_len; + char path_name[PATH_MAX]; + } stream; + } u; }; -/* lttcomm_kconsumerd_msg represents a file descriptor to consume the - * data and a path name to write it - */ -struct lttcomm_kconsumerd_msg { - char path_name[PATH_MAX]; - int fd; - uint32_t state; /* enum lttcomm_kconsumerd_fd_state */ - unsigned long max_sb_size; /* the subbuffer size for this channel */ - enum lttng_event_output output; /* use splice or mmap to consume this fd */ -}; +#ifdef CONFIG_LTTNG_TOOLS_HAVE_UST + +#include /* * Data structure for the commands sent from sessiond to UST. @@ -240,17 +247,20 @@ struct lttcomm_ust_reply { } u; }; +#endif /* CONFIG_LTTNG_TOOLS_HAVE_UST */ + extern int lttcomm_create_unix_sock(const char *pathname); extern int lttcomm_connect_unix_sock(const char *pathname); extern int lttcomm_accept_unix_sock(int sock); extern int lttcomm_listen_unix_sock(int sock); extern int lttcomm_close_unix_sock(int sock); -/* Send fd(s) over a unix socket. */ -extern ssize_t lttcomm_send_fds_unix_sock(int sock, void *buf, int *fds, - size_t nb_fd, size_t len); -/* Recv fd(s) over a unix socket */ -extern ssize_t lttcomm_recv_fds_unix_sock(int sock, void *buf, int *fds, - size_t nb_fd, size_t len); + +#define LTTCOMM_MAX_SEND_FDS 4 +/* Send a message accompanied by fd(s) over a unix socket. */ +extern ssize_t lttcomm_send_fds_unix_sock(int sock, int *fds, size_t nb_fd); +/* Recv a message accompanied by fd(s) from a unix socket */ +extern ssize_t lttcomm_recv_fds_unix_sock(int sock, int *fds, size_t nb_fd); + extern ssize_t lttcomm_recv_unix_sock(int sock, void *buf, size_t len); extern ssize_t lttcomm_send_unix_sock(int sock, void *buf, size_t len); extern const char *lttcomm_get_readable_code(enum lttcomm_return_code code);