1SD_BUS_MESSAGE_NEW_SIGNAL(3)sd_bus_message_new_signaSlD_BUS_MESSAGE_NEW_SIGNAL(3)
2
3
4

NAME

6       sd_bus_message_new_signal - Create a signal message
7

SYNOPSIS

9       #include <systemd/sd-bus.h>
10
11       int sd_bus_message_new_signal(sd_bus *bus, sd_bus_message **m,
12                                     const char *path, const char *interface,
13                                     const char *member);
14

DESCRIPTION

16       The sd_bus_message_new_signal() function creates a new bus message
17       object that encapsulates a D-Bus signal, and returns it in the m output
18       parameter. The signal will be sent to path path, on the interface
19       interface, member member. When this message is sent, no reply is
20       expected. See sd_bus_message_new_method_call(1) for a short description
21       of the meaning of the path, interface, and member parameters.
22

RETURN VALUE

24       This function returns 0 if the message object was successfully created,
25       and a negative errno-style error code otherwise.
26
27   Errors
28       Returned errors may indicate the following problems:
29
30       -EINVAL
31           The output parameter m is NULL.
32
33           The path parameter is not a valid D-Bus path ("/an/object/path"),
34           the interface parameter is not a valid D-Bus interface name
35           ("an.interface.name"), or the member parameter is not a valid D-Bus
36           member ("Name").
37
38       -ENOTCONN
39           The bus parameter bus is NULL or the bus is not connected.
40
41       -ENOMEM
42           Memory allocation failed.
43

NOTES

45       These APIs are implemented as a shared library, which can be compiled
46       and linked to with the libsystemd pkg-config(1) file.
47

EXAMPLES

49       Example 1. Send a simple signal
50
51           /* SPDX-License-Identifier: CC0-1.0 */
52
53           #include <systemd/sd-bus.h>
54           #define _cleanup_(f) __attribute__((cleanup(f)))
55
56           int send_unit_files_changed(sd_bus *bus) {
57             _cleanup_(sd_bus_message_unrefp) sd_bus_message *message = NULL;
58             int r;
59
60             r = sd_bus_message_new_signal(bus, &message,
61                                           "/org/freedesktop/systemd1",
62                                           "org.freedesktop.systemd1.Manager",
63                                           "UnitFilesChanged");
64             if (r < 0)
65               return r;
66
67             return sd_bus_send(bus, message, NULL);
68           }
69
70       This function in systemd sources is used to emit the "UnitFilesChanged"
71       signal when the unit files have been changed.
72

SEE ALSO

74       systemd(1), sd-bus(3), sd_bus_emit_signal(3)
75
76
77
78systemd 250                                       SD_BUS_MESSAGE_NEW_SIGNAL(3)
Impressum