]> git.ipfire.org Git - thirdparty/systemd.git/blob - man/sd_event_source_set_description.xml
man: fix link markup
[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 non-negative integer. On failure, they
83 return a negative errno-style error code.</para>
84
85 <refsect2>
86 <title>Errors</title>
87
88 <para>Returned errors may indicate the following problems:</para>
89
90 <variablelist>
91 <varlistentry>
92 <term><constant>-EINVAL</constant></term>
93
94 <listitem><para><parameter>source</parameter> is not a valid pointer to an
95 <structname>sd_event_source</structname> object or the <parameter>description</parameter> argument
96 for <function>sd_event_source_get_description()</function> is <constant>NULL</constant>.
97 </para></listitem>
98 </varlistentry>
99
100 <varlistentry>
101 <term><constant>-ENOMEM</constant></term>
102
103 <listitem><para>Not enough memory to copy the name.</para></listitem>
104 </varlistentry>
105
106 <varlistentry>
107 <term><constant>-ECHILD</constant></term>
108
109 <listitem><para>The event loop has been created in a different process.</para></listitem>
110
111 </varlistentry>
112
113 <varlistentry>
114 <term><constant>-ENXIO</constant></term>
115
116 <listitem><para>No name was set for the event source.</para></listitem>
117 </varlistentry>
118
119 </variablelist>
120 </refsect2>
121 </refsect1>
122
123 <xi:include href="libsystemd-pkgconfig.xml" />
124
125 <refsect1>
126 <title>See Also</title>
127
128 <para>
129 <citerefentry><refentrytitle>sd-event</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
130 <citerefentry><refentrytitle>sd_event_add_io</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
131 <citerefentry><refentrytitle>sd_event_add_time</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
132 <citerefentry><refentrytitle>sd_event_add_signal</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
133 <citerefentry><refentrytitle>sd_event_add_child</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
134 <citerefentry><refentrytitle>sd_event_add_inotify</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
135 <citerefentry><refentrytitle>sd_event_add_defer</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
136 <citerefentry><refentrytitle>sd_event_source_set_userdata</refentrytitle><manvolnum>3</manvolnum></citerefentry>
137 </para>
138 </refsect1>
139
140 </refentry>