X-Git-Url: http://git.efficios.com/?p=lttng-tools.git;a=blobdiff_plain;f=include%2Flttng-sessiond-comm.h;h=68d8b910914c053dcaf90f345b25e575ce749dc9;hp=fcdc5a2cf72331234e11dc161e1179e1bb164630;hb=f158a754906b7c657d64db23c506c6648773bc92;hpb=09de5c68e74f5af62744ead1516d95bb823038db diff --git a/include/lttng-sessiond-comm.h b/include/lttng-sessiond-comm.h index fcdc5a2cf..68d8b9109 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" @@ -39,7 +38,7 @@ #define DEFAULT_HOME_CLIENT_UNIX_SOCK "%s/.client-ltt-sessiond" /* Queue size of listen(2) */ -#define MAX_LISTEN 64 +#define LTTNG_SESSIOND_COMM_MAX_LISTEN 64 /* * Get the error code index from 0 since LTTCOMM_OK start at 1000 @@ -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. @@ -214,10 +221,11 @@ struct lttcomm_ust_msg { uint32_t handle; uint32_t cmd; union { - struct lttng_ust_tracer_version version; struct lttng_ust_channel channel; + struct lttng_ust_stream stream; struct lttng_ust_event event; struct lttng_ust_context context; + struct lttng_ust_tracer_version version; } u; }; @@ -237,20 +245,24 @@ struct lttcomm_ust_reply { struct { uint64_t memory_map_size; } stream; + struct lttng_ust_tracer_version version; } 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);