summaryrefslogtreecommitdiff
path: root/src/libsystemd
diff options
context:
space:
mode:
Diffstat (limited to 'src/libsystemd')
-rw-r--r--src/libsystemd/sd-bus/bus-message.c20
-rw-r--r--src/libsystemd/sd-bus/test-bus-zero-copy.c14
2 files changed, 17 insertions, 17 deletions
diff --git a/src/libsystemd/sd-bus/bus-message.c b/src/libsystemd/sd-bus/bus-message.c
index 79dc471d41..3e60842172 100644
--- a/src/libsystemd/sd-bus/bus-message.c
+++ b/src/libsystemd/sd-bus/bus-message.c
@@ -2527,7 +2527,7 @@ _public_ int sd_bus_message_append_array_iovec(
_public_ int sd_bus_message_append_array_memfd(sd_bus_message *m,
char type,
- sd_memfd *memfd) {
+ int memfd) {
_cleanup_close_ int copy_fd = -1;
struct bus_body_part *part;
ssize_t align, sz;
@@ -2537,7 +2537,7 @@ _public_ int sd_bus_message_append_array_memfd(sd_bus_message *m,
if (!m)
return -EINVAL;
- if (!memfd)
+ if (memfd < 0)
return -EINVAL;
if (m->sealed)
return -EPERM;
@@ -2546,15 +2546,15 @@ _public_ int sd_bus_message_append_array_memfd(sd_bus_message *m,
if (m->poisoned)
return -ESTALE;
- r = sd_memfd_set_sealed(memfd);
+ r = memfd_set_sealed(memfd);
if (r < 0)
return r;
- copy_fd = sd_memfd_dup_fd(memfd);
+ copy_fd = dup(memfd);
if (copy_fd < 0)
return copy_fd;
- r = sd_memfd_get_size(memfd, &size);
+ r = memfd_get_size(memfd, &size);
if (r < 0)
return r;
@@ -2593,7 +2593,7 @@ _public_ int sd_bus_message_append_array_memfd(sd_bus_message *m,
return sd_bus_message_close_container(m);
}
-_public_ int sd_bus_message_append_string_memfd(sd_bus_message *m, sd_memfd *memfd) {
+_public_ int sd_bus_message_append_string_memfd(sd_bus_message *m, int memfd) {
_cleanup_close_ int copy_fd = -1;
struct bus_body_part *part;
struct bus_container *c;
@@ -2602,19 +2602,19 @@ _public_ int sd_bus_message_append_string_memfd(sd_bus_message *m, sd_memfd *mem
int r;
assert_return(m, -EINVAL);
- assert_return(memfd, -EINVAL);
+ assert_return(memfd >= 0, -EINVAL);
assert_return(!m->sealed, -EPERM);
assert_return(!m->poisoned, -ESTALE);
- r = sd_memfd_set_sealed(memfd);
+ r = memfd_set_sealed(memfd);
if (r < 0)
return r;
- copy_fd = sd_memfd_dup_fd(memfd);
+ copy_fd = dup(memfd);
if (copy_fd < 0)
return copy_fd;
- r = sd_memfd_get_size(memfd, &size);
+ r = memfd_get_size(memfd, &size);
if (r < 0)
return r;
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);