X-Git-Url: http://git.efficios.com/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fnotification-thread-internal.h;h=53ee6064ccb529c155673f7d3527b8fc11bcf3dc;hp=5aaac9d23fb6821e9a24634741b7d9760f04b665;hb=2463b7879c00298daa79744cdaae82ac061a4ed8;hpb=d1ba29d290281cf72ca3ec7b0222b336c747e925 diff --git a/src/bin/lttng-sessiond/notification-thread-internal.h b/src/bin/lttng-sessiond/notification-thread-internal.h index 5aaac9d23..53ee6064c 100644 --- a/src/bin/lttng-sessiond/notification-thread-internal.h +++ b/src/bin/lttng-sessiond/notification-thread-internal.h @@ -10,6 +10,7 @@ #include #include +#include #include #include #include @@ -74,6 +75,17 @@ struct channel_info { struct rcu_head rcu_node; }; +/* + * Facilities to carry the different notifications type in the action + * processing code path. + */ +struct lttng_trigger_notification { + uint64_t id; + enum lttng_domain_type type; + size_t capture_buf_size; + char *capture_buffer; +}; + struct notification_client_list_element { struct notification_client *client; struct cds_list_head node; @@ -111,7 +123,16 @@ struct notification_client_list { }; struct notification_client { - /* Nests within the notification_client_list lock. */ + /* + * Nests within the notification_client_list lock. + * + * Protects the outbound communication and the active flag which + * is used by both the notification and action executor threads. + * + * The remaining fields of the object can be used without any + * synchronization as they are either immutable (id, creds, version) or + * only accessed by the notification thread. + */ pthread_mutex_t lock; notification_client_id id; int socket; @@ -147,9 +168,11 @@ struct notification_client { * buffers' "size" is set to contain the current * message's complete payload. */ - struct lttng_dynamic_buffer buffer; + struct lttng_payload payload; /* Bytes left to receive for the current message. */ size_t bytes_to_receive; + /* FDs left to receive for the current message. */ + int fds_to_receive; /* Type of the message being received. */ enum lttng_notification_channel_message_type msg_type; /* @@ -183,7 +206,7 @@ struct notification_client { * misbehaving/malicious client. */ bool queued_command_reply; - struct lttng_dynamic_buffer buffer; + struct lttng_payload payload; } outbound; } communication; /* call_rcu delayed reclaim. */ @@ -205,6 +228,7 @@ bool notification_client_list_get(struct notification_client_list *list); LTTNG_HIDDEN void notification_client_list_put(struct notification_client_list *list); +/* Only returns a non-zero value if a fatal error occurred. */ typedef int (*report_client_transmission_result_cb)( struct notification_client *client, enum client_transmission_status status, @@ -226,4 +250,18 @@ int notification_thread_client_communication_update( notification_client_id id, enum client_transmission_status transmission_status); +/* + * Takes ownership of the payload if present. + */ +LTTNG_HIDDEN +struct lttng_trigger_notification *lttng_trigger_notification_create( + uint64_t id, + enum lttng_domain_type domain, + char *payload, + size_t payload_size); + +LTTNG_HIDDEN +void lttng_trigger_notification_destroy( + struct lttng_trigger_notification *trigger_notification); + #endif /* NOTIFICATION_THREAD_INTERNAL_H */