| 1 |
'\" t |
| 2 |
.TH "SD_BUS_MESSAGE_GET_COOKIE" "3" "" "systemd 261~rc3" "sd_bus_message_get_cookie" |
| 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_get_cookie, sd_bus_message_get_reply_cookie \- Returns the transaction cookie of 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_get_cookie('u |
| 32 |
.BI "int sd_bus_message_get_cookie(sd_bus_message\ *" "message" ", uint64_t\ *" "cookie" ");" |
| 33 |
.HP \w'int\ sd_bus_message_get_reply_cookie('u |
| 34 |
.BI "int sd_bus_message_get_reply_cookie(sd_bus_message\ *" "message" ", uint64_t\ *" "cookie" ");" |
| 35 |
.SH "DESCRIPTION" |
| 36 |
.PP |
| 37 |
\fBsd_bus_message_get_cookie()\fR |
| 38 |
returns the transaction cookie of a message\&. The cookie uniquely identifies a message within each bus peer, but is not globally unique\&. It is assigned when a message is sent\&. |
| 39 |
.PP |
| 40 |
\fBsd_bus_message_get_reply_cookie()\fR |
| 41 |
returns the transaction cookie of the message the specified message is a response to\&. When a reply message is generated for a method call message, its cookie is copied over into this field\&. Note that while every message that is transferred is identified by a cookie, only response messages carry a reply cookie field\&. |
| 42 |
.PP |
| 43 |
Both functions take a message object as first parameter and a place to store the 64\-bit cookie in\&. |
| 44 |
.SH "RETURN VALUE" |
| 45 |
.PP |
| 46 |
On success, these calls return 0 or a positive integer\&. On failure, they return a negative errno\-style error code\&. |
| 47 |
.PP |
| 48 |
On success, the cookie/reply cookie is returned in the specified 64\-bit unsigned integer variable\&. |
| 49 |
.SS "Errors" |
| 50 |
.PP |
| 51 |
Returned errors may indicate the following problems: |
| 52 |
.PP |
| 53 |
\fB\-EINVAL\fR |
| 54 |
.RS 4 |
| 55 |
A specified parameter is invalid\&. |
| 56 |
.RE |
| 57 |
.PP |
| 58 |
\fB\-ENODATA\fR |
| 59 |
.RS 4 |
| 60 |
No cookie has been assigned to this message\&. This either indicates that the message has not been sent yet and hence has no cookie assigned, or that the message is not a method response message and hence carries a reply cookie field\&. |
| 61 |
.RE |
| 62 |
.SH "NOTES" |
| 63 |
.PP |
| 64 |
Functions described here are available as a shared library, which can be compiled against and linked to with the |
| 65 |
\fBlibsystemd\fR\ \&\fBpkg-config\fR(1) |
| 66 |
file\&. |
| 67 |
.PP |
| 68 |
The code described here uses |
| 69 |
\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 |
| 70 |
\fBsetenv\fR(3) |
| 71 |
from a parallel thread\&. It is recommended to only do calls to |
| 72 |
\fBsetenv()\fR |
| 73 |
from an early phase of the program when no other threads have been started\&. |
| 74 |
.SH "HISTORY" |
| 75 |
.PP |
| 76 |
\fBsd_bus_message_get_cookie()\fR |
| 77 |
and |
| 78 |
\fBsd_bus_message_get_reply_cookie()\fR |
| 79 |
were added in version 209\&. |
| 80 |
.SH "SEE ALSO" |
| 81 |
.PP |
| 82 |
\fBsystemd\fR(1), \fBsd-bus\fR(3), \fBsd_bus_new\fR(3) |