The branch, master has been updated via 4354823c514 libreplace: properly execute SYS_copy_file_range check via 22a58a51846 libreplace: properly give headers to conf.CHECK_CODE when checking for copy_file_range_syscall from 45a33b25c4e s3/rpc_server: track the number of policy handles with a talloc destructor
https://git.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit 4354823c5146753ef8a3791bc8562379096659b8 Author: Ralph Boehme <s...@samba.org> Date: Sat Aug 7 17:18:25 2021 +0200 libreplace: properly execute SYS_copy_file_range check It seems some systems (like Centos 7) have the SYS_copy_file_range define but fail the syscall when actually being called. The current configure check is only compiled, not run so erroneously reports a working SYS_copy_file_range. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14786 RN: Insufficient libreplace check for SYS_copy_file_range check Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> Autobuild-User(master): Jeremy Allison <j...@samba.org> Autobuild-Date(master): Tue Aug 10 19:37:14 UTC 2021 on sn-devel-184 commit 22a58a51846749495613e5b572c31ba4752bc61b Author: Ralph Boehme <s...@samba.org> Date: Sat Aug 7 17:18:08 2021 +0200 libreplace: properly give headers to conf.CHECK_CODE when checking for copy_file_range_syscall BUG: https://bugzilla.samba.org/show_bug.cgi?id=14786 Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> ----------------------------------------------------------------------- Summary of changes: lib/replace/wscript | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) Changeset truncated at 500 lines: diff --git a/lib/replace/wscript b/lib/replace/wscript index 12f995f3198..9c23d549dab 100644 --- a/lib/replace/wscript +++ b/lib/replace/wscript @@ -456,11 +456,32 @@ def configure(conf): conf.CHECK_FUNCS('getprogname') if not conf.CHECK_FUNCS('copy_file_range'): conf.CHECK_CODE(''' -#include <sys/syscall.h> -#include <unistd.h> -syscall(SYS_copy_file_range,0,NULL,0,NULL,0,0); + int src_fd = -1, dst_fd = -1, ret; + ssize_t written; + char src[]="/tmp/test.XXXXXX"; + char dst[]="/tmp/test.XXXXXX"; + src_fd = mkstemp(src); + if (src_fd == -1) {ret = 1; goto cleanup;} + dst_fd = mkstemp(dst); + if (dst_fd == -1) {ret = 2; goto cleanup;} + written = pwrite(src_fd, "x", 1, 0); + if (written != 1) {ret = 3; goto cleanup;} + written = syscall(SYS_copy_file_range,src_fd,0,dst_fd,0,1,0); + if (written != 1) { + printf("SYS_copy_file_range failed: %s", strerror(errno)); + ret = 4; goto cleanup; + } + ret = 0; + cleanup: + if (src_fd != -1) close(src_fd); + if (dst_fd != -1) close(dst_fd); + unlink(src); + unlink(dst); + return ret; ''', 'HAVE_SYSCALL_COPY_FILE_RANGE', + headers='errno.h string.h stdio.h sys/syscall.h unistd.h sys/types.h sys/stat.h fcntl.h', + execute=True, msg='Checking whether we have copy_file_range system call') if conf.CONFIG_SET('HAVE_COPY_FILE_RANGE') or conf.CONFIG_SET('HAVE_SYSCALL_COPY_FILE_RANGE'): conf.DEFINE('USE_COPY_FILE_RANGE', 1) -- Samba Shared Repository