man-pages/man3/sd_event_source_set_description.3.html
2021-03-31 01:06:50 +01:00

177 lines
4.7 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of SD_EVENT_SOURCE_SET_DESCRIPTION</TITLE>
</HEAD><BODY>
<H1>SD_EVENT_SOURCE_SET_DESCRIPTION</H1>
Section: sd_event_source_set_description (3)<BR>Updated: <BR><A HREF="#index">Index</A>
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
<A NAME="lbAB">&nbsp;</A>
<H2>NAME</H2>
sd_event_source_set_description, sd_event_source_get_description - Set or retrieve descriptive names of event sources
<A NAME="lbAC">&nbsp;</A>
<H2>SYNOPSIS</H2>
<P>
<B>
</B><PRE>
#include &lt;<A HREF="file:///usr/include/systemd/sd-event.h">systemd/sd-event.h</A>&gt;
</PRE>
<DL COMPACT>
<DT id="1">
<B>int sd_event_source_set_description(sd_event_source&nbsp;*</B><I>source</I><B>, const&nbsp;char&nbsp;*</B><I>description</I><B>);</B>
<DT id="2">
<B>int sd_event_source_get_description(sd_event_source&nbsp;*</B><I>source</I><B>, const&nbsp;char&nbsp;**</B><I>description</I><B>);</B>
</DL>
<A NAME="lbAD">&nbsp;</A>
<H2>DESCRIPTION</H2>
<P>
<B>sd_event_source_set_description()</B>
<DD>may be used to set an arbitrary descriptive name for the event source object specified as
<I>source</I>. This name will be used in debugging messages generated by
<B><A HREF="/cgi-bin/man/man2html?3+sd-event">sd-event</A></B>(3)
for this event source, and may be queried using
<B>sd_event_source_get_description()</B>
for debugging purposes. The
<I>description</I>
parameter shall point to a
<B>NUL</B>-terminated string or be
<B>NULL</B>. In the latter case, the descriptive name will be unset. The string is copied internally, hence the
<I>description</I>
argument is not referenced after the function returns.
<P>
<B>sd_event_source_get_description()</B>
may be used to query the current descriptive name assigned to the event source object
<I>source</I>. It returns a pointer to the current name in
<I>description</I>, stored in memory internal to the event source. The memory is invalidated when the event source is destroyed or the descriptive name is changed.
<P>
Event source objects generally have no description set when they are created, except for UNIX signal event sources created with
<B><A HREF="/cgi-bin/man/man2html?3+sd_event_add_signal">sd_event_add_signal</A></B>(3), whose descriptive name is initialized to the signal's C constant name (e.g.
&quot;SIGINT&quot;
or
&quot;SIGTERM&quot;).
<A NAME="lbAE">&nbsp;</A>
<H2>RETURN VALUE</H2>
<P>
On success,
<B>sd_event_source_set_description()</B>
and
<B>sd_event_source_get_description()</B>
return a non-negative integer. On failure, they return a negative errno-style error code.
<A NAME="lbAF">&nbsp;</A>
<H3>Errors</H3>
<P>
Returned errors may indicate the following problems:
<P>
<B>-EINVAL</B>
<DL COMPACT><DT id="3"><DD>
<I>source</I>
is not a valid pointer to an
sd_event_source
object or the
<I>description</I>
argument for
<B>sd_event_source_get_description()</B>
is
<B>NULL</B>.
</DL>
<P>
<B>-ENOMEM</B>
<DL COMPACT><DT id="4"><DD>
Not enough memory to copy the name.
</DL>
<P>
<B>-ECHILD</B>
<DL COMPACT><DT id="5"><DD>
The event loop has been created in a different process.
</DL>
<P>
<B>-ENXIO</B>
<DL COMPACT><DT id="6"><DD>
No name was set for the event source.
</DL>
<A NAME="lbAG">&nbsp;</A>
<H2>NOTES</H2>
<P>
These APIs are implemented as a shared library, which can be compiled and linked to with the
<B>libsystemd</B>&nbsp;<B><A HREF="/cgi-bin/man/man2html?1+pkg-config">pkg-config</A></B>(1)
file.
<A NAME="lbAH">&nbsp;</A>
<H2>SEE ALSO</H2>
<P>
<B><A HREF="/cgi-bin/man/man2html?3+sd-event">sd-event</A></B>(3),
<B><A HREF="/cgi-bin/man/man2html?3+sd_event_add_io">sd_event_add_io</A></B>(3),
<B><A HREF="/cgi-bin/man/man2html?3+sd_event_add_time">sd_event_add_time</A></B>(3),
<B><A HREF="/cgi-bin/man/man2html?3+sd_event_add_signal">sd_event_add_signal</A></B>(3),
<B><A HREF="/cgi-bin/man/man2html?3+sd_event_add_child">sd_event_add_child</A></B>(3),
<B><A HREF="/cgi-bin/man/man2html?3+sd_event_add_inotify">sd_event_add_inotify</A></B>(3),
<B><A HREF="/cgi-bin/man/man2html?3+sd_event_add_defer">sd_event_add_defer</A></B>(3),
<B><A HREF="/cgi-bin/man/man2html?3+sd_event_source_set_userdata">sd_event_source_set_userdata</A></B>(3)
<P>
<HR>
<A NAME="index">&nbsp;</A><H2>Index</H2>
<DL>
<DT id="7"><A HREF="#lbAB">NAME</A><DD>
<DT id="8"><A HREF="#lbAC">SYNOPSIS</A><DD>
<DT id="9"><A HREF="#lbAD">DESCRIPTION</A><DD>
<DT id="10"><A HREF="#lbAE">RETURN VALUE</A><DD>
<DL>
<DT id="11"><A HREF="#lbAF">Errors</A><DD>
</DL>
<DT id="12"><A HREF="#lbAG">NOTES</A><DD>
<DT id="13"><A HREF="#lbAH">SEE ALSO</A><DD>
</DL>
<HR>
This document was created by
<A HREF="/cgi-bin/man/man2html">man2html</A>,
using the manual pages.<BR>
Time: 00:05:55 GMT, March 31, 2021
</BODY>
</HTML>