Debian Codegraph @

upstream/debian-unstable/man3/sd_bus_message_new.3

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