Fix: sessiond: rotation thread: fatal error when not finding a session
[lttng-tools.git] / src / bin / lttng-sessiond / notification-thread-internal.h
index e36180fb6af634ef4e23c6f1ad7aba45bb3017d1..9e7059acf0708749828891870765448ba35e199a 100644 (file)
@@ -10,6 +10,7 @@
 
 #include <common/compat/socket.h>
 #include <common/credentials.h>
+#include <common/payload.h>
 #include <lttng/notification/channel-internal.h>
 #include <lttng/ref-internal.h>
 #include <stdbool.h>
@@ -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_event_notifier_notification {
+       uint64_t tracer_token;
+       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;
@@ -101,8 +113,10 @@ struct notification_client_list_element {
 struct notification_client_list {
        pthread_mutex_t lock;
        struct urcu_ref ref;
-       const struct lttng_trigger *trigger;
-       struct cds_list_head list;
+       struct lttng_condition *condition;
+       /* List of triggers that have an identical condition than `condition`. */
+       struct cds_list_head triggers_list;
+       struct cds_list_head clients_list;
        /* Weak reference to container. */
        struct cds_lfht *notification_trigger_clients_ht;
        struct cds_lfht_node notification_trigger_clients_ht_node;
@@ -128,6 +142,7 @@ struct notification_client {
        uint8_t major, minor;
        uid_t uid;
        gid_t gid;
+       bool is_sessiond;
        /*
         * Indicates if the credentials and versions of the client have been
         * checked.
@@ -156,9 +171,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;
                        /*
@@ -192,7 +209,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. */
@@ -208,10 +225,8 @@ enum client_transmission_status {
        CLIENT_TRANSMISSION_STATUS_ERROR,
 };
 
-LTTNG_HIDDEN
 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. */
@@ -220,20 +235,29 @@ typedef int (*report_client_transmission_result_cb)(
                enum client_transmission_status status,
                void *user_data);
 
-LTTNG_HIDDEN
 int notification_client_list_send_evaluation(
                struct notification_client_list *list,
-               const struct lttng_condition *condition,
+               const struct lttng_trigger *trigger,
                const struct lttng_evaluation *evaluation,
-               const struct lttng_credentials *trigger_creds,
                const struct lttng_credentials *source_object_creds,
                report_client_transmission_result_cb client_report,
                void *user_data);
 
-LTTNG_HIDDEN
 int notification_thread_client_communication_update(
                struct notification_thread_handle *handle,
                notification_client_id id,
                enum client_transmission_status transmission_status);
 
+/*
+ * Takes ownership of the payload if present.
+ */
+struct lttng_event_notifier_notification *lttng_event_notifier_notification_create(
+               uint64_t tracer_token,
+               enum lttng_domain_type domain,
+               char *payload,
+               size_t payload_size);
+
+void lttng_event_notifier_notification_destroy(
+               struct lttng_event_notifier_notification *event_notifier_notification);
+
 #endif /* NOTIFICATION_THREAD_INTERNAL_H */
This page took 0.025597 seconds and 4 git commands to generate.