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