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