2 <!DOCTYPE refentry PUBLIC
"-//OASIS//DTD DocBook XML V4.2//EN"
3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
6 SPDX-License-Identifier: LGPL-2.1+
9 <refentry id=
"sd_event_source_set_description" xmlns:
xi=
"http://www.w3.org/2001/XInclude">
12 <title>sd_event_source_set_description
</title>
13 <productname>systemd
</productname>
17 <refentrytitle>sd_event_source_set_description
</refentrytitle>
18 <manvolnum>3</manvolnum>
22 <refname>sd_event_source_set_description
</refname>
23 <refname>sd_event_source_get_description
</refname>
25 <refpurpose>Set or retrieve descriptive names of event sources
</refpurpose>
30 <funcsynopsisinfo>#include
<systemd/sd-event.h
></funcsynopsisinfo>
33 <funcdef>int
<function>sd_event_source_set_description
</function></funcdef>
34 <paramdef>sd_event_source *
<parameter>source
</parameter></paramdef>
35 <paramdef>const char *
<parameter>description
</parameter></paramdef>
39 <funcdef>int
<function>sd_event_source_get_description
</function></funcdef>
40 <paramdef>sd_event_source *
<parameter>source
</parameter></paramdef>
41 <paramdef>const char **
<parameter>description
</parameter></paramdef>
48 <title>Description
</title>
50 <para><function>sd_event_source_set_description()
</function> may
51 be used to set an arbitrary descriptive name for the event source
52 object specified as
<parameter>source
</parameter>. This name will
53 be used in debugging messages generated by
54 <citerefentry><refentrytitle>sd-event
</refentrytitle><manvolnum>3</manvolnum></citerefentry>
55 for this event source, and may be queried using
56 <function>sd_event_source_get_description()
</function> for
57 debugging purposes. The
<parameter>description
</parameter> parameter shall
58 point to a
<constant>NUL
</constant>-terminated string or be
59 <constant>NULL
</constant>. In the latter case, the descriptive
60 name will be unset. The string is copied internally, hence the
61 <parameter>description
</parameter> argument is not referenced
62 after the function returns.
</para>
64 <para><function>sd_event_source_get_description()
</function> may
65 be used to query the current descriptive name assigned to the
66 event source object
<parameter>source
</parameter>. It returns a
67 pointer to the current name in
<parameter>description
</parameter>,
68 stored in memory internal to the event source. The memory is
69 invalidated when the event source is destroyed or the descriptive
70 name is changed.
</para>
72 <para>Event source objects generally have no description set when
73 they are created, except for UNIX signal event sources created
75 <citerefentry><refentrytitle>sd_event_add_signal
</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
76 whose descriptive name is initialized to the signal's C constant
77 name (e.g.
<literal>SIGINT
</literal> or
78 <literal>SIGTERM
</literal>).
</para>
82 <title>Return Value
</title>
84 <para>On success,
<function>sd_event_source_set_description()
</function> and
85 <function>sd_event_source_get_description()
</function> return a
86 non-negative integer. On failure, they return a negative
87 errno-style error code.
</para>
93 <para>Returned errors may indicate the following problems:
</para>
97 <term><constant>-EINVAL
</constant></term>
99 <listitem><para><parameter>source
</parameter> is not a valid
100 pointer to an
<structname>sd_event_source
</structname>
101 object or the
<parameter>description
</parameter> argument for
102 <function>sd_event_source_get_description()
</function> is
103 <constant>NULL
</constant>.
</para></listitem>
107 <term><constant>-ENOMEM
</constant></term>
109 <listitem><para>Not enough memory to copy the
110 name.
</para></listitem>
114 <term><constant>-ECHILD
</constant></term>
116 <listitem><para>The event loop has been created in a different process.
</para></listitem>
121 <term><constant>-ENXIO
</constant></term>
123 <listitem><para>No name was set for the event
124 source.
</para></listitem>
130 <xi:include href=
"libsystemd-pkgconfig.xml" />
133 <title>See Also
</title>
136 <citerefentry><refentrytitle>sd-event
</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
137 <citerefentry><refentrytitle>sd_event_add_io
</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
138 <citerefentry><refentrytitle>sd_event_add_time
</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
139 <citerefentry><refentrytitle>sd_event_add_signal
</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
140 <citerefentry><refentrytitle>sd_event_add_child
</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
141 <citerefentry><refentrytitle>sd_event_add_inotify
</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
142 <citerefentry><refentrytitle>sd_event_add_defer
</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
143 <citerefentry><refentrytitle>sd_event_source_set_userdata
</refentrytitle><manvolnum>3</manvolnum></citerefentry>