@@ -54,17 +54,12 @@ void notification_thread_handle_destroy(
54
54
goto end ;
55
55
}
56
56
57
- if (handle -> cmd_queue .event_fd < 0 ) {
58
- goto end ;
59
- }
60
- ret = close (handle -> cmd_queue .event_fd );
61
- if (ret < 0 ) {
62
- PERROR ("close notification command queue event_fd" );
63
- }
64
-
65
57
assert (cds_list_empty (& handle -> cmd_queue .list ));
66
58
pthread_mutex_destroy (& handle -> cmd_queue .lock );
67
59
60
+ if (handle -> cmd_queue .event_pipe ) {
61
+ lttng_pipe_destroy (handle -> cmd_queue .event_pipe );
62
+ }
68
63
if (handle -> channel_monitoring_pipes .ust32_consumer >= 0 ) {
69
64
ret = close (handle -> channel_monitoring_pipes .ust32_consumer );
70
65
if (ret ) {
@@ -94,18 +89,22 @@ struct notification_thread_handle *notification_thread_handle_create(
94
89
{
95
90
int ret ;
96
91
struct notification_thread_handle * handle ;
92
+ struct lttng_pipe * event_pipe = NULL ;
97
93
98
94
handle = zmalloc (sizeof (* handle ));
99
95
if (!handle ) {
100
96
goto end ;
101
97
}
102
98
103
- /* FIXME Replace eventfd by a pipe to support older kernels. */
104
- handle -> cmd_queue .event_fd = eventfd (0 , EFD_CLOEXEC | EFD_SEMAPHORE );
105
- if (handle -> cmd_queue .event_fd < 0 ) {
106
- PERROR ("eventfd notification command queue" );
99
+ event_pipe = lttng_pipe_open (O_CLOEXEC );
100
+ if (!event_pipe ) {
101
+ ERR ("event_pipe creation" );
107
102
goto error ;
108
103
}
104
+
105
+ handle -> cmd_queue .event_pipe = event_pipe ;
106
+ event_pipe = NULL ;
107
+
109
108
CDS_INIT_LIST_HEAD (& handle -> cmd_queue .list );
110
109
ret = pthread_mutex_init (& handle -> cmd_queue .lock , NULL );
111
110
if (ret ) {
@@ -145,6 +144,7 @@ struct notification_thread_handle *notification_thread_handle_create(
145
144
end :
146
145
return handle ;
147
146
error :
147
+ lttng_pipe_destroy (event_pipe );
148
148
notification_thread_handle_destroy (handle );
149
149
return NULL ;
150
150
}
@@ -282,7 +282,7 @@ int init_poll_set(struct lttng_poll_event *poll_set,
282
282
ERR ("[notification-thread] Failed to add notification channel socket to pollset" );
283
283
goto error ;
284
284
}
285
- ret = lttng_poll_add (poll_set , handle -> cmd_queue .event_fd ,
285
+ ret = lttng_poll_add (poll_set , lttng_pipe_get_readfd ( handle -> cmd_queue .event_pipe ) ,
286
286
LPOLLIN | LPOLLERR );
287
287
if (ret < 0 ) {
288
288
ERR ("[notification-thread] Failed to add notification command queue event fd to pollset" );
@@ -544,7 +544,7 @@ void *thread_notification(void *data)
544
544
ERR ("[notification-thread] Unexpected poll events %u for notification socket %i" , revents , fd );
545
545
goto error ;
546
546
}
547
- } else if (fd == handle -> cmd_queue .event_fd ) {
547
+ } else if (fd == lttng_pipe_get_readfd ( handle -> cmd_queue .event_pipe ) ) {
548
548
ret = handle_notification_thread_command (handle ,
549
549
& state );
550
550
if (ret < 0 ) {
0 commit comments