1SD_BUS_MESSAGE_NEW_SIGNAL(3)sd_bus_message_new_signaSlD_BUS_MESSAGE_NEW_SIGNAL(3)
2
3
4
6 sd_bus_message_new_signal - Create a signal message
7
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
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
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
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
49 Example 1. Send a simple signal
50
51 #include <systemd/sd-bus.h>
52 #define _cleanup_(f) __attribute__((cleanup(f)))
53
54 int send_unit_files_changed(sd_bus *bus) {
55 _cleanup_(sd_bus_message_unrefp) sd_bus_message *message = NULL;
56 int r;
57
58 r = sd_bus_message_new_signal(bus, &message,
59 "/org/freedesktop/systemd1",
60 "org.freedesktop.systemd1.Manager",
61 "UnitFilesChanged");
62 if (r < 0)
63 return r;
64
65 return sd_bus_send(bus, message, NULL);
66 }
67
68 This function in systemd sources is used to emit the "UnitFilesChanged"
69 signal when the unit files have been changed.
70
72 systemd(1), sd-bus(3), sd_bus_emit_signal(3)
73
74
75
76systemd 246 SD_BUS_MESSAGE_NEW_SIGNAL(3)