Implement event notifier
[deliverable/lttng-ust.git] / liblttng-ust-comm / lttng-ust-comm.c
index 2447c9a938492f78f491a5868b7102f07ef157a2..9786abe7cb1b2767da8aa3a9535c178ac9a02774 100644 (file)
@@ -668,6 +668,46 @@ error_check:
        return len;
 }
 
+ssize_t ustcomm_recv_event_notifier_notif_fd_from_sessiond(int sock,
+               int *_event_notifier_notif_fd)
+{
+       ssize_t nr_fd;
+       int event_notifier_notif_fd, ret;
+
+       /* Receive event_notifier notification fd */
+       lttng_ust_lock_fd_tracker();
+       nr_fd = ustcomm_recv_fds_unix_sock(sock, &event_notifier_notif_fd, 1);
+       if (nr_fd <= 0) {
+               lttng_ust_unlock_fd_tracker();
+               if (nr_fd < 0) {
+                       ret = nr_fd;
+                       goto error;
+               } else {
+                       ret = -EIO;
+                       goto error;
+               }
+       }
+
+       ret = lttng_ust_add_fd_to_tracker(event_notifier_notif_fd);
+       if (ret < 0) {
+               ret = close(event_notifier_notif_fd);
+               if (ret) {
+                       PERROR("close on event_notifier notif fd");
+               }
+               ret = -EIO;
+               lttng_ust_unlock_fd_tracker();
+               goto error;
+       }
+
+       *_event_notifier_notif_fd = ret;
+       lttng_ust_unlock_fd_tracker();
+
+       ret = nr_fd;
+
+error:
+       return ret;
+}
+
 int ustcomm_recv_stream_from_sessiond(int sock,
                uint64_t *memory_map_size,
                int *shm_fd, int *wakeup_fd)
This page took 0.025017 seconds and 5 git commands to generate.