chiark / gitweb /
check for _POSIX_C_SOURCE instead of __USE_POSIX*
[elogind.git] / man / sd_bus_message_append_basic.xml
index da92020053cbe0f60019309c301d537facae6e17..90abca8092f463d7e96f4ff534385cf1767de3e0 100644 (file)
@@ -1,27 +1,27 @@
-<?xml version='1.0'?> <!--*-nxml-*-->
+<?xml version='1.0'?> <!--*- Mode: nxml; nxml-child-indent: 2; indent-tabs-mode: nil -*-->
 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
 
 <!--
-This file is part of systemd.
+  This file is part of systemd.
 
-Copyright 2014 Zbigniew Jędrzejewski-Szmek
+  Copyright 2014 Zbigniew Jędrzejewski-Szmek
 
-systemd is free software; you can redistribute it and/or modify it
-under the terms of the GNU Lesser General Public License as published by
-the Free Software Foundation; either version 2.1 of the License, or
-(at your option) any later version.
+  systemd is free software; you can redistribute it and/or modify it
+  under the terms of the GNU Lesser General Public License as published by
+  the Free Software Foundation; either version 2.1 of the License, or
+  (at your option) any later version.
 
-systemd is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
+  systemd is distributed in the hope that it will be useful, but
+  WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+  Lesser General Public License for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with systemd; If not, see <http://www.gnu.org/licenses/>.
+  You should have received a copy of the GNU Lesser General Public License
+  along with systemd; If not, see <http://www.gnu.org/licenses/>.
 -->
 
-<refentry id="sd_bus_message_append_basic" conditional="ENABLE_KDBUS">
+<refentry id="sd_bus_message_append_basic">
 
   <refentryinfo>
     <title>sd_bus_message_append_basic</title>
@@ -45,7 +45,7 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>.
   <refnamediv>
     <refname>sd_bus_message_append_basic</refname>
 
-    <refpurpose>Attach a single part to a message</refpurpose>
+    <refpurpose>Attach a single field to a message</refpurpose>
   </refnamediv>
 
   <refsynopsisdiv>
@@ -56,7 +56,7 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>.
         <funcdef>int sd_bus_message_append_basic</funcdef>
         <paramdef>sd_bus_message *<parameter>m</parameter></paramdef>
         <paramdef>char <parameter>type</parameter></paramdef>
-        <paramdef>char void *<parameter>p</parameter></paramdef>
+        <paramdef>const void *<parameter>p</parameter></paramdef>
       </funcprototype>
     </funcsynopsis>
   </refsynopsisdiv>
@@ -64,39 +64,42 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>.
   <refsect1>
     <title>Description</title>
 
-    <para><function>sd_bus_message_append_basic</function> appends a
-    single item to the message <parameter>m</parameter>. Parameter
-    <parameter>type</parameter> determines how pointer
+    <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
     <parameter>p</parameter> is interpreted.
-    <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.
+    <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.
     </para>
 
     <table id='format-specifiers'>
-      <title>Item format specifiers</title>
+      <title>Item type specifiers</title>
 
-      <tgroup cols='4'>
+      <tgroup cols='5'>
         <colspec colname='specifier' />
         <colspec colname='constant' />
         <colspec colname='description' />
         <colspec colname='size' />
+        <colspec colname='ctype' />
         <thead>
           <row>
             <entry>Specifier</entry>
             <entry>Constant</entry>
             <entry>Description</entry>
             <entry>Size</entry>
+            <entry>Expected C Type</entry>
           </row>
         </thead>
         <tbody>
           <row>
             <entry><literal>y</literal></entry>
             <entry><constant>SD_BUS_TYPE_BYTE</constant></entry>
-            <entry>unsigned interger</entry>
+            <entry>unsigned integer</entry>
             <entry>1 byte</entry>
+            <entry>uint8_t</entry>
           </row>
 
           <row>
@@ -104,6 +107,7 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>.
             <entry><constant>SD_BUS_TYPE_BOOLEAN</constant></entry>
             <entry>boolean</entry>
             <entry>4 bytes</entry>
+            <entry>int</entry>
           </row>
 
           <row>
@@ -111,6 +115,7 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>.
             <entry><constant>SD_BUS_TYPE_INT16</constant></entry>
             <entry>signed integer</entry>
             <entry>2 bytes</entry>
+            <entry>int16_t</entry>
           </row>
 
           <row>
@@ -118,6 +123,7 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>.
             <entry><constant>SD_BUS_TYPE_UINT16</constant></entry>
             <entry>unsigned integer</entry>
             <entry>2 bytes</entry>
+            <entry>uint16_t</entry>
           </row>
 
           <row>
@@ -125,6 +131,7 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>.
             <entry><constant>SD_BUS_TYPE_INT32</constant></entry>
             <entry>signed integer</entry>
             <entry>4 bytes</entry>
