From: Zbigniew Jędrzejewski-Szmek Date: Tue, 15 Mar 2016 23:26:30 +0000 (-0400) Subject: basic/missing: add copy_file_range X-Git-Tag: v231.3~215 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=commitdiff_plain;h=a538528904a7daf5418e38bbafce68a894fe2922 basic/missing: add copy_file_range syscall numbers based on: https://fedora.juszkiewicz.com.pl/syscalls.html --- diff --git a/src/basic/missing.h b/src/basic/missing.h index 1be35eb94..bf685ffe6 100644 --- a/src/basic/missing.h +++ b/src/basic/missing.h @@ -1190,3 +1190,33 @@ static inline key_serial_t request_key(const char *type, const char *description #endif #endif + +#ifndef __NR_copy_file_range +# if defined(__x86_64__) +# define __NR_copy_file_range 326 +# elif defined(__i386__) +# define __NR_copy_file_range 377 +# elif defined __s390__ +# define __NR_copy_file_range 375 +# elif defined __arm__ +# define __NR_copy_file_range 391 +# elif defined __aarch64__ +# define __NR_copy_file_range 285 +# else +# warning "__NR_copy_file_range not defined for your architecture" +# endif +#endif + +#if !HAVE_DECL_COPY_FILE_RANGE +static inline ssize_t copy_file_range(int fd_in, loff_t *off_in, + int fd_out, loff_t *off_out, + size_t len, + unsigned int flags) { +#ifdef __NR_copy_file_range + return syscall(__NR_copy_file_range, fd_in, off_in, fd_out, off_out, len, flags); +#else + errno = ENOSYS; + return -1; +#endif +} +#endif