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

125 lines
3.4 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of SD_BUS_SLOT_SET_USERDATA</TITLE>
</HEAD><BODY>
<H1>SD_BUS_SLOT_SET_USERDATA</H1>
Section: sd_bus_slot_set_userdata (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_bus_slot_set_userdata, sd_bus_slot_get_userdata - Set and query the value in the &quot;userdata&quot; field
<A NAME="lbAC">&nbsp;</A>
<H2>SYNOPSIS</H2>
<P>
<B>
</B><PRE>
#include &lt;<A HREF="file:///usr/include/systemd/sd-bus.h">systemd/sd-bus.h</A>&gt;
</PRE>
<DL COMPACT>
<DT id="1">
<B>void* sd_bus_slot_set_userdata(sd_bus_slot*&nbsp;</B><I>slot</I><B>, void*&nbsp;</B><I>userdata</I><B>);</B>
<DT id="2">
<B>void* sd_bus_slot_get_userdata(sd_bus_slot*&nbsp;</B><I>slot</I><B>);</B>
</DL>
<A NAME="lbAD">&nbsp;</A>
<H2>DESCRIPTION</H2>
<P>
<DD>The userdata pointer allows data to be passed between the point where a callback is registered, for example when a filter is added using
<B><A HREF="/cgi-bin/man/man2html?3+sd_bus_add_filter">sd_bus_add_filter</A></B>(3)
or an asynchronous function call is made using
<B><A HREF="/cgi-bin/man/man2html?3+sd_bus_call_async">sd_bus_call_async</A></B>(3), and the point where the callback is called, without having any global state. The pointer has type
<B>void*</B>
and is not used by the sd-bus functions in any way, except to pass to the callback function.
<P>
Usually, the userdata field is set when the slot object is initially registered.
<B>sd_bus_slot_set_userdata()</B>
may be used to change it later for the bus slot object
<I>slot</I>. Previous value of the field is returned. The argument and returned value may be
<B>NULL</B>. It will be passed as the
<I>userdata</I>
argument to the callback function attached to the slot.
<P>
<B>sd_bus_slot_set_userdata()</B>
gets the value of the userdata field in the bus slot object
<I>slot</I>.
<A NAME="lbAE">&nbsp;</A>
<H2>RETURN VALUE</H2>
<P>
On success, these functions return the value of the userdata field before the function call. If the
<I>slot</I>
object is
<B>NULL</B>,
<B>NULL</B>
will be returned to signify an error, but this is not distinguishable from the userdata field value being
<B>NULL</B>.
<A NAME="lbAF">&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="lbAG">&nbsp;</A>
<H2>SEE ALSO</H2>
<P>
<B><A HREF="/cgi-bin/man/man2html?1+systemd">systemd</A></B>(1),
<B><A HREF="/cgi-bin/man/man2html?3+sd-bus">sd-bus</A></B>(3),
<B><A HREF="/cgi-bin/man/man2html?3+sd_bus_slot_set_destroy_callback">sd_bus_slot_set_destroy_callback</A></B>(3),
<B><A HREF="/cgi-bin/man/man2html?3+sd_bus_add_match">sd_bus_add_match</A></B>(3),
<B><A HREF="/cgi-bin/man/man2html?3+sd_bus_slot_get_current_userdata">sd_bus_slot_get_current_userdata</A></B>(3)
<P>
<HR>
<A NAME="index">&nbsp;</A><H2>Index</H2>
<DL>
<DT id="3"><A HREF="#lbAB">NAME</A><DD>
<DT id="4"><A HREF="#lbAC">SYNOPSIS</A><DD>
<DT id="5"><A HREF="#lbAD">DESCRIPTION</A><DD>
<DT id="6"><A HREF="#lbAE">RETURN VALUE</A><DD>
<DT id="7"><A HREF="#lbAF">NOTES</A><DD>
<DT id="8"><A HREF="#lbAG">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>