summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2020-03-02 09:53:38 -0700
committerJens Axboe <axboe@kernel.dk>2020-03-02 09:53:38 -0700
commit417017d6a1110c3d51cd8ec5c70b88ad92a3b3ce (patch)
tree4b5543a9f257f93816e25b7a4a4eb8abe84300f5
parent5eef453c1e1da637835f35e835c12e0c1c62cbb4 (diff)
downloadliburing-417017d6a1110c3d51cd8ec5c70b88ad92a3b3ce.tar.gz
liburing-417017d6a1110c3d51cd8ec5c70b88ad92a3b3ce.tar.bz2
test/splice: don't use memfd
The previous include is not enough, some older distros don't have the memfd_create() in libc. Just get rid of it and open a regular file instead. Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r--test/splice.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/test/splice.c b/test/splice.c
index 43b5427..b7ef537 100644
--- a/test/splice.c
+++ b/test/splice.c
@@ -5,7 +5,6 @@
#include <string.h>
#include <fcntl.h>
#include <sys/mman.h>
-#include <linux/memfd.h>
#include "liburing.h"
@@ -80,7 +79,7 @@ static int test_splice(struct io_uring *ring)
fd_in = open("/dev/urandom", O_RDONLY);
if (fd_in < 0)
goto exit;
- fd_out = memfd_create("splice_test_out_file", 0);
+ fd_out = open(".splice_fd_out", O_CREAT | O_WRONLY, 0644);
if (fd_out < 0)
goto exit;
if (ftruncate(fd_out, len) == -1)
@@ -119,8 +118,10 @@ static int test_splice(struct io_uring *ring)
ret = 0;
exit:
- if (fd_out >= 0)
+ if (fd_out >= 0) {
+ unlink(".splice_fd_out");
close(fd_out);
+ }
if (fd_in >= 0)
close(fd_in);
if (pipe_fds[0] >= 0) {