summaryrefslogtreecommitdiff
path: root/src/libsystemd/sd-bus/test-bus-zero-copy.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libsystemd/sd-bus/test-bus-zero-copy.c')
-rw-r--r--src/libsystemd/sd-bus/test-bus-zero-copy.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/libsystemd/sd-bus/test-bus-zero-copy.c b/src/libsystemd/sd-bus/test-bus-zero-copy.c
index 2cc671b16d..a054f74bf3 100644
--- a/src/libsystemd/sd-bus/test-bus-zero-copy.c
+++ b/src/libsystemd/sd-bus/test-bus-zero-copy.c
@@ -48,6 +48,7 @@ int main(int argc, char *argv[]) {
uint32_t u32;
size_t i, l;
char *s;
+ _cleanup_close_ int sfd = -1;
log_set_max_level(LOG_DEBUG);
@@ -107,7 +108,7 @@ int main(int argc, char *argv[]) {
assert_se(r >= 0);
assert_se(sz == STRING_SIZE);
- r = sd_bus_message_append_string_memfd(m, f);
+ r = sd_bus_message_append_string_memfd(m, f, 0, (uint64_t) -1);
assert_se(r >= 0);
close(f);
@@ -124,7 +125,7 @@ int main(int argc, char *argv[]) {
assert_se(r >= 0);
assert_se(sz == SECOND_ARRAY);
- r = sd_bus_message_append_array_memfd(m, 'y', f);
+ r = sd_bus_message_append_array_memfd(m, 'y', f, 0, (uint64_t) -1);
assert_se(r >= 0);
close(f);
@@ -135,6 +136,11 @@ int main(int argc, char *argv[]) {
r = sd_bus_message_append(m, "u", 4711);
assert_se(r >= 0);
+ assert_se((sfd = memfd_new_and_map(NULL, 6, (void**) &p)) >= 0);
+ memcpy(p, "abcd\0", 6);
+ munmap(p, 6);
+ assert_se(sd_bus_message_append_string_memfd(m, sfd, 1, 4) >= 0);
+
r = bus_message_seal(m, 55, 99*USEC_PER_SEC);
assert_se(r >= 0);
@@ -188,6 +194,10 @@ int main(int argc, char *argv[]) {
assert_se(r > 0);
assert_se(u32 == 4711);
+ r = sd_bus_message_read(m, "s", &s);
+ assert_se(r > 0);
+ assert_se(streq_ptr(s, "bcd"));
+
sd_bus_message_unref(m);
sd_bus_unref(a);