Implement event notifier
[deliverable/lttng-ust.git] / liblttng-ust / lttng-ust-comm.c
index 87657ef80109851033088de33b5c756ca0d6c24e..530102b54aee47864dc463d63ce9d3b6dc774453 100644 (file)
@@ -321,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",
@@ -345,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;
@@ -908,6 +913,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.027565 seconds and 5 git commands to generate.