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