summaryrefslogtreecommitdiff
path: root/src/libsystemd/sd-bus/test-bus-zero-copy.c
diff options
context:
space:
mode:
authorDaniel Mack <zonque@gmail.com>2014-08-18 13:28:43 +0200
committerDaniel Mack <zonque@gmail.com>2014-08-18 13:32:08 +0200
commitfac9c0d508f72cc5d469c969a4acc3694247c03b (patch)
treede438cd330880b7b99771780dc82deaecf3f03f6 /src/libsystemd/sd-bus/test-bus-zero-copy.c
parent8a02decaf1e81bad3c06752e998734c96ab11260 (diff)
memfd: internalize functions, drop sd_memfd type
Remove the sd_ prefix from internal functions and get rid of the sd_memfd type. As a memfd is now just a native file descriptor, we can get rid of our own wrapper type, and also use close() and dup() on them directly.
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, 7 insertions, 7 deletions
diff --git a/src/libsystemd/sd-bus/test-bus-zero-copy.c b/src/libsystemd/sd-bus/test-bus-zero-copy.c
index e4a87ab3c5..1d279e6032 100644
--- a/src/libsystemd/sd-bus/test-bus-zero-copy.c
+++ b/src/libsystemd/sd-bus/test-bus-zero-copy.c
@@ -43,7 +43,7 @@ int main(int argc, char *argv[]) {
sd_bus *a, *b;
int r, bus_ref;
sd_bus_message *m;
- sd_memfd *f;
+ int f;
uint64_t sz;
uint32_t u32;
size_t i, l;
@@ -93,7 +93,7 @@ int main(int argc, char *argv[]) {
memset(p+1, 'L', FIRST_ARRAY-2);
p[FIRST_ARRAY-1] = '>';
- r = sd_memfd_new_and_map(&f, NULL, STRING_SIZE, (void**) &s);
+ r = memfd_new_and_map(&f, NULL, STRING_SIZE, (void**) &s);
assert_se(r >= 0);
s[0] = '<';
@@ -103,16 +103,16 @@ int main(int argc, char *argv[]) {
s[STRING_SIZE-1] = 0;
munmap(s, STRING_SIZE);
- r = sd_memfd_get_size(f, &sz);
+ r = memfd_get_size(f, &sz);
assert_se(r >= 0);
assert_se(sz == STRING_SIZE);
r = sd_bus_message_append_string_memfd(m, f);
assert_se(r >= 0);
- sd_memfd_free(f);
+ close(f);
- r = sd_memfd_new_and_map(&f, NULL, SECOND_ARRAY, (void**) &p);
+ r = memfd_new_and_map(&f, NULL, SECOND_ARRAY, (void**) &p);
assert_se(r >= 0);
p[0] = '<';
@@ -120,14 +120,14 @@ int main(int argc, char *argv[]) {
p[SECOND_ARRAY-1] = '>';
munmap(p, SECOND_ARRAY);
- r = sd_memfd_get_size(f, &sz);
+ r = memfd_get_size(f, &sz);
assert_se(r >= 0);
assert_se(sz == SECOND_ARRAY);
r = sd_bus_message_append_array_memfd(m, 'y', f);
assert_se(r >= 0);
- sd_memfd_free(f);
+ close(f);
r = sd_bus_message_close_container(m);
assert_se(r >= 0);