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

193 lines
4.1 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of SD_BUS_MESSAGE_NEW_SIGNAL</TITLE>
</HEAD><BODY>
<H1>SD_BUS_MESSAGE_NEW_SIGNAL</H1>
Section: sd_bus_message_new_signal (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_message_new_signal - Create a signal message
<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>int sd_bus_message_new_signal(sd_bus&nbsp;*</B><I>bus</I><B>, sd_bus_message&nbsp;**</B><I>m</I><B>, const&nbsp;char&nbsp;*</B><I>path</I><B>, const&nbsp;char&nbsp;*</B><I>interface</I><B>, const&nbsp;char&nbsp;*</B><I>member</I><B>);</B>
</DL>
<A NAME="lbAD">&nbsp;</A>
<H2>DESCRIPTION</H2>
<P>
<DD>The
<B>sd_bus_message_new_signal()</B>
function creates a new bus message object that encapsulates a D-Bus signal, and returns it in the
<I>m</I>
output parameter. The signal will be sent to path
<I>path</I>, on the interface
<I>interface</I>, member
<I>member</I>. When this message is sent, no reply is expected. See
<B><A HREF="/cgi-bin/man/man2html?1+sd_bus_message_new_call">sd_bus_message_new_call</A></B>(1)
for a short description of the meaning of the
<I>path</I>,
<I>interface</I>, and
<I>member</I>
parameters.
<A NAME="lbAE">&nbsp;</A>
<H2>RETURN VALUE</H2>
<P>
This function returns 0 if the message object was successfully created, and a negative errno-style error code otherwise.
<A NAME="lbAF">&nbsp;</A>
<H3>Errors</H3>
<P>
Returned errors may indicate the following problems:
<P>
<B>-EINVAL</B>
<DL COMPACT><DT id="2"><DD>
The output parameter
<I>m</I>
is
<B>NULL</B>.
<P>
The
<I>path</I>
parameter is not a valid D-Bus path (&quot;/an/object/path&quot;), the
<I>interface</I>
parameter is not a valid D-Bus interface name (&quot;an.interface.name&quot;), or the
<I>member</I>
parameter is not a valid D-Bus member (&quot;Name&quot;).
</DL>
<P>
<B>-ENOTCONN</B>
<DL COMPACT><DT id="3"><DD>
The bus parameter
<I>bus</I>
is
<B>NULL</B>
or the bus is not connected.
</DL>
<P>
<B>-ENOMEM</B>
<DL COMPACT><DT id="4"><DD>
Memory allocation failed.
</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>EXAMPLES</H2>
<P>
<B>Example&nbsp;1.&nbsp;Send a simple signal</B>
<P>
<DL COMPACT><DT id="5"><DD>
<PRE>
#include &lt;<A HREF="file:///usr/include/systemd/sd-bus.h">systemd/sd-bus.h</A>&gt;
#define _cleanup_(f) __attribute__((cleanup(f)))
int send_unit_files_changed(sd_bus *bus) {
_cleanup_(sd_bus_message_unrefp) sd_bus_message *message = NULL;
int r;
r = sd_bus_message_new_signal(bus, &amp;message,
&quot;/org/freedesktop/systemd1&quot;,
&quot;org.freedesktop.systemd1.Manager&quot;,
&quot;UnitFilesChanged&quot;);
if (r &lt; 0)
return r;
return sd_bus_send(bus, message, NULL);
}
</PRE>
</DL>
<P>
This function in systemd sources is used to emit the
&quot;UnitFilesChanged&quot;
signal when the unit files have been changed.
<A NAME="lbAI">&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)
<P>
<HR>
<A NAME="index">&nbsp;</A><H2>Index</H2>
<DL>
<DT id="6"><A HREF="#lbAB">NAME</A><DD>
<DT id="7"><A HREF="#lbAC">SYNOPSIS</A><DD>
<DT id="8"><A HREF="#lbAD">DESCRIPTION</A><DD>
<DT id="9"><A HREF="#lbAE">RETURN VALUE</A><DD>
<DL>
<DT id="10"><A HREF="#lbAF">Errors</A><DD>
</DL>
<DT id="11"><A HREF="#lbAG">NOTES</A><DD>
<DT id="12"><A HREF="#lbAH">EXAMPLES</A><DD>
<DT id="13"><A HREF="#lbAI">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:54 GMT, March 31, 2021
</BODY>
</HTML>