diff --git a/include/fcntl.h b/include/fcntl.h index fcb622a..b014662 100644 --- a/include/fcntl.h +++ b/include/fcntl.h @@ -9,6 +9,11 @@ extern "C" { #define __NEED_pid_t #define __NEED_mode_t +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +#define __NEED_size_t +#define __NEED_ssize_t +#endif + #include #include @@ -97,6 +102,7 @@ int posix_fallocate(int, off_t, off_t); #define F_TEST 3 int lockf(int, int, off_t); +ssize_t splice(int, off_t, int, off_t, size_t, unsigned int); #endif #if defined(_GNU_SOURCE) diff --git a/src/linux/splice.c b/src/linux/splice.c new file mode 100644 index 0000000..63e4593 --- /dev/null +++ b/src/linux/splice.c @@ -0,0 +1,9 @@ +#define _GNU_SOURCE +#include +#include +#include "syscall.h" + +ssize_t splice(int fd_in, off_t *off_in, int fd_out, off_t *off_out, size_t len, unsigned int flags) +{ + return syscall(SYS_splice, fd_in, off_in, fd_out, off_out, len, flags); +}