]>
Commit | Line | Data |
---|---|---|
3802a3d3 | 1 | <?xml version='1.0'?> <!--*- Mode: nxml; nxml-child-indent: 2; indent-tabs-mode: nil -*--> |
043f6294 | 2 | <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" |
12b42c76 | 3 | "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"> |
043f6294 ZJS |
4 | |
5 | <!-- | |
5de0ccff | 6 | This file is part of systemd. |
043f6294 | 7 | |
5de0ccff | 8 | Copyright 2014 Zbigniew Jędrzejewski-Szmek |
043f6294 | 9 | |
5de0ccff ZJS |
10 | systemd is free software; you can redistribute it and/or modify it |
11 | under the terms of the GNU Lesser General Public License as published by | |
12 | the Free Software Foundation; either version 2.1 of the License, or | |
13 | (at your option) any later version. | |
043f6294 | 14 | |
5de0ccff ZJS |
15 | systemd is distributed in the hope that it will be useful, but |
16 | WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
18 | Lesser General Public License for more details. | |
043f6294 | 19 | |
5de0ccff ZJS |
20 | You should have received a copy of the GNU Lesser General Public License |
21 | along with systemd; If not, see <http://www.gnu.org/licenses/>. | |
043f6294 ZJS |
22 | --> |
23 | ||
48f69d8f | 24 | <refentry id="sd_event_set_name" |
043f6294 ZJS |
25 | xmlns:xi="http://www.w3.org/2001/XInclude"> |
26 | ||
27 | <refentryinfo> | |
28 | <title>sd_event_set_name</title> | |
29 | <productname>systemd</productname> | |
30 | ||
31 | <authorgroup> | |
32 | <author> | |
33 | <contrib>More text</contrib> | |
34 | <firstname>Zbigniew</firstname> | |
35 | <surname>Jędrzejewski-Szmek</surname> | |
36 | <email>zbyszek@in.waw.pl</email> | |
37 | </author> | |
38 | </authorgroup> | |
39 | </refentryinfo> | |
40 | ||
41 | <refmeta> | |
42 | <refentrytitle>sd_event_set_name</refentrytitle> | |
43 | <manvolnum>3</manvolnum> | |
44 | </refmeta> | |
45 | ||
46 | <refnamediv> | |
47 | <refname>sd_event_set_name</refname> | |
48 | <refname>sd_event_get_name</refname> | |
49 | ||
50 | <refpurpose>Set human-readable names for event sources</refpurpose> | |
51 | </refnamediv> | |
52 | ||
53 | <refsynopsisdiv> | |
54 | <funcsynopsis> | |
55 | <funcsynopsisinfo>#include <systemd/sd-bus.h></funcsynopsisinfo> | |
56 | ||
57 | <funcprototype> | |
58 | <funcdef>int <function>sd_event_set_name</function></funcdef> | |
59 | <paramdef>sd_event_source *<parameter>source</parameter></paramdef> | |
60 | <paramdef>const char *<parameter>name</parameter></paramdef> | |
61 | </funcprototype> | |
62 | ||
63 | <funcprototype> | |
64 | <funcdef>int <function>sd_event_get_name</function></funcdef> | |
65 | <paramdef>sd_event_source *<parameter>source</parameter></paramdef> | |
66 | <paramdef>const char **<parameter>name</parameter></paramdef> | |
67 | </funcprototype> | |
68 | ||
69 | </funcsynopsis> | |
70 | </refsynopsisdiv> | |
71 | ||
72 | <refsect1> | |
73 | <title>Description</title> | |
74 | ||
75 | <para><function>sd_event_set_name()</function> can be used to set | |
76 | an arbitrary name for the event source | |
77 | <parameter>source</parameter>. This name will be used in error | |
78 | messages generated by | |
79 | <citerefentry><refentrytitle>sd-event</refentrytitle><manvolnum>3</manvolnum></citerefentry> | |
a8eaaee7 | 80 | for this source. The <parameter>name</parameter> must point |
043f6294 ZJS |
81 | to a <constant>NUL</constant>-terminated string or be |
82 | <constant>NULL</constant>. In the latter case, the name will be | |
83 | unset. The string is copied internally, so the | |
84 | <parameter>name</parameter> argument is not referenced after the | |
85 | function returns.</para> | |
86 | ||
87 | <para><function>sd_event_set_name()</function> can be used to | |
88 | query the current name assigned to source | |
89 | <parameter>source</parameter>. It returns a pointer to the current | |
90 | name (possibly <constant>NULL</constant>) in | |
91 | <parameter>name</parameter>.</para> | |
92 | </refsect1> | |
93 | ||
94 | <refsect1> | |
95 | <title>Return Value</title> | |
96 | ||
97 | <para>On success, <function>sd_event_set_name()</function> and | |
98 | <function>sd_event_get_name()</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 | structure or the <parameter>name</parameter> argument for | |
115 | <function>sd_event_get_name()</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 | </variablelist> | |
126 | </refsect1> | |
127 | ||
128 | <refsect1> | |
129 | <title>Notes</title> | |
130 | ||
a8eaaee7 | 131 | <para>The functions described here are available as a |
043f6294 ZJS |
132 | shared library, which can be compiled and linked to with the |
133 | <constant>libsystemd</constant> <citerefentry | |
134 | project='die-net'><refentrytitle>pkg-config</refentrytitle><manvolnum>1</manvolnum></citerefentry> | |
135 | file.</para> | |
136 | </refsect1> | |
137 | ||
138 | <refsect1> | |
139 | <title>See Also</title> | |
140 | ||
141 | <para> | |
142 | <citerefentry><refentrytitle>sd-event</refentrytitle><manvolnum>3</manvolnum></citerefentry>, | |
143 | <citerefentry><refentrytitle>sd_event_add_time</refentrytitle><manvolnum>3</manvolnum></citerefentry>, | |
144 | <citerefentry><refentrytitle>sd_event_add_child</refentrytitle><manvolnum>3</manvolnum></citerefentry>, | |
145 | <citerefentry><refentrytitle>sd_event_add_signal</refentrytitle><manvolnum>3</manvolnum></citerefentry>, | |
146 | <citerefentry><refentrytitle>sd_event_add_defer</refentrytitle><manvolnum>3</manvolnum></citerefentry>, | |
147 | <citerefentry><refentrytitle>sd_event_run</refentrytitle><manvolnum>3</manvolnum></citerefentry> | |
148 | </para> | |
149 | </refsect1> | |
150 | ||
151 | </refentry> |