1SD_EVENT_SOURCE_SET_DESCRsIdP_TeIvOeNn(t3_)source_set_dSeDs_cErViEpNtTi_oSnOURCE_SET_DESCRIPTION(3)
2
3
4

NAME

6       sd_event_source_set_description, sd_event_source_get_description - Set
7       or retrieve descriptive names of event sources
8

SYNOPSIS

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

DESCRIPTION

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

RETURN VALUE

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, library or
57           module instance.
58
59       -ENXIO
60           No name was set for the event source.
61

NOTES

63       Functions described here are available as a shared library, which can
64       be compiled against and linked to with the libsystemd pkg-config(1)
65       file.
66
67       The code described here uses getenv(3), which is declared to be not
68       multi-thread-safe. This means that the code calling the functions
69       described here must not call setenv(3) from a parallel thread. It is
70       recommended to only do calls to setenv() from an early phase of the
71       program when no other threads have been started.
72

SEE ALSO

74       sd-event(3), sd_event_add_io(3), sd_event_add_time(3),
75       sd_event_add_signal(3), sd_event_add_child(3), sd_event_add_inotify(3),
76       sd_event_add_defer(3), sd_event_source_set_userdata(3)
77
78
79
80systemd 254                                 SD_EVENT_SOURCE_SET_DESCRIPTION(3)
Impressum