2014-11-21 22:44:48 +03:00
<?xml version='1.0'?> <!-- * - Mode: nxml; nxml - child - indent: 2; indent - tabs - mode: nil - * -->
2014-03-07 08:24:20 +04:00
< !DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
2015-06-18 20:47:44 +03:00
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
2014-03-07 08:24:20 +04:00
<!--
2017-11-18 19:22:32 +03:00
SPDX-License-Identifier: LGPL-2.1+
2015-02-11 07:19:26 +03:00
This file is part of systemd.
2014-03-07 08:24:20 +04:00
2015-02-11 07:19:26 +03:00
Copyright 2014 Zbigniew Jędrzejewski-Szmek
2014-03-07 08:24:20 +04:00
-->
2015-06-17 13:32:33 +03:00
<refentry id= "sd_bus_message_append_basic" >
2014-03-07 08:24:20 +04:00
<refentryinfo >
<title > sd_bus_message_append_basic</title>
<productname > systemd</productname>
<authorgroup >
<author >
<contrib > A monkey with a typewriter</contrib>
<firstname > Zbigniew</firstname>
<surname > Jędrzejewski-Szmek</surname>
<email > zbyszek@in.waw.pl</email>
</author>
</authorgroup>
</refentryinfo>
<refmeta >
<refentrytitle > sd_bus_message_append_basic</refentrytitle>
<manvolnum > 3</manvolnum>
</refmeta>
<refnamediv >
<refname > sd_bus_message_append_basic</refname>
2015-07-07 21:35:45 +03:00
<refpurpose > Attach a single field to a message</refpurpose>
2014-03-07 08:24:20 +04:00
</refnamediv>
<refsynopsisdiv >
<funcsynopsis >
<funcsynopsisinfo > #include < systemd/sd-bus.h> </funcsynopsisinfo>
<funcprototype >
<funcdef > int sd_bus_message_append_basic</funcdef>
<paramdef > sd_bus_message *<parameter > m</parameter> </paramdef>
<paramdef > char <parameter > type</parameter> </paramdef>
2015-07-07 21:35:45 +03:00
<paramdef > const void *<parameter > p</parameter> </paramdef>
2014-03-07 08:24:20 +04:00
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
<refsect1 >
<title > Description</title>
2015-07-07 21:35:45 +03:00
<para > <function > sd_bus_message_append_basic()</function> appends a
single field to the message <parameter > m</parameter> . The
parameter <parameter > type</parameter> determines how the pointer
2014-03-07 08:24:20 +04:00
<parameter > p</parameter> is interpreted.
2015-07-07 21:35:45 +03:00
<parameter > type</parameter> must be one of the basic types as
defined by the <ulink
url="http://dbus.freedesktop.org/doc/dbus-specification.html#basic-types">Basic
Types</ulink> section of the D-Bus specification, and listed in
the table below.
2014-03-07 08:24:20 +04:00
</para>
<table id= 'format-specifiers' >
2015-07-07 21:35:45 +03:00
<title > Item type specifiers</title>
2014-03-07 08:24:20 +04:00
2015-07-07 21:35:45 +03:00
<tgroup cols= '5' >
2014-03-07 08:24:20 +04:00
<colspec colname= 'specifier' />
<colspec colname= 'constant' />
<colspec colname= 'description' />
<colspec colname= 'size' />
2015-07-07 21:35:45 +03:00
<colspec colname= 'ctype' />
2014-03-07 08:24:20 +04:00
<thead >
<row >
<entry > Specifier</entry>
<entry > Constant</entry>
<entry > Description</entry>
<entry > Size</entry>
2015-07-07 21:35:45 +03:00
<entry > Expected C Type</entry>
2014-03-07 08:24:20 +04:00
</row>
</thead>
<tbody >
<row >
<entry > <literal > y</literal> </entry>
<entry > <constant > SD_BUS_TYPE_BYTE</constant> </entry>
2014-08-30 19:13:16 +04:00
<entry > unsigned integer</entry>
2014-03-07 08:24:20 +04:00
<entry > 1 byte</entry>
2015-07-07 21:35:45 +03:00
<entry > uint8_t</entry>
2014-03-07 08:24:20 +04:00
</row>
<row >
<entry > <literal > b</literal> </entry>
<entry > <constant > SD_BUS_TYPE_BOOLEAN</constant> </entry>
<entry > boolean</entry>
<entry > 4 bytes</entry>
2015-07-07 21:35:45 +03:00
<entry > int</entry>
2014-03-07 08:24:20 +04:00
</row>
<row >
<entry > <literal > n</literal> </entry>
<entry > <constant > SD_BUS_TYPE_INT16</constant> </entry>
<entry > signed integer</entry>
<entry > 2 bytes</entry>
2015-07-07 21:35:45 +03:00
<entry > int16_t</entry>
2014-03-07 08:24:20 +04:00
</row>
<row >
<entry > <literal > q</literal> </entry>
<entry > <constant > SD_BUS_TYPE_UINT16</constant> </entry>
<entry > unsigned integer</entry>
<entry > 2 bytes</entry>
2015-07-07 21:35:45 +03:00
<entry > uint16_t</entry>
2014-03-07 08:24:20 +04:00
</row>
<row >
<entry > <literal > i</literal> </entry>
<entry > <constant > SD_BUS_TYPE_INT32</constant> </entry>
<entry > signed integer</entry>
<entry > 4 bytes</entry>
2015-07-07 21:35:45 +03:00
<entry > int32_t</entry>
2014-03-07 08:24:20 +04:00
</row>
<row >
<entry > <literal > u</literal> </entry>
<entry > <constant > SD_BUS_TYPE_UINT32</constant> </entry>
<entry > unsigned integer</entry>
<entry > 4 bytes</entry>
2015-07-07 21:35:45 +03:00
<entry > uint32_t</entry>
2014-03-07 08:24:20 +04:00
</row>
<row >
<entry > <literal > x</literal> </entry>
<entry > <constant > SD_BUS_TYPE_INT64</constant> </entry>
<entry > signed integer</entry>
<entry > 8 bytes</entry>
2015-07-07 21:35:45 +03:00
<entry > int64_t</entry>
2014-03-07 08:24:20 +04:00
</row>
<row >
<entry > <literal > t</literal> </entry>
<entry > <constant > SD_BUS_TYPE_UINT64</constant> </entry>
<entry > unsigned integer</entry>
<entry > 8 bytes</entry>
2015-07-07 21:35:45 +03:00
<entry > uint64_t</entry>
2014-03-07 08:24:20 +04:00
</row>
<row >
<entry > <literal > d</literal> </entry>
<entry > <constant > SD_BUS_TYPE_DOUBLE</constant> </entry>
<entry > floating-point</entry>
<entry > 8 bytes</entry>
2015-07-07 21:35:45 +03:00
<entry > double</entry>
2014-03-07 08:24:20 +04:00
</row>
<row >
<entry > <literal > s</literal> </entry>
<entry > <constant > SD_BUS_TYPE_STRING</constant> </entry>
<entry > Unicode string</entry>
<entry > variable</entry>
2015-07-07 21:35:45 +03:00
<entry > char[]</entry>
2014-03-07 08:24:20 +04:00
</row>
<row >
<entry > <literal > o</literal> </entry>
<entry > <constant > SD_BUS_TYPE_OBJECT_PATH</constant> </entry>
<entry > object path</entry>
<entry > variable</entry>
2015-07-07 21:35:45 +03:00
<entry > char[]</entry>
2014-03-07 08:24:20 +04:00
</row>
<row >
<entry > <literal > g</literal> </entry>
<entry > <constant > SD_BUS_TYPE_SIGNATURE</constant> </entry>
<entry > signature</entry>
<entry > variable</entry>
2015-07-07 21:35:45 +03:00
<entry > char[]</entry>
2014-03-07 08:24:20 +04:00
</row>
<row >
<entry > <literal > h</literal> </entry>
<entry > <constant > SD_BUS_TYPE_UNIX_FD</constant> </entry>
<entry > UNIX file descriptor</entry>
<entry > 4 bytes</entry>
2015-07-07 21:35:45 +03:00
<entry > int</entry>
2014-03-07 08:24:20 +04:00
</row>
</tbody>
</tgroup>
</table>
2015-07-07 21:35:45 +03:00
<para > The value of the parameter is copied into a memory area held
by the message object, stays in the possession of the caller and
may hence be freely changed after this call without affecting the
bus message it has been added to. If <parameter > type</parameter>
is <literal > h</literal> (UNIX file descriptor), the descriptor is
duplicated by this call and the passed descriptor stays in
possession of the caller.</para>
2014-03-07 08:24:20 +04:00
<para > For types <literal > s</literal> , <literal > o</literal> , and
<literal > g</literal> , the parameter <parameter > p</parameter> is
interpreted as a pointer to a <constant > NUL</constant> -terminated
character sequence. As a special case, a <constant > NULL</constant>
pointer is interpreted as an empty string. The string should be
valid Unicode string encoded as UTF-8. In case of the two latter
2014-05-08 03:28:45 +04:00
types, the additional requirements for a D-Bus object path or
2014-03-07 08:24:20 +04:00
type signature should be satisfied. Those requirements should be
2014-08-30 19:13:16 +04:00
verified by the recipient of the message.
2014-03-07 08:24:20 +04:00
</para>
</refsect1>
<refsect1 >
<title > Return Value</title>
<para > On success, this call returns 0 or a positive integer. On
failure, it returns a negative errno-style error code.</para>
</refsect1>
<refsect1 id= 'errors' >
<title > Errors</title>
<para > Returned errors may indicate the following problems:</para>
<variablelist >
<varlistentry >
2014-09-26 01:27:46 +04:00
<term > <constant > -EINVAL</constant> </term>
2014-03-07 08:24:20 +04:00
<listitem > <para > Specified parameter is invalid.
</para> </listitem>
</varlistentry>
<varlistentry >
2014-09-26 01:27:46 +04:00
<term > <constant > -EPERM</constant> </term>
2014-03-07 08:24:20 +04:00
<listitem > <para > Message has been sealed.
</para> </listitem>
</varlistentry>
<varlistentry >
2014-09-26 01:27:46 +04:00
<term > <constant > -ESTALE</constant> </term>
2014-03-07 08:24:20 +04:00
<listitem > <para > Message is in invalid state.
</para> </listitem>
</varlistentry>
<varlistentry >
2014-09-26 01:27:46 +04:00
<term > <constant > -ENXIO</constant> </term>
2014-03-07 08:24:20 +04:00
<listitem > <para > Message cannot be appended to.
</para> </listitem>
</varlistentry>
<varlistentry >
2014-09-26 01:27:46 +04:00
<term > <constant > -ENOMEM</constant> </term>
2014-03-07 08:24:20 +04:00
<listitem > <para > Memory allocation failed.</para> </listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 >
<title > Notes</title>
2014-05-08 03:28:45 +04:00
<para > The <function > sd_bus_append_basic()</function> function
2014-03-07 08:24:20 +04:00
described here is available as a shared library, which can be
compiled and linked to with the
man: add a mapping for external manpages
It is annoying when we have dead links on fd.o.
Add project='man-pages|die-net|archlinux' to <citerefentry>-ies.
In generated html, add external links to
http://man7.org/linux/man-pages/man, http://linux.die.net/man/,
https://www.archlinux.org/.
By default, pages in sections 2 and 4 go to man7, since Michael
Kerrisk is the autorative source on kernel related stuff.
The rest of links goes to linux.die.net, because they have the
manpages.
Except for the pacman stuff, since it seems to be only available from
archlinux.org.
Poor gummiboot gets no link, because gummitboot(8) ain't to be found
on the net. According to common wisdom, that would mean that it does
not exist. But I have seen Kay using it, so I know it does, and
deserves to be found. Can somebody be nice and put it up somewhere?
2014-07-08 02:25:54 +04:00
<constant > libsystemd</constant> <citerefentry project= 'die-net' > <refentrytitle > pkg-config</refentrytitle> <manvolnum > 1</manvolnum> </citerefentry>
2014-03-07 08:24:20 +04:00
file.</para>
</refsect1>
<refsect1 >
<title > See Also</title>
<para >
<citerefentry > <refentrytitle > systemd</refentrytitle> <manvolnum > 1</manvolnum> </citerefentry> ,
<citerefentry > <refentrytitle > sd-bus</refentrytitle> <manvolnum > 3</manvolnum> </citerefentry> ,
<citerefentry > <refentrytitle > sd_bus_message_append</refentrytitle> <manvolnum > 3</manvolnum> </citerefentry> ,
<ulink url= "http://dbus.freedesktop.org/doc/dbus-specification.html" > The D-Bus specification</ulink>
</para>
</refsect1>
</refentry>