]> git.ipfire.org Git - thirdparty/systemd.git/blob - man/sd_event_source_set_description.xml
man: use same header for all files
[thirdparty/systemd.git] / man / sd_event_source_set_description.xml
1 <?xml version='1.0'?>
2 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
4 <!-- SPDX-License-Identifier: LGPL-2.1+ -->
5
6 <refentry id="sd_event_source_set_description" xmlns:xi="http://www.w3.org/2001/XInclude">
7
8 <refentryinfo>
9 <title>sd_event_source_set_description</title>
10 <productname>systemd</productname>
11 </refentryinfo>
12
13 <refmeta>
14 <refentrytitle>sd_event_source_set_description</refentrytitle>
15 <manvolnum>3</manvolnum>
16 </refmeta>
17
18 <refnamediv>
19 <refname>sd_event_source_set_description</refname>
20 <refname>sd_event_source_get_description</refname>
21
22 <refpurpose>Set or retrieve descriptive names of event sources</refpurpose>
23 </refnamediv>
24
25 <refsynopsisdiv>
26 <funcsynopsis>
27 <funcsynopsisinfo>#include &lt;systemd/sd-event.h&gt;</funcsynopsisinfo>
28
29 <funcprototype>
30 <funcdef>int <function>sd_event_source_set_description</function></funcdef>
31 <paramdef>sd_event_source *<parameter>source</parameter></paramdef>
32 <paramdef>const char *<parameter>description</parameter></paramdef>
33 </funcprototype>
34
35 <funcprototype>
36 <funcdef>int <function>sd_event_source_get_description</function></funcdef>
37 <paramdef>sd_event_source *<parameter>source</parameter></paramdef>
38 <paramdef>const char **<parameter>description</parameter></paramdef>
39 </funcprototype>
40
41 </funcsynopsis>
42 </refsynopsisdiv>
43
44 <refsect1>
45 <title>Description</title>
46
47 <para><function>sd_event_source_set_description()</function> may
48 be used to set an arbitrary descriptive name for the event source
49 object specified as <parameter>source</parameter>. This name will
50 be used in debugging messages generated by
51 <citerefentry><refentrytitle>sd-event</refentrytitle><manvolnum>3</manvolnum></citerefentry>
52 for this event source, and may be queried using
53 <function>sd_event_source_get_description()</function> for
54 debugging purposes. The <parameter>description</parameter> parameter shall
55 point to a <constant>NUL</constant>-terminated string or be
56 <constant>NULL</constant>. In the latter case, the descriptive
57 name will be unset. The string is copied internally, hence the
58 <parameter>description</parameter> argument is not referenced
59 after the function returns.</para>
60
61 <para><function>sd_event_source_get_description()</function> may
62 be used to query the current descriptive name assigned to the
63 event source object <parameter>source</parameter>. It returns a
64 pointer to the current name in <parameter>description</parameter>,
65 stored in memory internal to the event source. The memory is
66 invalidated when the event source is destroyed or the descriptive
67 name is changed.</para>
68
69 <para>Event source objects generally have no description set when
70 they are created, except for UNIX signal event sources created
71 with
72 <citerefentry><refentrytitle>sd_event_add_signal</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
73 whose descriptive name is initialized to the signal's C constant
74 name (e.g. <literal>SIGINT</literal> or
75 <literal>SIGTERM</literal>).</para>
76 </refsect1>
77
78 <refsect1>
79 <title>Return Value</title>
80
81 <para>On success, <function>sd_event_source_set_description()</function> and
82 <function>sd_event_source_get_description()</function> return a
83 non-negative integer. On failure, they return a negative
84 errno-style error code.</para>
85 </refsect1>
86
87 <refsect1>
88 <title>Errors</title>
89
90 <para>Returned errors may indicate the following problems:</para>
91
92 <variablelist>
93 <varlistentry>
94 <term><constant>-EINVAL</constant></term>
95
96 <listitem><para><parameter>source</parameter> is not a valid
97 pointer to an <structname>sd_event_source</structname>
98 object or the <parameter>description</parameter> argument for
99 <function>sd_event_source_get_description()</function> is
100 <constant>NULL</constant>.</para></listitem>
101 </varlistentry>
102
103 <varlistentry>
104 <term><constant>-ENOMEM</constant></term>
105
106 <listitem><para>Not enough memory to copy the
107 name.</para></listitem>
108 </varlistentry>
109
110 <varlistentry>
111 <term><constant>-ECHILD</constant></term>
112
113 <listitem><para>The event loop has been created in a different process.</para></listitem>
114
115 </varlistentry>
116
117 <varlistentry>
118 <term><constant>-ENXIO</constant></term>
119
120 <listitem><para>No name was set for the event
121 source.</para></listitem>
122 </varlistentry>
123
124 </variablelist>
125 </refsect1>
126
127 <xi:include href="libsystemd-pkgconfig.xml" />
128
129 <refsect1>
130 <title>See Also</title>
131
132 <para>
133 <citerefentry><refentrytitle>sd-event</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
134 <citerefentry><refentrytitle>sd_event_add_io</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
135 <citerefentry><refentrytitle>sd_event_add_time</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
136 <citerefentry><refentrytitle>sd_event_add_signal</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
137 <citerefentry><refentrytitle>sd_event_add_child</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
138 <citerefentry><refentrytitle>sd_event_add_inotify</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
139 <citerefentry><refentrytitle>sd_event_add_defer</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
140 <citerefentry><refentrytitle>sd_event_source_set_userdata</refentrytitle><manvolnum>3</manvolnum></citerefentry>
141 </para>
142 </refsect1>
143
144 </refentry>