+            <entry>int32_t</entry>
           </row>
 
           <row>
@@ -132,6 +139,7 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>.
             <entry><constant>SD_BUS_TYPE_UINT32</constant></entry>
             <entry>unsigned integer</entry>
             <entry>4 bytes</entry>
+            <entry>uint32_t</entry>
           </row>
 
           <row>
@@ -139,6 +147,7 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>.
             <entry><constant>SD_BUS_TYPE_INT64</constant></entry>
             <entry>signed integer</entry>
             <entry>8 bytes</entry>
+            <entry>int64_t</entry>
           </row>
 
           <row>
@@ -146,6 +155,7 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>.
             <entry><constant>SD_BUS_TYPE_UINT64</constant></entry>
             <entry>unsigned integer</entry>
             <entry>8 bytes</entry>
+            <entry>uint64_t</entry>
           </row>
 
           <row>
@@ -153,6 +163,7 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>.
             <entry><constant>SD_BUS_TYPE_DOUBLE</constant></entry>
             <entry>floating-point</entry>
             <entry>8 bytes</entry>
+            <entry>double</entry>
           </row>
 
           <row>
@@ -160,6 +171,7 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>.
             <entry><constant>SD_BUS_TYPE_STRING</constant></entry>
             <entry>Unicode string</entry>
             <entry>variable</entry>
+            <entry>char[]</entry>
           </row>
 
           <row>
@@ -167,6 +179,7 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>.
             <entry><constant>SD_BUS_TYPE_OBJECT_PATH</constant></entry>
             <entry>object path</entry>
             <entry>variable</entry>
+            <entry>char[]</entry>
           </row>
 
           <row>
@@ -174,6 +187,7 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>.
             <entry><constant>SD_BUS_TYPE_SIGNATURE</constant></entry>
             <entry>signature</entry>
             <entry>variable</entry>
+            <entry>char[]</entry>
           </row>
 
           <row>
@@ -181,16 +195,19 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>.
             <entry><constant>SD_BUS_TYPE_UNIX_FD</constant></entry>
             <entry>UNIX file descriptor</entry>
             <entry>4 bytes</entry>
+            <entry>int</entry>
           </row>
        </tbody>
       </tgroup>
     </table>
 
-    <para>The value of the parameter is copied into the memory area
-    containing the message and may be changed after this call. If
-    <parameter>type</parameter> is <literal>h</literal> (UNIX file
-    descriptor), it is always "consumed" by this call, and either
-    successfully appended to the message or closed.</para>
+    <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>
 
     <para>For types <literal>s</literal>, <literal>o</literal>, and
     <literal>g</literal>, the parameter <parameter>p</parameter> is
@@ -200,7 +217,7 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>.
     valid Unicode string encoded as UTF-8. In case of the two latter
     types, the additional requirements for a D-Bus object path or
     type signature should be satisfied. Those requirements should be
-    verified by the recepient of the message.
+    verified by the recipient of the message.
     </para>
   </refsect1>
 
@@ -219,35 +236,35 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>.
     <variablelist>
 
       <varlistentry>
-        <term><varname>-EINVAL</varname></term>
+        <term><constant>-EINVAL</constant></term>
 
         <listitem><para>Specified parameter is invalid.
         </para></listitem>
       </varlistentry>
 
       <varlistentry>
-        <term><varname>-EPERM</varname></term>
+        <term><constant>-EPERM</constant></term>
 
         <listitem><para>Message has been sealed.
         </para></listitem>
       </varlistentry>
 
       <varlistentry>
-        <term><varname>-ESTALE</varname></term>
+        <term><constant>-ESTALE</constant></term>
 
         <listitem><para>Message is in invalid state.
         </para></listitem>
       </varlistentry>
 
       <varlistentry>
-        <term><varname>-ENXIO</varname></term>
+        <term><constant>-ENXIO</constant></term>
 
         <listitem><para>Message cannot be appended to.
         </para></listitem>
       </varlistentry>
 
       <varlistentry>
-        <term><varname>-ENOMEM</varname></term>
+        <term><constant>-ENOMEM</constant></term>
 
         <listitem><para>Memory allocation failed.</para></listitem>
       </varlistentry>
@@ -260,7 +277,7 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>.
     <para>The <function>sd_bus_append_basic()</function> function
     described here is available as a shared library, which can be
     compiled and linked to with the
-    <constant>libsystemd</constant> <citerefentry project='die-net'><refentrytitle>pkg-config</refentrytitle><manvolnum>1</manvolnum></citerefentry>
+    <constant>libelogind</constant> <citerefentry project='die-net'><refentrytitle>pkg-config</refentrytitle><manvolnum>1</manvolnum></citerefentry>
     file.</para>
   </refsect1>