X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;ds=sidebyside;f=liblttsessiondcomm%2Fliblttsessiondcomm.h;h=adb9a8d843572d96f62938d02daf0ea111599c89;hb=93128a92561c2964186015a7e075c607613e6e75;hp=967c77c206c24c400feb090d37da7c108c96dc3f;hpb=d6f421500e248dee6c9b8ccac863a3840d4fbff6;p=lttng-tools.git diff --git a/liblttsessiondcomm/liblttsessiondcomm.h b/liblttsessiondcomm/liblttsessiondcomm.h index 967c77c20..adb9a8d84 100644 --- a/liblttsessiondcomm/liblttsessiondcomm.h +++ b/liblttsessiondcomm/liblttsessiondcomm.h @@ -1,4 +1,6 @@ -/* Copyright (C) 2011 - David Goulet +/* + * Copyright (C) 2011 - David Goulet + * Julien Desfossez * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -22,6 +24,11 @@ #include #include +/* + * FIXME: 32, 64bit enums -> uint32_t uint64_t for data exchange. + * Same for pid_t. + */ + #define LTTNG_RUNDIR "/var/run/lttng" /* Default unix socket path */ @@ -43,7 +50,7 @@ */ #define LTTCOMM_ERR_INDEX(code) (code - LTTCOMM_OK) -enum lttcomm_command_type { +enum lttcomm_sessiond_command { LTTNG_CREATE_SESSION, LTTNG_DESTROY_SESSION, LTTNG_FORCE_SUBBUF_SWITCH, @@ -92,12 +99,26 @@ enum lttcomm_return_code { LTTCOMM_NR, /* Last element */ }; +/* commands for kconsumerd */ +enum lttcomm_consumerd_command { + LTTCOMM_ADD_STREAM = 1100, + LTTCOMM_UPDATE_STREAM, /* pause, delete, start depending on fd state */ + LTTCOMM_STOP, /* delete all */ +}; + +/* state of each fd in consumerd */ +enum lttcomm_kconsumerd_fd_state { + ACTIVE_FD, + PAUSE_FD, + DELETE_FD, +}; + /* * Data structure for ltt-session received message */ struct lttcomm_session_msg { /* Common data to almost all command */ - enum lttcomm_command_type cmd_type; + enum lttcomm_sessiond_command cmd_type; uuid_t session_id; char trace_name[NAME_MAX]; char session_name[NAME_MAX]; @@ -129,19 +150,40 @@ struct lttcomm_session_msg { }; /* - * Data structure for the lttng client response. + * Data structure for the response from sessiond to the lttng client. * * This data structure is the control struct use in * the header of the transmission. NEVER put variable * size data in here. */ -struct lttcomm_lttng_msg { - enum lttcomm_command_type cmd_type; +struct lttcomm_lttng_header { + enum lttcomm_sessiond_command cmd_type; enum lttcomm_return_code ret_code; uuid_t session_id; pid_t pid; char trace_name[NAME_MAX]; - unsigned int size_payload; + unsigned int payload_size; +}; + +/* + * 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 + */ +struct lttcomm_kconsumerd_header { + unsigned int payload_size; + enum lttcomm_consumerd_command cmd_type; + enum lttcomm_return_code ret_code; +}; + +/* 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; + enum lttcomm_kconsumerd_fd_state state; }; extern int lttcomm_create_unix_sock(const char *pathname);