chiark / gitweb /
man: document that machinectl set-limit creates a btrfs loopback too
[elogind.git] / man / sd_bus_message_get_cookie.xml
1 <?xml version='1.0'?> <!--*-nxml-*-->
2 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
3   "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
4
5 <!--
6   This file is part of systemd.
7
8   Copyright 2013 Lennart Poettering
9
10   systemd is free software; you can redistribute it and/or modify it
11   under the terms of the GNU Lesser General Public License as published by
12   the Free Software Foundation; either version 2.1 of the License, or
13   (at your option) any later version.
14
15   systemd is distributed in the hope that it will be useful, but
16   WITHOUT ANY WARRANTY; without even the implied warranty of
17   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18   Lesser General Public License for more details.
19
20   You should have received a copy of the GNU Lesser General Public License
21   along with systemd; If not, see <http://www.gnu.org/licenses/>.
22 -->
23
24 <refentry id="sd_bus_message_get_cookie" conditional="ENABLE_KDBUS">
25
26   <refentryinfo>
27     <title>sd_bus_message_get_cookie</title>
28     <productname>systemd</productname>
29
30     <authorgroup>
31       <author>
32         <contrib>Developer</contrib>
33         <firstname>Lennart</firstname>
34         <surname>Poettering</surname>
35         <email>lennart@poettering.net</email>
36       </author>
37     </authorgroup>
38   </refentryinfo>
39
40   <refmeta>
41     <refentrytitle>sd_bus_message_get_cookie</refentrytitle>
42     <manvolnum>3</manvolnum>
43   </refmeta>
44
45   <refnamediv>
46     <refname>sd_bus_message_get_cookie</refname>
47     <refname>sd_bus_message_get_reply_cookie</refname>
48     <refpurpose>Returns the transaction cookie of a message</refpurpose>
49   </refnamediv>
50
51   <refsynopsisdiv>
52     <funcsynopsis>
53       <funcsynopsisinfo>#include &lt;systemd/sd-bus.h&gt;</funcsynopsisinfo>
54
55       <funcprototype>
56         <funcdef>int <function>sd_bus_message_get_cookie</function></funcdef>
57         <paramdef>sd_bus_message *<parameter>message</parameter></paramdef>
58         <paramdef>uint64_t *<parameter>cookie</parameter></paramdef>
59       </funcprototype>
60
61       <funcprototype>
62         <funcdef>int <function>sd_bus_message_get_reply_cookie</function></funcdef>
63         <paramdef>sd_bus_message *<parameter>message</parameter></paramdef>
64         <paramdef>uint64_t *<parameter>cookie</parameter></paramdef>
65       </funcprototype>
66     </funcsynopsis>
67   </refsynopsisdiv>
68
69   <refsect1>
70     <title>Description</title>
71
72     <para><function>sd_bus_message_get_cookie()</function> returns the
73     transaction cookie of a message. The cookie uniquely identifies a
74     message within each bus peer, but is not globally unique. It is
75     assigned when a message is sent.</para>
76
77     <para><function>sd_bus_message_get_reply_cookie()</function>
78     returns the transaction cookie of the message the specified
79     message is a response to. When a reply message is generated for a
80     method call message, its cookie is copied over into this field.
81     Note that while every message that is transferred is identified by
82     a cookie, only response messages carry a reply cookie
83     field.</para>
84
85     <para>Both functions take a message object as first parameter and
86     a place to store the 64-bit cookie in.</para>
87   </refsect1>
88
89   <refsect1>
90     <title>Return Value</title>
91
92     <para>On success, these calls return 0 or a positive integer. On
93     failure, these calls return a negative errno-style error
94     code.</para>
95
96     <para>On success, the cookie/reply cookie is returned in the
97     specified 64-bit unsigned integer variable.</para>
98   </refsect1>
99
100   <refsect1>
101     <title>Errors</title>
102
103     <para>Returned errors may indicate the following problems:</para>
104
105     <variablelist>
106       <varlistentry>
107         <term><constant>-EINVAL</constant></term>
108
109         <listitem><para>A specified parameter
110         is invalid.</para></listitem>
111       </varlistentry>
112
113       <varlistentry>
114         <term><constant>-ENODATA</constant></term>
115
116         <listitem><para>No cookie has been assigned to this message.
117         This either indicates that the message has not been sent yet
118         and hence has no cookie assigned, or that the message is not a
119         method response message and hence carries a reply cookie
120         field.</para></listitem>
121       </varlistentry>
122     </variablelist>
123   </refsect1>
124
125   <refsect1>
126     <title>Notes</title>
127
128     <para>The <function>sd_bus_message_get_cookie()</function> and
129     <function>sd_bus_message_get_reply_cookie()</function> interfaces
130     are available as a shared library, which can be compiled and
131     linked to with the
132     <constant>libsystemd</constant> <citerefentry project='die-net'><refentrytitle>pkg-config</refentrytitle><manvolnum>1</manvolnum></citerefentry>
133     file.</para>
134   </refsect1>
135
136   <refsect1>
137     <title>See Also</title>
138
139     <para>
140       <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
141       <citerefentry><refentrytitle>sd-bus</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
142       <citerefentry><refentrytitle>sd_bus_new</refentrytitle><manvolnum>3</manvolnum></citerefentry>
143     </para>
144   </refsect1>
145
146 </refentry>