2 * event-notifier-notification.c
4 * Copyright (C) 2020 Francis Deslauriers <francis.deslauriers@efficios.com>
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; only
9 * version 2.1 of the License.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
24 #include <lttng/ust-events.h>
25 #include <usterr-signal-safe.h>
29 void lttng_event_notifier_notification_send(
30 struct lttng_event_notifier
*event_notifier
)
33 * We want this write to be atomic AND non-blocking, meaning that we
34 * want to write either everything OR nothing.
35 * According to `pipe(7)`, writes that are smaller that the `PIPE_BUF`
36 * value must be atomic, so we assert that the message we send is less
39 struct lttng_ust_event_notifier_notification notif
;
42 assert(event_notifier
);
43 assert(event_notifier
->group
);
44 assert(sizeof(notif
) <= PIPE_BUF
);
46 notif
.token
= event_notifier
->user_token
;
48 ret
= patient_write(event_notifier
->group
->notification_fd
, ¬if
,
51 if (errno
== EAGAIN
) {
52 DBG("Cannot send event notifier notification without blocking: %s",
55 DBG("Error to sending event notifier notification: %s",