262 lines
7.0 KiB
HTML
262 lines
7.0 KiB
HTML
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<HTML><HEAD><TITLE>Man page of SD_BUS_MESSAGE_NEW</TITLE>
|
|
</HEAD><BODY>
|
|
<H1>SD_BUS_MESSAGE_NEW</H1>
|
|
Section: sd_bus_message_new (3)<BR>Updated: <BR><A HREF="#index">Index</A>
|
|
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<A NAME="lbAB"> </A>
|
|
<H2>NAME</H2>
|
|
|
|
sd_bus_message_new, sd_bus_message_ref, sd_bus_message_unref, sd_bus_message_unrefp, SD_BUS_MESSAGE_METHOD_CALL, SD_BUS_MESSAGE_METHOD_RETURN, SD_BUS_MESSAGE_METHOD_ERROR, SD_BUS_MESSAGE_SIGNAL, sd_bus_message_get_bus - Create a new bus message object and create or destroy references to it
|
|
<A NAME="lbAC"> </A>
|
|
<H2>SYNOPSIS</H2>
|
|
|
|
<P>
|
|
<B>
|
|
</B><PRE>
|
|
#include <<A HREF="file:///usr/include/systemd/sd-bus.h">systemd/sd-bus.h</A>>
|
|
</PRE>
|
|
|
|
|
|
<P>
|
|
<B>
|
|
</B><PRE>
|
|
enum {
|
|
<B>SD_BUS_MESSAGE_METHOD_CALL</B>,
|
|
<B>SD_BUS_MESSAGE_METHOD_RETURN</B>,
|
|
<B>SD_BUS_MESSAGE_METHOD_ERROR</B>,
|
|
<B>SD_BUS_MESSAGE_SIGNAL</B>,
|
|
};
|
|
</PRE>
|
|
|
|
|
|
<DL COMPACT>
|
|
<DT id="1">
|
|
<B>int sd_bus_message_new(sd_bus *</B><I>bus</I><B>, sd_bus_message **</B><I>m</I><B>, uint8_t </B><I>type</I><B>);</B>
|
|
|
|
<DT id="2">
|
|
<B>sd_bus_message *sd_bus_message_ref(sd_bus_message *</B><I>m</I><B>);</B>
|
|
|
|
<DT id="3">
|
|
<B>sd_bus_message *sd_bus_message_unref(sd_bus_message *</B><I>m</I><B>);</B>
|
|
|
|
<DT id="4">
|
|
<B>void sd_bus_message_unrefp(sd_bus_message **</B><I>mp</I><B>);</B>
|
|
|
|
<DT id="5">
|
|
<B>sd_bus *sd_bus_message_get_bus(sd_bus_message *</B><I>m</I><B>);</B>
|
|
|
|
</DL>
|
|
<A NAME="lbAD"> </A>
|
|
<H2>DESCRIPTION</H2>
|
|
|
|
<P>
|
|
|
|
<B>sd_bus_message_new()</B>
|
|
<DD>creates a new bus message object attached to the bus
|
|
<I>bus</I>
|
|
and returns it in the output parameter
|
|
<I>m</I>. This object is reference-counted, and will be destroyed when all references are gone. Initially, the caller of this function owns the sole reference to the message object. Note that the message object holds a reference to the bus object, so the bus object will not be destroyed as long as the message exists.
|
|
<P>
|
|
|
|
Note: this is a low-level call. In most cases functions like
|
|
<B><A HREF="/cgi-bin/man/man2html?3+sd_bus_message_new_method_call">sd_bus_message_new_method_call</A></B>(3),
|
|
<B><A HREF="/cgi-bin/man/man2html?3+sd_bus_message_new_method_error">sd_bus_message_new_method_error</A></B>(3),
|
|
<B><A HREF="/cgi-bin/man/man2html?3+sd_bus_message_new_method_return">sd_bus_message_new_method_return</A></B>(3), and
|
|
<B><A HREF="/cgi-bin/man/man2html?3+sd_bus_message_new_signal">sd_bus_message_new_signal</A></B>(3)
|
|
that create a message of a certain type and initialize various fields are easier to use.
|
|
<P>
|
|
|
|
The
|
|
<I>type</I>
|
|
parameter specifies the type of the message. It must be one of
|
|
<B>SD_BUS_MESSAGE_METHOD_CALL</B>
|
|
--- a method call,
|
|
<B>SD_BUS_MESSAGE_METHOD_RETURN</B>
|
|
--- a method call reply,
|
|
<B>SD_BUS_MESSAGE_METHOD_ERROR</B>
|
|
--- an error reply to a method call,
|
|
<B>SD_BUS_MESSAGE_SIGNAL</B>
|
|
--- a broadcast message with no reply.
|
|
<P>
|
|
|
|
The flag to allow interactive authorization is initialized based on the current value set in the bus object, see
|
|
<B><A HREF="/cgi-bin/man/man2html?3+sd_bus_set_allow_interactive_authorization">sd_bus_set_allow_interactive_authorization</A></B>(3). This may be changed using
|
|
<B><A HREF="/cgi-bin/man/man2html?3+sd_bus_message_set_allow_interactive_authorization">sd_bus_message_set_allow_interactive_authorization</A></B>(3).
|
|
<P>
|
|
|
|
<B>sd_bus_message_ref()</B>
|
|
increases the reference counter of
|
|
<I>m</I>
|
|
by one.
|
|
<P>
|
|
|
|
<B>sd_bus_message_unref()</B>
|
|
decreases the reference counter of
|
|
<I>m</I>
|
|
by one. Once the reference count has dropped to zero, message object is destroyed and cannot be used anymore, so further calls to
|
|
<B>sd_bus_message_ref()</B>
|
|
or
|
|
<B>sd_bus_message_unref()</B>
|
|
are illegal.
|
|
<P>
|
|
|
|
<B>sd_bus_message_unrefp()</B>
|
|
is similar to
|
|
<B>sd_bus_message_unref()</B>
|
|
but takes a pointer to a pointer to an
|
|
<B>sd_bus_message</B>
|
|
object. This call is useful in conjunction with GCC's and LLVM's
|
|
m[blue]<B>Clean-up Variable Attribute</B>m[]<FONT SIZE="-2">[1]</FONT>. See
|
|
<B><A HREF="/cgi-bin/man/man2html?3+sd_bus_new">sd_bus_new</A></B>(3)
|
|
for an example how to use the cleanup attribute.
|
|
<P>
|
|
|
|
<B>sd_bus_message_ref()</B>
|
|
and
|
|
<B>sd_bus_message_unref()</B>
|
|
execute no operation if the passed in bus object address is
|
|
<B>NULL</B>.
|
|
<B>sd_bus_message_unrefp()</B>
|
|
will first dereference its argument, which must not be
|
|
<B>NULL</B>, and will execute no operation if
|
|
<I>that</I>
|
|
is
|
|
<B>NULL</B>.
|
|
<P>
|
|
|
|
<B>sd_bus_message_get_bus()</B>
|
|
returns the bus object that message
|
|
<I>m</I>
|
|
is attached to.
|
|
<A NAME="lbAE"> </A>
|
|
<H2>RETURN VALUE</H2>
|
|
|
|
<P>
|
|
|
|
On success,
|
|
<B>sd_bus_message_new()</B>
|
|
returns 0 or a positive integer. On failure, it returns a negative errno-style error code.
|
|
<P>
|
|
|
|
<B>sd_bus_message_ref()</B>
|
|
always returns the argument.
|
|
<P>
|
|
|
|
<B>sd_bus_message_unref()</B>
|
|
always returns
|
|
<B>NULL</B>.
|
|
<P>
|
|
|
|
<B>sd_bus_message_get_bus()</B>
|
|
always returns the bus object.
|
|
<A NAME="lbAF"> </A>
|
|
<H3>Errors</H3>
|
|
|
|
<P>
|
|
|
|
Returned errors may indicate the following problems:
|
|
<P>
|
|
|
|
<B>-EINVAL</B>
|
|
<DL COMPACT><DT id="6"><DD>
|
|
Specified
|
|
<I>type</I>
|
|
is invalid.
|
|
</DL>
|
|
|
|
<P>
|
|
|
|
<B>-ENOTCONN</B>
|
|
<DL COMPACT><DT id="7"><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="8"><DD>
|
|
Memory allocation failed.
|
|
</DL>
|
|
|
|
<A NAME="lbAG"> </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> <B><A HREF="/cgi-bin/man/man2html?1+pkg-config">pkg-config</A></B>(1)
|
|
file.
|
|
<A NAME="lbAH"> </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_new">sd_bus_new</A></B>(3),
|
|
<B><A HREF="/cgi-bin/man/man2html?3+sd_bus_message_new_method_call">sd_bus_message_new_method_call</A></B>(3),
|
|
<B><A HREF="/cgi-bin/man/man2html?3+sd_bus_message_new_method_error">sd_bus_message_new_method_error</A></B>(3),
|
|
<B><A HREF="/cgi-bin/man/man2html?3+sd_bus_message_new_method_return">sd_bus_message_new_method_return</A></B>(3),
|
|
<B><A HREF="/cgi-bin/man/man2html?3+sd_bus_message_new_signal">sd_bus_message_new_signal</A></B>(3)
|
|
<A NAME="lbAI"> </A>
|
|
<H2>NOTES</H2>
|
|
|
|
<DL COMPACT>
|
|
<DT id="9"> 1.<DD>
|
|
Clean-up Variable Attribute
|
|
<DL COMPACT><DT id="10"><DD>
|
|
<A HREF="https://gcc.gnu.org/onlinedocs/gcc/Common-Variable-Attributes.html">https://gcc.gnu.org/onlinedocs/gcc/Common-Variable-Attributes.html</A>
|
|
</DL>
|
|
|
|
<P>
|
|
</DL>
|
|
|
|
<HR>
|
|
<A NAME="index"> </A><H2>Index</H2>
|
|
<DL>
|
|
<DT id="11"><A HREF="#lbAB">NAME</A><DD>
|
|
<DT id="12"><A HREF="#lbAC">SYNOPSIS</A><DD>
|
|
<DT id="13"><A HREF="#lbAD">DESCRIPTION</A><DD>
|
|
<DT id="14"><A HREF="#lbAE">RETURN VALUE</A><DD>
|
|
<DL>
|
|
<DT id="15"><A HREF="#lbAF">Errors</A><DD>
|
|
</DL>
|
|
<DT id="16"><A HREF="#lbAG">NOTES</A><DD>
|
|
<DT id="17"><A HREF="#lbAH">SEE ALSO</A><DD>
|
|
<DT id="18"><A HREF="#lbAI">NOTES</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>
|