bytecode: generalize `struct lttng_ust_filter_bytecode_node`
[deliverable/lttng-ust.git] / liblttng-ust / lttng-ust-comm.c
index 4432a5da396d1a2f574ab74d5200e209ada277a3..c48bd29a14d620a285b38f574a68a82b1ef439eb 100644 (file)
@@ -61,6 +61,7 @@
 #include "clock.h"
 #include "../libringbuffer/getcpu.h"
 #include "getenv.h"
+#include "ust-events-internal.h"
 
 /* Concatenate lttng ust shared library name with its major version number. */
 #define LTTNG_UST_LIB_SO_NAME "liblttng-ust.so." __ust_stringify(CONFIG_LTTNG_UST_LIBRARY_VERSION_MAJOR)
@@ -320,6 +321,8 @@ static const char *cmd_name_mapping[] = {
        [ LTTNG_UST_REGISTER_DONE ] = "Registration Done",
        [ LTTNG_UST_TRACEPOINT_FIELD_LIST ] = "Create Tracepoint Field List",
 
+       [ LTTNG_UST_EVENT_NOTIFIER_GROUP_CREATE ] = "Create event notifier group",
+
        /* Session FD commands */
        [ LTTNG_UST_CHANNEL ] = "Create Channel",
        [ LTTNG_UST_SESSION_START ] = "Start Session",
@@ -344,6 +347,9 @@ static const char *cmd_name_mapping[] = {
        /* Event FD commands */
        [ LTTNG_UST_FILTER ] = "Create Filter",
        [ LTTNG_UST_EXCLUSION ] = "Add exclusions to event",
+
+       /* Event notifier group commands */
+       [ LTTNG_UST_EVENT_NOTIFIER_CREATE ] = "Create event notifier",
 };
 
 static const char *str_timeout;
@@ -778,7 +784,7 @@ int handle_message(struct sock_info *sock_info,
        case LTTNG_UST_FILTER:
        {
                /* Receive filter data */
-               struct lttng_ust_filter_bytecode_node *bytecode;
+               struct lttng_ust_bytecode_node *bytecode;
 
                if (lum->u.filter.data_size > FILTER_BYTECODE_MAX_LEN) {
                        ERR("Filter data size is too large: %u bytes",
@@ -799,6 +805,7 @@ int handle_message(struct sock_info *sock_info,
                        ret = -ENOMEM;
                        goto error;
                }
+
                len = ustcomm_recv_unix_sock(sock, bytecode->bc.data,
                                lum->u.filter.data_size);
                switch (len) {
@@ -907,6 +914,47 @@ int handle_message(struct sock_info *sock_info,
                }
                break;
        }
+       case LTTNG_UST_EVENT_NOTIFIER_GROUP_CREATE:
+       {
+               int event_notifier_notif_fd;
+
+               len = ustcomm_recv_event_notifier_notif_fd_from_sessiond(sock,
+                       &event_notifier_notif_fd);
+               switch (len) {
+               case 0: /* orderly shutdown */
+                       ret = 0;
+                       goto error;
+               case 1:
+                       break;
+               default:
+                       if (len < 0) {
+                               DBG("Receive failed from lttng-sessiond with errno %d",
+                                               (int) -len);
+                               if (len == -ECONNRESET) {
+                                       ERR("%s remote end closed connection",
+                                                       sock_info->name);
+                                       ret = len;
+                                       goto error;
+                               }
+                               ret = len;
+                               goto error;
+                       } else {
+                               DBG("Incorrect event notifier fd message size: %zd",
+                                               len);
+                               ret = -EINVAL;
+                               goto error;
+                       }
+               }
+               args.event_notifier_handle.event_notifier_notif_fd =
+                               event_notifier_notif_fd;
+               if (ops->cmd)
+                       ret = ops->cmd(lum->handle, lum->cmd,
+                                       (unsigned long) &lum->u,
+                                       &args, sock_info);
+               else
+                       ret = -ENOSYS;
+               break;
+       }
        case LTTNG_UST_CHANNEL:
        {
                void *chan_data;
This page took 0.026117 seconds and 5 git commands to generate.