| 1 |
'\" t |
| 2 |
.TH "SD_BUS_MESSAGE_APPEND_STRING_MEMFD" "3" "" "systemd 261~rc3" "sd_bus_message_append_string_memfd" |
| 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_append_string_memfd, sd_bus_message_append_string_iovec, sd_bus_message_append_string_space \- Attach a string to a message |
| 24 |
.SH "SYNOPSIS" |
| 25 |
.sp |
| 26 |
.ft B |
| 27 |
.nf |
| 28 |
#include <systemd/sd\-bus\&.h> |
| 29 |
.fi |
| 30 |
.ft |
| 31 |
.HP \w'int\ sd_bus_message_append_string_memfd('u |
| 32 |
.BI "int sd_bus_message_append_string_memfd(sd_bus_message\ *" "m" ", int\ " "memfd" ");" |
| 33 |
.HP \w'int\ sd_bus_message_append_string_iovec('u |
| 34 |
.BI "int sd_bus_message_append_string_iovec(sd_bus_message\ *" "m" ", const\ struct\ iovec\ *" "iov" ", unsigned\ " "n" ");" |
| 35 |
.HP \w'int\ sd_bus_message_append_string_space('u |
| 36 |
.BI "int sd_bus_message_append_string_space(sd_bus_message\ *" "m" ", size_t\ " "size" ", char\ **" "s" ");" |
| 37 |
.SH "DESCRIPTION" |
| 38 |
.PP |
| 39 |
The functions |
| 40 |
\fBsd_bus_message_append_string_memfd()\fR |
| 41 |
and |
| 42 |
\fBsd_bus_message_append_string_iovec()\fR |
| 43 |
can be used to append a single string (item of type |
| 44 |
"s") to message |
| 45 |
\fIm\fR\&. |
| 46 |
.PP |
| 47 |
In case of |
| 48 |
\fBsd_bus_message_append_string_memfd()\fR, the contents of |
| 49 |
\fImemfd\fR |
| 50 |
are the string\&. They must satisfy the same constraints as described for the |
| 51 |
"s" |
| 52 |
type in |
| 53 |
\fBsd_bus_message_append_basic\fR(3)\&. |
| 54 |
.PP |
| 55 |
In case of |
| 56 |
\fBsd_bus_message_append_string_iovec()\fR, the payload of |
| 57 |
\fIiov\fR |
| 58 |
is the string\&. It must satisfy the same constraints as described for the |
| 59 |
"s" |
| 60 |
type in |
| 61 |
\fBsd_bus_message_append_basic\fR(3)\&. |
| 62 |
.PP |
| 63 |
The |
| 64 |
\fIiov\fR |
| 65 |
argument must point to |
| 66 |
\fIn\fR |
| 67 |
struct iovec |
| 68 |
structures\&. Each structure may have the |
| 69 |
iov_base |
| 70 |
field set, in which case the memory pointed to will be copied into the message, or unset, in which case a block of spaces (ASCII 32) of length |
| 71 |
iov_len |
| 72 |
will be inserted\&. The memory pointed at by |
| 73 |
\fIiov\fR |
| 74 |
may be changed after this call\&. |
| 75 |
.PP |
| 76 |
The |
| 77 |
\fBsd_bus_message_append_string_space()\fR |
| 78 |
function appends space for a string to message |
| 79 |
\fIm\fR\&. It behaves similar to |
| 80 |
\fBsd_bus_message_append_basic()\fR |
| 81 |
with type |
| 82 |
"s", but instead of copying a string into the message, it returns a pointer to the destination area to the caller in pointer |
| 83 |
\fIp\fR\&. Space for the string of length |
| 84 |
\fIsize\fR |
| 85 |
plus the terminating |
| 86 |
\fBNUL\fR |
| 87 |
is allocated\&. |
| 88 |
.SH "RETURN VALUE" |
| 89 |
.PP |
| 90 |
On success, those calls return 0 or a positive integer\&. On failure, they return a negative errno\-style error code\&. |
| 91 |
.SS "Errors" |
| 92 |
.PP |
| 93 |
Returned errors may indicate the following problems: |
| 94 |
.PP |
| 95 |
\fB\-EINVAL\fR |
| 96 |
.RS 4 |
| 97 |
Specified parameter is invalid\&. |
| 98 |
.RE |
| 99 |
.PP |
| 100 |
\fB\-EPERM\fR |
| 101 |
.RS 4 |
| 102 |
Message has been sealed\&. |
| 103 |
.RE |
| 104 |
.PP |
| 105 |
\fB\-ESTALE\fR |
| 106 |
.RS 4 |
| 107 |
Message is in invalid state\&. |
| 108 |
.RE |
| 109 |
.PP |
| 110 |
\fB\-ENXIO\fR |
| 111 |
.RS 4 |
| 112 |
Message cannot be appended to\&. |
| 113 |
.RE |
| 114 |
.PP |
| 115 |
\fB\-ENOMEM\fR |
| 116 |
.RS 4 |
| 117 |
Memory allocation failed\&. |
| 118 |
.RE |
| 119 |
.SH "NOTES" |
| 120 |
.PP |
| 121 |
Functions described here are available as a shared library, which can be compiled against and linked to with the |
| 122 |
\fBlibsystemd\fR\ \&\fBpkg-config\fR(1) |
| 123 |
file\&. |
| 124 |
.PP |
| 125 |
The code described here uses |
| 126 |
\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 |
| 127 |
\fBsetenv\fR(3) |
| 128 |
from a parallel thread\&. It is recommended to only do calls to |
| 129 |
\fBsetenv()\fR |
| 130 |
from an early phase of the program when no other threads have been started\&. |
| 131 |
.SH "SEE ALSO" |
| 132 |
.PP |
| 133 |
\fBsystemd\fR(1), \fBsd-bus\fR(3), \fBsd_bus_message_append_basic\fR(3), \m[blue]\fBThe D\-Bus specification\fR\m[]\&\s-2\u[1]\d\s+2 |
| 134 |
.SH "NOTES" |
| 135 |
.IP " 1." 4 |
| 136 |
The D-Bus specification |
| 137 |
.RS 4 |
| 138 |
\%https://dbus.freedesktop.org/doc/dbus-specification.html |
| 139 |
.RE |