1SD_EVENT_SOURCE_SET_DESCRsIdP_TeIvOeNn(t3_)source_set_dSeDs_cErViEpNtTi_oSnOURCE_SET_DESCRIPTION(3)
2
3
4
6 sd_event_source_set_description, sd_event_source_get_description - Set
7 or retrieve descriptive names of event sources
8
10 #include <systemd/sd-event.h>
11
12 int sd_event_source_set_description(sd_event_source *source,
13 const char *description);
14
15 int sd_event_source_get_description(sd_event_source *source,
16 const char **description);
17
19 sd_event_source_set_description() may be used to set an arbitrary
20 descriptive name for the event source object specified as source. This
21 name will be used in debugging messages generated by sd-event(3) for
22 this event source, and may be queried using
23 sd_event_source_get_description() for debugging purposes. The
24 description parameter shall point to a NUL-terminated string or be
25 NULL. In the latter case, the descriptive name will be unset. The
26 string is copied internally, hence the description argument is not
27 referenced after the function returns.
28
29 sd_event_source_get_description() may be used to query the current
30 descriptive name assigned to the event source object source. It returns
31 a pointer to the current name in description, stored in memory internal
32 to the event source. The memory is invalidated when the event source is
33 destroyed or the descriptive name is changed.
34
35 Event source objects generally have no description set when they are
36 created, except for UNIX signal event sources created with
37 sd_event_add_signal(3), whose descriptive name is initialized to the
38 signal's C constant name (e.g. "SIGINT" or "SIGTERM").
39
41 On success, sd_event_source_set_description() and
42 sd_event_source_get_description() return a non-negative integer. On
43 failure, they return a negative errno-style error code.
44
45 Errors
46 Returned errors may indicate the following problems:
47
48 -EINVAL
49 source is not a valid pointer to an sd_event_source object or the
50 description argument for sd_event_source_get_description() is NULL.
51
52 -ENOMEM
53 Not enough memory to copy the name.
54
55 -ECHILD
56 The event loop has been created in a different process.
57
58 -ENXIO
59 No name was set for the event source.
60
62 These APIs are implemented as a shared library, which can be compiled
63 and linked to with the libsystemd pkg-config(1) file.
64
66 sd-event(3), sd_event_add_io(3), sd_event_add_time(3),
67 sd_event_add_signal(3), sd_event_add_child(3), sd_event_add_inotify(3),
68 sd_event_add_defer(3), sd_event_source_set_userdata(3)
69
70
71
72systemd 248 SD_EVENT_SOURCE_SET_DESCRIPTION(3)