1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181
|
'\" t
.TH "SD_BUS_MESSAGE_NEW" "3" "" "systemd 241" "sd_bus_message_new"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
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
.SH "SYNOPSIS"
.sp
.ft B
.nf
#include <systemd/sd\-bus\&.h>
.fi
.ft
.sp
.ft B
.nf
enum {
\fBSD_BUS_MESSAGE_METHOD_CALL\fR,
\fBSD_BUS_MESSAGE_METHOD_RETURN\fR,
\fBSD_BUS_MESSAGE_METHOD_ERROR\fR,
\fBSD_BUS_MESSAGE_SIGNAL\fR,
};
.fi
.ft
.HP \w'int\ sd_bus_message_new('u
.BI "int sd_bus_message_new(sd_bus\ *" "bus" ", sd_bus_message\ **" "m" ", uint8_t\ " "type" ");"
.HP \w'sd_bus_message\ *sd_bus_message_ref('u
.BI "sd_bus_message *sd_bus_message_ref(sd_bus_message\ *" "m" ");"
.HP \w'sd_bus_message\ *sd_bus_message_unref('u
.BI "sd_bus_message *sd_bus_message_unref(sd_bus_message\ *" "m" ");"
.HP \w'void\ sd_bus_message_unrefp('u
.BI "void sd_bus_message_unrefp(sd_bus_message\ **" "mp" ");"
.HP \w'sd_bus\ *sd_bus_message_get_bus('u
.BI "sd_bus *sd_bus_message_get_bus(sd_bus_message\ *" "m" ");"
.SH "DESCRIPTION"
.PP
\fBsd_bus_message_new()\fR
creates a new bus message object attached to the bus
\fIbus\fR
and returns it in the output parameter
\fIm\fR\&. 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\&.
.PP
Note: this is a low\-level call\&. In most cases functions like
\fBsd_bus_message_new_method_call\fR(3),
\fBsd_bus_message_new_method_error\fR(3),
\fBsd_bus_message_new_method_return\fR(3), and
\fBsd_bus_message_new_signal\fR(3)
that create a message of a certain type and initialize various fields are easier to use\&.
.PP
The
\fItype\fR
parameter specifies the type of the message\&. It must be one of
\fBSD_BUS_MESSAGE_METHOD_CALL\fR
\(em a method call,
\fBSD_BUS_MESSAGE_METHOD_RETURN\fR
\(em a method call reply,
\fBSD_BUS_MESSAGE_METHOD_ERROR\fR
\(em an error reply to a method call,
\fBSD_BUS_MESSAGE_SIGNAL\fR
\(em a broadcast message with no reply\&.
.PP
The flag to allow interactive authorization is initialized based on the current value set in the bus object, see
\fBsd_bus_set_allow_interactive_authorization\fR(3)\&. This may be changed using
\fBsd_bus_message_set_allow_interactive_authorization\fR(3)\&.
.PP
\fBsd_bus_message_ref()\fR
increases the reference counter of
\fIm\fR
by one\&.
.PP
\fBsd_bus_message_unref()\fR
decreases the reference counter of
\fIm\fR
by one\&. Once the reference count has dropped to zero, message object is destroyed and cannot be used anymore, so further calls to
\fBsd_bus_message_ref()\fR
or
\fBsd_bus_message_unref()\fR
are illegal\&.
.PP
\fBsd_bus_message_unrefp()\fR
is similar to
\fBsd_bus_message_unref()\fR
but takes a pointer to a pointer to an
\fBsd_bus_message\fR
object\&. This call is useful in conjunction with GCC\*(Aqs and LLVM\*(Aqs
\m[blue]\fBClean\-up Variable Attribute\fR\m[]\&\s-2\u[1]\d\s+2\&. See
\fBsd_bus_new\fR(3)
for an example how to use the cleanup attribute\&.
.PP
\fBsd_bus_message_ref()\fR
and
\fBsd_bus_message_unref()\fR
execute no operation if the passed in bus object address is
\fBNULL\fR\&.
\fBsd_bus_message_unrefp()\fR
will first dereference its argument, which must not be
\fBNULL\fR, and will execute no operation if
\fIthat\fR
is
\fBNULL\fR\&.
.PP
\fBsd_bus_message_get_bus()\fR
returns the bus object that message
\fIm\fR
is attached to\&.
.SH "RETURN VALUE"
.PP
On success,
\fBsd_bus_message_new()\fR
returns 0 or a positive integer\&. On failure, it returns a negative errno\-style error code\&.
.PP
\fBsd_bus_message_ref()\fR
always returns the argument\&.
.PP
\fBsd_bus_message_unref()\fR
always returns
\fBNULL\fR\&.
.PP
\fBsd_bus_message_get_bus()\fR
always returns the bus object\&.
.SH "ERRORS"
.PP
Returned errors may indicate the following problems:
.PP
\fB\-EINVAL\fR
.RS 4
Specified
\fItype\fR
is invalid\&.
.RE
.PP
\fB\-ENOTCONN\fR
.RS 4
The bus parameter
\fIbus\fR
is
\fBNULL\fR
or the bus is not connected\&.
.RE
.PP
\fB\-ENOMEM\fR
.RS 4
Memory allocation failed\&.
.RE
.SH "NOTES"
.PP
These APIs are implemented as a shared library, which can be compiled and linked to with the
\fBlibsystemd\fR\ \&\fBpkg-config\fR(1)
file\&.
.SH "SEE ALSO"
.PP
\fBsystemd\fR(1),
\fBsd-bus\fR(3),
\fBsd_bus_new\fR(3),
\fBsd_bus_message_new_method_call\fR(3),
\fBsd_bus_message_new_method_error\fR(3),
\fBsd_bus_message_new_method_return\fR(3),
\fBsd_bus_message_new_signal\fR(3)
.SH "NOTES"
.IP " 1." 4
Clean-up Variable Attribute
.RS 4
\%https://gcc.gnu.org/onlinedocs/gcc/Common-Variable-Attributes.html
.RE
|