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