Путеводитель по Руководству Linux

  User  |  Syst  |  Libr  |  Device  |  Files  |  Other  |  Admin  |  Head  |



   sd_bus_message_read    ( 3 )

прочитать последовательность значений из сообщения (Read a sequence of values from a message)

  Name  |  Synopsis  |  Description  |  Return value  |  Note  |    Examples    |  See also  |

Примеры (Examples)

Read a single basic type (a 64-bit integer):

sd_bus_message *m; int64_t x;

sd_bus_message_read(m, "x", &x);

Read a boolean value:

sd_bus_message *m; int x; /* Do not use C99 'bool' type here, it's typically smaller in memory and would cause memory corruption */

sd_bus_message_read(m, "b", &x);

Read all types of integers:

uint8_t y; int16_t n; uint16_t q; int32_t i; uint32_t u; int32_t x; uint32_t t; double d;

sd_bus_message_read(m, "ynqiuxtd", &y, &n, &q, &i, &u, &x, &t, &d);

Read a structure composed of a string and a D-Bus path:

const char *s, *p;

sd_bus_message_read(m, "(so)", &s, &p);

Read a variant, with the real type "gt" (signature, unsigned integer):

const char *s; uint64_t *v;

sd_bus_message_read(m, "v", "gt", &s, &v);

Read a dictionary containing three pairs of type {integer=>string}:

int i, j, k; const char *s, *t, *u;

sd_bus_message_read(m, "a{is}", 3, &i, &s, &j, &t, &k, &u);

Read a single file descriptor, and duplicate it in order to keep it open after the message is freed.

sd_bus_message *m; int fd, fd_copy;

sd_bus_message_read(m, "h", &fd); fd_copy = fcntl(fd, FD_DUPFD_CLOEXEC, 3);