From patchwork Fri May 12 17:58:02 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [01/13] posix: Consolidate Linux pause syscall X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 99712 Message-Id: <1494611894-9282-1-git-send-email-adhemerval.zanella@linaro.org> To: libc-alpha@sourceware.org Date: Fri, 12 May 2017 14:58:02 -0300 From: Adhemerval Zanella List-Id: This patch consolidates the pause Linux implementation on sysdeps/unix/sysv/linux/pause.c. If defined the pause syscall (__NR_pause) will be used, other ppoll with 0 arguments will be used instead. It has the small advantage of generic pause implementation with uses rt_sigprocmask plus rt_sigsuspend because it requires only one syscall and the pause is done atomically regarding signal handling (for instance, pause may not be interrupted if the signal arrives between the rt_sigprocmask and rt_sigsuspend syscall). Checked on i686-linux-gnu, x86_64-linux-gnu, x86_64-linux-gnux32, arch64-linux-gnu, arm-linux-gnueabihf, powerpc64le-linux-gnu, sparc64-linux-gnu, and sparcv9-linux-gnu. * sysdeps/unix/sysv/linux/generic/pause.c: Remove file. * sysdeps/unix/sysv/linux/sparc/sparc64/pause.c: Likewise. * sysdeps/unix/sysv/linux/sparc/kernel-features.h [__arch64__] (__NR_pause): Undefine. * sysdeps/unix/sysv/linux/pause.c: New file. * sysdeps/unix/sysv/linux/syscalls.list: Remove pause from auto-generation list. --- ChangeLog | 10 ++++++++++ sysdeps/unix/sysv/linux/{generic => }/pause.c | 18 +++++++----------- sysdeps/unix/sysv/linux/sparc/kernel-features.h | 6 ++++++ sysdeps/unix/sysv/linux/sparc/sparc64/pause.c | 9 --------- sysdeps/unix/sysv/linux/syscalls.list | 1 - 5 files changed, 23 insertions(+), 21 deletions(-) rename sysdeps/unix/sysv/linux/{generic => }/pause.c (75%) delete mode 100644 sysdeps/unix/sysv/linux/sparc/sparc64/pause.c -- 2.7.4 diff --git a/sysdeps/unix/sysv/linux/generic/pause.c b/sysdeps/unix/sysv/linux/pause.c similarity index 75% rename from sysdeps/unix/sysv/linux/generic/pause.c rename to sysdeps/unix/sysv/linux/pause.c index a8b3e33..c6b252a 100644 --- a/sysdeps/unix/sysv/linux/generic/pause.c +++ b/sysdeps/unix/sysv/linux/pause.c @@ -1,6 +1,6 @@ -/* Copyright (C) 2011-2017 Free Software Foundation, Inc. +/* Linux pause syscall implementation. + Copyright (C) 2017 Free Software Foundation, Inc. This file is part of the GNU C Library. - Contributed by Chris Metcalf , 2011. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -26,14 +26,10 @@ int __libc_pause (void) { - sigset_t set; - - int rc = - SYSCALL_CANCEL (rt_sigprocmask, SIG_BLOCK, NULL, &set, _NSIG / 8); - if (rc == 0) - rc = SYSCALL_CANCEL (rt_sigsuspend, &set, _NSIG / 8); - - return rc; +#ifdef __NR_pause + return SYSCALL_CANCEL (pause); +#else + return SYSCALL_CANCEL (ppoll, 0, 0, 0, 0, 0); +#endif } - weak_alias (__libc_pause, pause) diff --git a/sysdeps/unix/sysv/linux/sparc/kernel-features.h b/sysdeps/unix/sysv/linux/sparc/kernel-features.h index 72065a0..dd9108b 100644 --- a/sysdeps/unix/sysv/linux/sparc/kernel-features.h +++ b/sysdeps/unix/sysv/linux/sparc/kernel-features.h @@ -32,6 +32,12 @@ # undef __ASSUME_ACCEPT_SYSCALL # undef __ASSUME_CONNECT_SYSCALL # undef __ASSUME_RECVFROM_SYSCALL +#else +/* sparc64 defines __NR_pause, however it is not supported (ENOSYS). + Undefine so pause.c can use a correct alternative. */ +# ifdef __NR_pause +# undef __NR_pause +# endif #endif /* sparc only supports ipc syscall. */ diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/pause.c b/sysdeps/unix/sysv/linux/sparc/sparc64/pause.c deleted file mode 100644 index e399e7c..0000000 --- a/sysdeps/unix/sysv/linux/sparc/sparc64/pause.c +++ /dev/null @@ -1,9 +0,0 @@ -#include -#include -#include -#include - -#define __sigprocmask(how, set, oset) \ - INLINE_SYSCALL (rt_sigprocmask, 4, how, set, oset, _NSIG / 8) - -#include diff --git a/sysdeps/unix/sysv/linux/syscalls.list b/sysdeps/unix/sysv/linux/syscalls.list index f4abf3e..eab30dd 100644 --- a/sysdeps/unix/sysv/linux/syscalls.list +++ b/sysdeps/unix/sysv/linux/syscalls.list @@ -44,7 +44,6 @@ munlock - munlock i:ai munlock munlockall - munlockall i: munlockall nanosleep - nanosleep Ci:pp __nanosleep nanosleep nfsservctl EXTRA nfsservctl i:ipp nfsservctl -pause - pause Ci: __libc_pause pause pipe - pipe i:f __pipe pipe pipe2 - pipe2 i:fi __pipe2 pipe2 pivot_root EXTRA pivot_root i:ss pivot_root From patchwork Fri May 12 17:58:03 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [02/13] posix: Consolidate Linux waitpid syscall X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 99714 Message-Id: <1494611894-9282-2-git-send-email-adhemerval.zanella@linaro.org> To: libc-alpha@sourceware.org Date: Fri, 12 May 2017 14:58:03 -0300 From: Adhemerval Zanella List-Id: This patch consolidates the waitpid Linux syscall generation on sysdeps/unix/sysv/linux/waitpid.c. It basically removes it from architecture auto-generation list and also remove arch specific implementations. Checked on i686-linux-gnu, x86_64-linux-gnu, x86_64-linux-gnux32, arch64-linux-gnu, arm-linux-gnueabihf, and powerpc64le-linux-gnu. * sysdeps/unix/sysv/linux/sh/syscalls.list: Remove waitpid from auto-generated list. * sysdeps/unix/sysv/linux/m68k/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/i386/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/sparc/syscalls.list: Remove file. * sysdeps/unix/sysv/linux/tile/waitpid.S: Likewise. * sysdeps/unix/sysv/linux/powerpc/syscalls.list: Likewise. --- ChangeLog | 8 ++++++++ sysdeps/unix/sysv/linux/i386/syscalls.list | 1 - sysdeps/unix/sysv/linux/m68k/syscalls.list | 1 - sysdeps/unix/sysv/linux/powerpc/syscalls.list | 3 --- sysdeps/unix/sysv/linux/sh/syscalls.list | 2 -- sysdeps/unix/sysv/linux/sparc/syscalls.list | 3 --- sysdeps/unix/sysv/linux/tile/waitpid.S | 18 ------------------ 7 files changed, 8 insertions(+), 28 deletions(-) delete mode 100644 sysdeps/unix/sysv/linux/powerpc/syscalls.list delete mode 100644 sysdeps/unix/sysv/linux/sparc/syscalls.list delete mode 100644 sysdeps/unix/sysv/linux/tile/waitpid.S -- 2.7.4 diff --git a/sysdeps/unix/sysv/linux/i386/syscalls.list b/sysdeps/unix/sysv/linux/i386/syscalls.list index 145393f..58020df 100644 --- a/sysdeps/unix/sysv/linux/i386/syscalls.list +++ b/sysdeps/unix/sysv/linux/i386/syscalls.list @@ -18,7 +18,6 @@ setfsuid - setfsuid32 Ei:i setfsuid modify_ldt EXTRA modify_ldt i:ipi __modify_ldt modify_ldt vm86old EXTRA vm86old i:p __vm86old vm86@GLIBC_2.0 vm86 - vm86 i:ip __vm86 vm86@@GLIBC_2.3.4 -waitpid - waitpid Ci:ipi __waitpid waitpid prlimit64 EXTRA prlimit64 i:iipp prlimit64 diff --git a/sysdeps/unix/sysv/linux/m68k/syscalls.list b/sysdeps/unix/sysv/linux/m68k/syscalls.list index 4260f3e..55a377b 100644 --- a/sysdeps/unix/sysv/linux/m68k/syscalls.list +++ b/sysdeps/unix/sysv/linux/m68k/syscalls.list @@ -3,7 +3,6 @@ chown - chown32 i:sii __chown chown lchown - lchown32 i:sii __lchown lchown fchown - fchown32 i:iii __fchown fchown -waitpid - waitpid Ci:ipi __waitpid waitpid getegid - getegid32 Ei: __getegid getegid geteuid - geteuid32 Ei: __geteuid geteuid diff --git a/sysdeps/unix/sysv/linux/powerpc/syscalls.list b/sysdeps/unix/sysv/linux/powerpc/syscalls.list deleted file mode 100644 index 4f821e9..0000000 --- a/sysdeps/unix/sysv/linux/powerpc/syscalls.list +++ /dev/null @@ -1,3 +0,0 @@ -# File name Caller Syscall name # args Strong name Weak names - -waitpid - waitpid Ci:ipi __waitpid waitpid diff --git a/sysdeps/unix/sysv/linux/sh/syscalls.list b/sysdeps/unix/sysv/linux/sh/syscalls.list index 169d40f..32badd1 100644 --- a/sysdeps/unix/sysv/linux/sh/syscalls.list +++ b/sysdeps/unix/sysv/linux/sh/syscalls.list @@ -15,8 +15,6 @@ getgroups - getgroups32 i:ip __getgroups getgroups setfsgid - setfsgid32 Ei:i setfsgid setfsuid - setfsuid32 Ei:i setfsuid -waitpid - waitpid Ci:ipi __waitpid waitpid - prlimit64 EXTRA prlimit64 i:iipp prlimit64 fanotify_mark EXTRA fanotify_mark i:iiiiis __fanotify_mark fanotify_mark@@GLIBC_2.16 diff --git a/sysdeps/unix/sysv/linux/sparc/syscalls.list b/sysdeps/unix/sysv/linux/sparc/syscalls.list deleted file mode 100644 index 4f821e9..0000000 --- a/sysdeps/unix/sysv/linux/sparc/syscalls.list +++ /dev/null @@ -1,3 +0,0 @@ -# File name Caller Syscall name # args Strong name Weak names - -waitpid - waitpid Ci:ipi __waitpid waitpid diff --git a/sysdeps/unix/sysv/linux/tile/waitpid.S b/sysdeps/unix/sysv/linux/tile/waitpid.S deleted file mode 100644 index dee1b0c..0000000 --- a/sysdeps/unix/sysv/linux/tile/waitpid.S +++ /dev/null @@ -1,18 +0,0 @@ -/* -extern pid_t __waitpid_nocancel (pid_t, int *, int) attribute_hidden; -*/ -#if IS_IN (libc) || IS_IN (libpthread) || IS_IN (librt) - -/* Call __NR_wait4, providing fourth argument (struct rusage *) as NULL. */ -#define PSEUDO_EXTRA move r3, zero; -#include - -PSEUDO (__waitpid, wait4, 3) -ret -PSEUDO_END(__waitpid) - -libc_hidden_def (__waitpid) -weak_alias (__waitpid, waitpid) -libc_hidden_weak (waitpid) - -#endif From patchwork Fri May 12 17:58:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [03/13] posix: Consolidate Linux nanosleep syscall X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 99715 Message-Id: <1494611894-9282-3-git-send-email-adhemerval.zanella@linaro.org> To: libc-alpha@sourceware.org Date: Fri, 12 May 2017 14:58:04 -0300 From: Adhemerval Zanella List-Id: This patch consolidates the nanosleep Linux syscall generation on sysdeps/unix/sysv/linux/nanosleep.c. It basically removes it from architectures auto-generation list. Checked on i686-linux-gnu, x86_64-linux-gnu, x86_64-linux-gnux32, arch64-linux-gnu, arm-linux-gnueabihf, powerpc64le-linux-gnu, sparc64-linux-gnu, and sparcv9-linux-gnu. * nptl/Makefile (CFLAGS-nanosleep.c): New rule. * posix/Makefile (CFLAGS-nanosleep.c): Likewise. * sysdeps/unix/sysv/linux/nanosleep.c: New file. * sysdeps/unix/sysv/linux/syscalls.list: Remove nanosleep from auto-generated list. --- ChangeLog | 6 ++++++ nptl/Makefile | 1 + posix/Makefile | 1 + sysdeps/unix/sysv/linux/nanosleep.c | 30 ++++++++++++++++++++++++++++++ sysdeps/unix/sysv/linux/syscalls.list | 1 - 5 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 sysdeps/unix/sysv/linux/nanosleep.c -- 2.7.4 diff --git a/nptl/Makefile b/nptl/Makefile index d39bb50..cdf69bd 100644 --- a/nptl/Makefile +++ b/nptl/Makefile @@ -216,6 +216,7 @@ CFLAGS-sendmsg.c = -fexceptions -fasynchronous-unwind-tables CFLAGS-close.c = -fexceptions -fasynchronous-unwind-tables CFLAGS-read.c = -fexceptions -fasynchronous-unwind-tables CFLAGS-write.c = -fexceptions -fasynchronous-unwind-tables +CFLAGS-nanosleep.c = -fexceptions -fasynchronous-unwind-tables CFLAGS-pt-system.c = -fexceptions diff --git a/posix/Makefile b/posix/Makefile index 0025d8a..9f186cd 100644 --- a/posix/Makefile +++ b/posix/Makefile @@ -232,6 +232,7 @@ CFLAGS-execle.os = -fomit-frame-pointer CFLAGS-execl.os = -fomit-frame-pointer CFLAGS-execvp.os = -fomit-frame-pointer CFLAGS-execlp.os = -fomit-frame-pointer +CFLAGS-nanosleep.c = -fexceptions tstgetopt-ARGS = -a -b -cfoobar --required foobar --optional=bazbug \ --none random --col --color --colour diff --git a/sysdeps/unix/sysv/linux/nanosleep.c b/sysdeps/unix/sysv/linux/nanosleep.c new file mode 100644 index 0000000..b352f84 --- /dev/null +++ b/sysdeps/unix/sysv/linux/nanosleep.c @@ -0,0 +1,30 @@ +/* Linux high resolution nanosleep implementation. + Copyright (C) 2017 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include +#include + +/* Pause execution for a number of nanoseconds. */ +int +__nanosleep (const struct timespec *requested_time, + struct timespec *remaining) +{ + return SYSCALL_CANCEL (nanosleep, requested_time, remaining); +} +libc_hidden_def (__nanosleep) +weak_alias (__nanosleep, nanosleep) diff --git a/sysdeps/unix/sysv/linux/syscalls.list b/sysdeps/unix/sysv/linux/syscalls.list index eab30dd..7fca6f8 100644 --- a/sysdeps/unix/sysv/linux/syscalls.list +++ b/sysdeps/unix/sysv/linux/syscalls.list @@ -42,7 +42,6 @@ mount EXTRA mount i:sssip __mount mount mremap EXTRA mremap b:ainip __mremap mremap munlock - munlock i:ai munlock munlockall - munlockall i: munlockall -nanosleep - nanosleep Ci:pp __nanosleep nanosleep nfsservctl EXTRA nfsservctl i:ipp nfsservctl pipe - pipe i:f __pipe pipe pipe2 - pipe2 i:fi __pipe2 pipe2 From patchwork Fri May 12 17:58:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [04/13] linux: Consolidate Linux tee implementation X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 99713 Message-Id: <1494611894-9282-4-git-send-email-adhemerval.zanella@linaro.org> To: libc-alpha@sourceware.org Date: Fri, 12 May 2017 14:58:05 -0300 From: Adhemerval Zanella List-Id: This patch consolidates the tee Linux syscall generation on sysdeps/unix/sysv/linux/tee.c. It basically removes it from architectures auto-generation list. Checked on i686-linux-gnu, x86_64-linux-gnu, x86_64-linux-gnux32, arch64-linux-gnu, arm-linux-gnueabihf, powerpc64le-linux-gnu, sparc64-linux-gnu, and sparcv9-linux-gnu. * sysdeps/unix/sysv/linux/Makefile (sysdeps_routines): Add tee. * sysdeps/unix/sysv/linux/syscalls.list: Remove tee from auto-generated list. * sysdeps/unix/sysv/linux/tee.c: New file. --- ChangeLog | 5 +++++ sysdeps/unix/sysv/linux/Makefile | 2 +- sysdeps/unix/sysv/linux/syscalls.list | 1 - sysdeps/unix/sysv/linux/tee.c | 26 ++++++++++++++++++++++++++ 4 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 sysdeps/unix/sysv/linux/tee.c -- 2.7.4 diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile index ad477f5..acdd04c 100644 --- a/sysdeps/unix/sysv/linux/Makefile +++ b/sysdeps/unix/sysv/linux/Makefile @@ -17,7 +17,7 @@ include $(firstword $(wildcard $(sysdirs:=/sysctl.mk))) sysdep_routines += clone umount umount2 readahead \ setfsuid setfsgid epoll_pwait signalfd \ eventfd eventfd_read eventfd_write prlimit \ - personality epoll_wait + personality epoll_wait tee CFLAGS-gethostid.c = -fexceptions CFLAGS-tst-writev.c += "-DARTIFICIAL_LIMIT=(0x80000000-sysconf(_SC_PAGESIZE))" diff --git a/sysdeps/unix/sysv/linux/syscalls.list b/sysdeps/unix/sysv/linux/syscalls.list index 7fca6f8..ae99acd 100644 --- a/sysdeps/unix/sysv/linux/syscalls.list +++ b/sysdeps/unix/sysv/linux/syscalls.list @@ -70,7 +70,6 @@ stime - stime i:p stime sysinfo EXTRA sysinfo i:p __sysinfo sysinfo swapon - swapon i:si __swapon swapon swapoff - swapoff i:s __swapoff swapoff -tee EXTRA tee Ci:iiii tee unshare EXTRA unshare i:i unshare uselib EXTRA uselib i:s __compat_uselib uselib@GLIBC_2.0:GLIBC_2.23 utime - utime i:sP utime diff --git a/sysdeps/unix/sysv/linux/tee.c b/sysdeps/unix/sysv/linux/tee.c new file mode 100644 index 0000000..3d503fb --- /dev/null +++ b/sysdeps/unix/sysv/linux/tee.c @@ -0,0 +1,26 @@ +/* Linux duplicating pipe content implementation. + Copyright (C) 2017 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include +#include + +ssize_t +tee (int src, int dest, size_t len, unsigned int flags) +{ + return SYSCALL_CANCEL (tee, src, dest, len, flags); +} From patchwork Fri May 12 17:58:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [05/13] posix: Consolidate Linux sigsuspend implementation X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 99716 Message-Id: <1494611894-9282-5-git-send-email-adhemerval.zanella@linaro.org> To: libc-alpha@sourceware.org Date: Fri, 12 May 2017 14:58:06 -0300 From: Adhemerval Zanella List-Id: This patch consolidates the sigsuspend Linux syscall generation on sysdeps/unix/sysv/linux/sigsuspend.c. It basically removes the alpha assembly version which call the old sigsusped interface using only the first doubleword from sigset. Current minimum supported kernel on alpha (3.2) enforces rt_sigsuspend on the architecture (__ARCH_WANT_SYS_RT_SIGSUSPEND option on kernel), so it is possible to use the default implementation. Checked on i686-linux-gnu, x86_64-linux-gnu, x86_64-linux-gnux32, arch64-linux-gnu, arm-linux-gnueabihf, powerpc64le-linux-gnu, sparc64-linux-gnu, and sparcv9-linux-gnu. * sysdeps/unix/sysv/linux/alpha/sigsuspend.S: Remove file. * sysdeps/unix/sysv/linux/sigsuspend.c: Simplify include list. --- ChangeLog | 3 +++ sysdeps/unix/sysv/linux/alpha/sigsuspend.S | 32 ------------------------------ sysdeps/unix/sysv/linux/sigsuspend.c | 4 ---- 3 files changed, 3 insertions(+), 36 deletions(-) delete mode 100644 sysdeps/unix/sysv/linux/alpha/sigsuspend.S -- 2.7.4 diff --git a/sysdeps/unix/sysv/linux/alpha/sigsuspend.S b/sysdeps/unix/sysv/linux/alpha/sigsuspend.S deleted file mode 100644 index c226be1..0000000 --- a/sysdeps/unix/sysv/linux/alpha/sigsuspend.S +++ /dev/null @@ -1,32 +0,0 @@ -/* Copyright (C) 1993-2017 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by David Mosberger , 1995. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library. If not, see - . */ - -/* sigsuspend is a special syscall since it needs to dereference the - sigset. This will have to change when we have more than 64 signals. */ - -#include - -#undef PSEUDO_PREPARE_ARGS -#define PSEUDO_PREPARE_ARGS ldq a0, 0(a0); - -PSEUDO(__sigsuspend, sigsuspend, 1) - ret -PSEUDO_END(__sigsuspend) -libc_hidden_def (__sigsuspend) -weak_alias (__sigsuspend, sigsuspend) -strong_alias (__sigsuspend, __libc_sigsuspend) diff --git a/sysdeps/unix/sysv/linux/sigsuspend.c b/sysdeps/unix/sysv/linux/sigsuspend.c index 8bb0cd4..df29abf 100644 --- a/sysdeps/unix/sysv/linux/sigsuspend.c +++ b/sysdeps/unix/sysv/linux/sigsuspend.c @@ -15,12 +15,8 @@ License along with the GNU C Library; if not, see . */ -#include #include -#include - #include -#include /* Change the set of blocked signals to SET, wait until a signal arrives, and restore the set of blocked signals. */ From patchwork Fri May 12 17:58:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [06/13] posix: Consolidate Linux msync syscall X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 99717 Message-Id: <1494611894-9282-6-git-send-email-adhemerval.zanella@linaro.org> To: libc-alpha@sourceware.org Date: Fri, 12 May 2017 14:58:07 -0300 From: Adhemerval Zanella List-Id: This patch consolidates the msync Linux syscall generation on sysdeps/unix/sysv/linux/msync.c. It basically removes it from architectures auto-generation list. Checked on i686-linux-gnu, x86_64-linux-gnu, x86_64-linux-gnux32, arch64-linux-gnu, arm-linux-gnueabihf, powerpc64le-linux-gnu, sparc64-linux-gnu, and sparcv9-linux-gnu. * misc/Makefile (CFLAGS-msync.c): New rule. * nptl/Makefile (CFLAGS-msync.c): Likewise. * sysdeps/unix/syscalls.list: Remove msync from auto-generation list. * sysdeps/unix/sysv/linux/msync.c: New file. --- ChangeLog | 5 +++++ misc/Makefile | 1 + nptl/Makefile | 1 + sysdeps/unix/syscalls.list | 1 - sysdeps/unix/sysv/linux/msync.c | 26 ++++++++++++++++++++++++++ 5 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 sysdeps/unix/sysv/linux/msync.c -- 2.7.4 diff --git a/misc/Makefile b/misc/Makefile index 91e425b..8536255 100644 --- a/misc/Makefile +++ b/misc/Makefile @@ -108,6 +108,7 @@ CFLAGS-getsysstats.c = -fexceptions CFLAGS-getusershell.c = -fexceptions CFLAGS-err.c = -fexceptions CFLAGS-tst-tsearch.c = $(stack-align-test-flags) +CFLAGS-msync.c = -fexceptions # Called during static library initialization, so turn stack-protection # off for non-shared builds. diff --git a/nptl/Makefile b/nptl/Makefile index cdf69bd..875ab3d 100644 --- a/nptl/Makefile +++ b/nptl/Makefile @@ -217,6 +217,7 @@ CFLAGS-close.c = -fexceptions -fasynchronous-unwind-tables CFLAGS-read.c = -fexceptions -fasynchronous-unwind-tables CFLAGS-write.c = -fexceptions -fasynchronous-unwind-tables CFLAGS-nanosleep.c = -fexceptions -fasynchronous-unwind-tables +CFLAGS-msync.c = -fexceptions -fasynchronous-unwind-tables CFLAGS-pt-system.c = -fexceptions diff --git a/sysdeps/unix/syscalls.list b/sysdeps/unix/syscalls.list index 2254c76..c4135d8 100644 --- a/sysdeps/unix/syscalls.list +++ b/sysdeps/unix/syscalls.list @@ -45,7 +45,6 @@ madvise - madvise i:pii __madvise madvise mkdir - mkdir i:si __mkdir mkdir mmap - mmap b:aniiii __mmap mmap mprotect - mprotect i:aii __mprotect mprotect -msync - msync Ci:aii __libc_msync msync munmap - munmap i:ai __munmap munmap open - open Ci:siv __libc_open __open open profil - profil i:piii __profil profil diff --git a/sysdeps/unix/sysv/linux/msync.c b/sysdeps/unix/sysv/linux/msync.c new file mode 100644 index 0000000..28aba11 --- /dev/null +++ b/sysdeps/unix/sysv/linux/msync.c @@ -0,0 +1,26 @@ +/* Linux synchronize a file with a memory map implementation. + Copyright (C) 2017 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include +#include + +int +msync (void *addr, size_t length, int flags) +{ + return SYSCALL_CANCEL (msync, addr, length, flags); +} From patchwork Fri May 12 17:58:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [07/13] posix: Consolidate Linux fdatasync syscall X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 99718 Message-Id: <1494611894-9282-7-git-send-email-adhemerval.zanella@linaro.org> To: libc-alpha@sourceware.org Date: Fri, 12 May 2017 14:58:08 -0300 From: Adhemerval Zanella List-Id: This patch consolidates the fdatasync Linux syscall generation on sysdeps/unix/sysv/linux/fdatasync.c. It basically removes it from architectures auto-generation list. Checked on i686-linux-gnu, x86_64-linux-gnu, x86_64-linux-gnux32, arch64-linux-gnu, arm-linux-gnueabihf, powerpc64le-linux-gnu, sparc64-linux-gnu, and sparcv9-linux-gnu. * misc/makefile (CFLAGS-datasync.c): New flag. * nptl/makefile (CFLAGS-datasync.c): Likewise. * sysdeps/unix/sysv/linux/syscalls.list (fdatasync): Remove from auto-generation syscall list. * sysdeps/unix/sysv/linux/fdatasync.c: New file. --- ChangeLog | 6 ++++++ misc/Makefile | 1 + nptl/Makefile | 1 + sysdeps/unix/sysv/linux/fdatasync.c | 29 +++++++++++++++++++++++++++++ sysdeps/unix/sysv/linux/syscalls.list | 1 - 5 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 sysdeps/unix/sysv/linux/fdatasync.c -- 2.7.4 diff --git a/misc/Makefile b/misc/Makefile index 8536255..2f1ddef 100644 --- a/misc/Makefile +++ b/misc/Makefile @@ -109,6 +109,7 @@ CFLAGS-getusershell.c = -fexceptions CFLAGS-err.c = -fexceptions CFLAGS-tst-tsearch.c = $(stack-align-test-flags) CFLAGS-msync.c = -fexceptions +CFLAGS-fdatasync.c = -fexceptions # Called during static library initialization, so turn stack-protection # off for non-shared builds. diff --git a/nptl/Makefile b/nptl/Makefile index 875ab3d..879efbb 100644 --- a/nptl/Makefile +++ b/nptl/Makefile @@ -218,6 +218,7 @@ CFLAGS-read.c = -fexceptions -fasynchronous-unwind-tables CFLAGS-write.c = -fexceptions -fasynchronous-unwind-tables CFLAGS-nanosleep.c = -fexceptions -fasynchronous-unwind-tables CFLAGS-msync.c = -fexceptions -fasynchronous-unwind-tables +CFLAGS-fdatasync.c = -fexceptions -fasynchronous-unwind-tables CFLAGS-pt-system.c = -fexceptions diff --git a/sysdeps/unix/sysv/linux/fdatasync.c b/sysdeps/unix/sysv/linux/fdatasync.c new file mode 100644 index 0000000..09a07fb --- /dev/null +++ b/sysdeps/unix/sysv/linux/fdatasync.c @@ -0,0 +1,29 @@ +/* Synchronize a file's in-core state with storage device Linux + implementation. + Copyright (C) 2017 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include +#include + +/* Synchronize at least the data part of a file with the underlying + media. */ +int +fdatasync (int fd) +{ + return SYSCALL_CANCEL (fdatasync, fd); +} diff --git a/sysdeps/unix/sysv/linux/syscalls.list b/sysdeps/unix/sysv/linux/syscalls.list index ae99acd..c69eff4 100644 --- a/sysdeps/unix/sysv/linux/syscalls.list +++ b/sysdeps/unix/sysv/linux/syscalls.list @@ -13,7 +13,6 @@ epoll_create1 EXTRA epoll_create1 i:i epoll_create1 epoll_ctl EXTRA epoll_ctl i:iiip epoll_ctl eventfd EXTRA eventfd2 i:ii eventfd execve - execve i:spp __execve execve -fdatasync - fdatasync Ci:i fdatasync flock - flock i:ii __flock flock get_kernel_syms EXTRA get_kernel_syms i:p __compat_get_kernel_syms get_kernel_syms@GLIBC_2.0:GLIBC_2.23 getpid - getpid Ei: __getpid getpid From patchwork Fri May 12 17:58:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [08/13] posix: Consolidate Linux fsync syscall X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 99719 Message-Id: <1494611894-9282-8-git-send-email-adhemerval.zanella@linaro.org> To: libc-alpha@sourceware.org Date: Fri, 12 May 2017 14:58:09 -0300 From: Adhemerval Zanella List-Id: This patch consolidates the fsync Linux syscall generation on sysdeps/unix/sysv/linux/fsync.c. It basically removes it from architectures auto-generation list. For arm it also removes the __errno_location call since fsync is not called with SYSCALL_CANCEL with call arch-specific INLINE_SYSCALL macro which in turn will call __set_errno macro (and setting errno directly). Checked on i686-linux-gnu, x86_64-linux-gnu, x86_64-linux-gnux32, arch64-linux-gnu, arm-linux-gnueabihf, powerpc64le-linux-gnu, sparc64-linux-gnu, and sparcv9-linux-gnu. * misc/Makefile (CFLAGS-fsync.c): New flag. * nptl/Makefile (CFLAGS-fsync.c): Likewise. * sysdeps/unix/syscalls.list (fsync): Remove from auto-generation syscall list. * sysdeps/unix/sysv/linux/fsync.c: New file. * sysdeps/unix/sysv/linux/arm/localplt.data [libpthread.so] (__errno_location): Remove. --- ChangeLog | 8 ++++++++ misc/Makefile | 1 + nptl/Makefile | 1 + sysdeps/unix/syscalls.list | 1 - sysdeps/unix/sysv/linux/arm/localplt.data | 1 - sysdeps/unix/sysv/linux/fsync.c | 28 ++++++++++++++++++++++++++++ 6 files changed, 38 insertions(+), 2 deletions(-) create mode 100644 sysdeps/unix/sysv/linux/fsync.c -- 2.7.4 diff --git a/misc/Makefile b/misc/Makefile index 2f1ddef..d58ff5c 100644 --- a/misc/Makefile +++ b/misc/Makefile @@ -110,6 +110,7 @@ CFLAGS-err.c = -fexceptions CFLAGS-tst-tsearch.c = $(stack-align-test-flags) CFLAGS-msync.c = -fexceptions CFLAGS-fdatasync.c = -fexceptions +CFLAGS-fsync.c = -fexceptions # Called during static library initialization, so turn stack-protection # off for non-shared builds. diff --git a/nptl/Makefile b/nptl/Makefile index 879efbb..9eedce2 100644 --- a/nptl/Makefile +++ b/nptl/Makefile @@ -219,6 +219,7 @@ CFLAGS-write.c = -fexceptions -fasynchronous-unwind-tables CFLAGS-nanosleep.c = -fexceptions -fasynchronous-unwind-tables CFLAGS-msync.c = -fexceptions -fasynchronous-unwind-tables CFLAGS-fdatasync.c = -fexceptions -fasynchronous-unwind-tables +CFLAGS-fsync.c = -fexceptions -fasynchronous-unwind-tables CFLAGS-pt-system.c = -fexceptions diff --git a/sysdeps/unix/syscalls.list b/sysdeps/unix/syscalls.list index c4135d8..61e5360 100644 --- a/sysdeps/unix/syscalls.list +++ b/sysdeps/unix/syscalls.list @@ -19,7 +19,6 @@ fchmod - fchmod i:ii __fchmod fchmod fchown - fchown i:iii __fchown fchown fcntl - fcntl Ci:iiF __libc_fcntl __fcntl fcntl fstatfs - fstatfs i:ip __fstatfs fstatfs -fsync - fsync Ci:i __libc_fsync fsync ftruncate - ftruncate i:ii __ftruncate ftruncate getdomain - getdomainname i:si getdomainname getgid - getgid Ei: __getgid getgid diff --git a/sysdeps/unix/sysv/linux/arm/localplt.data b/sysdeps/unix/sysv/linux/arm/localplt.data index 8bc876d..19d3299 100644 --- a/sysdeps/unix/sysv/linux/arm/localplt.data +++ b/sysdeps/unix/sysv/linux/arm/localplt.data @@ -5,7 +5,6 @@ libc.so: memalign libc.so: raise libc.so: realloc libm.so: matherr -libpthread.so: __errno_location libpthread.so: raise # The dynamic loader needs __tls_get_addr for TLS. ld.so: __tls_get_addr diff --git a/sysdeps/unix/sysv/linux/fsync.c b/sysdeps/unix/sysv/linux/fsync.c new file mode 100644 index 0000000..ac4827b --- /dev/null +++ b/sysdeps/unix/sysv/linux/fsync.c @@ -0,0 +1,28 @@ +/* Synchronize a file's in-core state with storage device Linux + implementation. + Copyright (C) 2017 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include +#include + +/* Make all changes done to FD actually appear on disk. */ +int +fsync (int fd) +{ + return SYSCALL_CANCEL (fsync, fd); +} From patchwork Fri May 12 17:58:10 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [09/13] linux: Consolidate Linux vmsplice syscall X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 99720 Message-Id: <1494611894-9282-9-git-send-email-adhemerval.zanella@linaro.org> To: libc-alpha@sourceware.org Date: Fri, 12 May 2017 14:58:10 -0300 From: Adhemerval Zanella List-Id: This patch consolidates the vmsplice Linux syscall generation on sysdeps/unix/sysv/linux/vmsplice.c. It basically removes it from architectures auto-generation list. Checked on i686-linux-gnu, x86_64-linux-gnu, x86_64-linux-gnux32, arch64-linux-gnu, arm-linux-gnueabihf, powerpc64le-linux-gnu, sparc64-linux-gnu, and sparcv9-linux-gnu. * sysdeps/unix/sysv/linux/Makefile (CFLAGS-vmsplice.c): New flag. * sysdeps/unix/sysv/linux/syscalls.list (vmsplice): Remove from auto-generation syscall list. * sysdeps/unix/sysv/linux/vmsplice.c: New file. --- ChangeLog | 5 +++++ sysdeps/unix/sysv/linux/Makefile | 2 +- sysdeps/unix/sysv/linux/syscalls.list | 1 - sysdeps/unix/sysv/linux/vmsplice.c | 27 +++++++++++++++++++++++++++ 4 files changed, 33 insertions(+), 2 deletions(-) create mode 100644 sysdeps/unix/sysv/linux/vmsplice.c -- 2.7.4 diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile index acdd04c..492963b 100644 --- a/sysdeps/unix/sysv/linux/Makefile +++ b/sysdeps/unix/sysv/linux/Makefile @@ -17,7 +17,7 @@ include $(firstword $(wildcard $(sysdirs:=/sysctl.mk))) sysdep_routines += clone umount umount2 readahead \ setfsuid setfsgid epoll_pwait signalfd \ eventfd eventfd_read eventfd_write prlimit \ - personality epoll_wait tee + personality epoll_wait tee vmsplice CFLAGS-gethostid.c = -fexceptions CFLAGS-tst-writev.c += "-DARTIFICIAL_LIMIT=(0x80000000-sysconf(_SC_PAGESIZE))" diff --git a/sysdeps/unix/sysv/linux/syscalls.list b/sysdeps/unix/sysv/linux/syscalls.list index c69eff4..9d7bd65 100644 --- a/sysdeps/unix/sysv/linux/syscalls.list +++ b/sysdeps/unix/sysv/linux/syscalls.list @@ -72,7 +72,6 @@ swapoff - swapoff i:s __swapoff swapoff unshare EXTRA unshare i:i unshare uselib EXTRA uselib i:s __compat_uselib uselib@GLIBC_2.0:GLIBC_2.23 utime - utime i:sP utime -vmsplice EXTRA vmsplice Ci:iPii vmsplice wait4 - wait4 i:iWiP __wait4 wait4 chown - chown i:sii __libc_chown __chown chown diff --git a/sysdeps/unix/sysv/linux/vmsplice.c b/sysdeps/unix/sysv/linux/vmsplice.c new file mode 100644 index 0000000..01dac13 --- /dev/null +++ b/sysdeps/unix/sysv/linux/vmsplice.c @@ -0,0 +1,27 @@ +/* Splice user pages into a pipe Linux implementation. + Copyright (C) 2017 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include +#include +#include + +ssize_t +vmsplice (int fd, const struct iovec *iov, size_t count, unsigned int flags) +{ + return SYSCALL_CANCEL (vmsplice, fd, iov, count, flags); +} From patchwork Fri May 12 17:58:11 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [10/13] linux: Consolidate Linux splice syscall X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 99721 Message-Id: <1494611894-9282-10-git-send-email-adhemerval.zanella@linaro.org> To: libc-alpha@sourceware.org Date: Fri, 12 May 2017 14:58:11 -0300 From: Adhemerval Zanella List-Id: This patch consolidates the splice Linux syscall generation on sysdeps/unix/sysv/linux/splice.c. It basically removes it from architectures auto-generation list. Checked on i686-linux-gnu, x86_64-linux-gnu, x86_64-linux-gnux32, arch64-linux-gnu, arm-linux-gnueabihf, powerpc64le-linux-gnu, sparc64-linux-gnu, and sparcv9-linux-gnu. * sysdeps/unix/sysv/linux/Makefile (sysdep_routines): Add splice. (CFLAGS-splice.c): New flag. * sysdeps/unix/sysv/linux/splice.c: New file. * sysdeps/unix/sysv/linux/syscalls.list (splice): Remove from auto-generation syscall list. --- ChangeLog | 6 ++++++ sysdeps/unix/sysv/linux/Makefile | 2 +- sysdeps/unix/sysv/linux/splice.c | 27 +++++++++++++++++++++++++++ sysdeps/unix/sysv/linux/syscalls.list | 1 - 4 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 sysdeps/unix/sysv/linux/splice.c -- 2.7.4 diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile index 492963b..578f9e4 100644 --- a/sysdeps/unix/sysv/linux/Makefile +++ b/sysdeps/unix/sysv/linux/Makefile @@ -17,7 +17,7 @@ include $(firstword $(wildcard $(sysdirs:=/sysctl.mk))) sysdep_routines += clone umount umount2 readahead \ setfsuid setfsgid epoll_pwait signalfd \ eventfd eventfd_read eventfd_write prlimit \ - personality epoll_wait tee vmsplice + personality epoll_wait tee vmsplice splice CFLAGS-gethostid.c = -fexceptions CFLAGS-tst-writev.c += "-DARTIFICIAL_LIMIT=(0x80000000-sysconf(_SC_PAGESIZE))" diff --git a/sysdeps/unix/sysv/linux/splice.c b/sysdeps/unix/sysv/linux/splice.c new file mode 100644 index 0000000..2aaf878 --- /dev/null +++ b/sysdeps/unix/sysv/linux/splice.c @@ -0,0 +1,27 @@ +/* Splice data to/from a pipe Linux implementation. + Copyright (C) 2017 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include +#include + +ssize_t +splice (int fd_in, loff_t *off_in, int fd_out, loff_t *off_out, size_t len, + unsigned int flags) +{ + return SYSCALL_CANCEL (splice, fd_in, off_in, fd_out, off_out, len, flags); +} diff --git a/sysdeps/unix/sysv/linux/syscalls.list b/sysdeps/unix/sysv/linux/syscalls.list index 9d7bd65..b40825a 100644 --- a/sysdeps/unix/sysv/linux/syscalls.list +++ b/sysdeps/unix/sysv/linux/syscalls.list @@ -64,7 +64,6 @@ setfsgid EXTRA setfsgid i:i setfsgid setfsuid EXTRA setfsuid i:i setfsuid setpgid - setpgid i:ii __setpgid setpgid sigaltstack - sigaltstack i:PP __sigaltstack sigaltstack -splice EXTRA splice Ci:iPiPii splice stime - stime i:p stime sysinfo EXTRA sysinfo i:p __sysinfo sysinfo swapon - swapon i:si __swapon swapon From patchwork Fri May 12 17:58:12 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [11/13] linux: Consolidate Linux open_by_handle_at syscall X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 99722 Message-Id: <1494611894-9282-11-git-send-email-adhemerval.zanella@linaro.org> To: libc-alpha@sourceware.org Date: Fri, 12 May 2017 14:58:12 -0300 From: Adhemerval Zanella List-Id: This patch consolidates the open_by_handle_at Linux syscall generation on sysdeps/unix/sysv/linux/fdatasync.c. It basically removes it from architectures auto-generation list. Checked on i686-linux-gnu, x86_64-linux-gnu, x86_64-linux-gnux32, arch64-linux-gnu, arm-linux-gnueabihf, powerpc64le-linux-gnu, sparc64-linux-gnu, and sparcv9-linux-gnu. * sysdeps/unix/sysv/linux/Makefile (sysdep_routines): Add open_by_handle_at. (CFLAGS-open_by_handle_at.c): New flag. * sysdeps/unix/sysv/linux/open_by_handle_at.c: New file. * sysdeps/unix/sysv/linux/syscalls.list (open_by_handle_at): New file. --- ChangeLog | 7 ++++++ sysdeps/unix/sysv/linux/Makefile | 3 ++- sysdeps/unix/sysv/linux/open_by_handle_at.c | 37 +++++++++++++++++++++++++++++ sysdeps/unix/sysv/linux/syscalls.list | 1 - 4 files changed, 46 insertions(+), 2 deletions(-) create mode 100644 sysdeps/unix/sysv/linux/open_by_handle_at.c -- 2.7.4 diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile index 578f9e4..9e03a04 100644 --- a/sysdeps/unix/sysv/linux/Makefile +++ b/sysdeps/unix/sysv/linux/Makefile @@ -17,7 +17,8 @@ include $(firstword $(wildcard $(sysdirs:=/sysctl.mk))) sysdep_routines += clone umount umount2 readahead \ setfsuid setfsgid epoll_pwait signalfd \ eventfd eventfd_read eventfd_write prlimit \ - personality epoll_wait tee vmsplice splice + personality epoll_wait tee vmsplice splice \ + open_by_handle_at CFLAGS-gethostid.c = -fexceptions CFLAGS-tst-writev.c += "-DARTIFICIAL_LIMIT=(0x80000000-sysconf(_SC_PAGESIZE))" diff --git a/sysdeps/unix/sysv/linux/open_by_handle_at.c b/sysdeps/unix/sysv/linux/open_by_handle_at.c new file mode 100644 index 0000000..e69f041 --- /dev/null +++ b/sysdeps/unix/sysv/linux/open_by_handle_at.c @@ -0,0 +1,37 @@ +/* Obtain handle for an open file via a handle. Linux implementation. + Copyright (C) 2017 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include +#include +#include +#include + +int +open_by_handle_at (int mount_fd, struct file_handle *handle, int flags) +{ +#ifdef __NR_open_by_handle_at + return SYSCALL_CANCEL (open_by_handle_at, mount_fd, handle, flags); +#else + __set_errno (ENOSYS); + return -1; +#endif +} + +#ifndef __NR_open_by_handle_at +stub_warning (open_by_handle_at) +#endif diff --git a/sysdeps/unix/sysv/linux/syscalls.list b/sysdeps/unix/sysv/linux/syscalls.list index b40825a..a8d1299 100644 --- a/sysdeps/unix/sysv/linux/syscalls.list +++ b/sysdeps/unix/sysv/linux/syscalls.list @@ -106,7 +106,6 @@ timerfd_gettime EXTRA timerfd_gettime i:ip timerfd_gettime fanotify_init EXTRA fanotify_init i:ii fanotify_init name_to_handle_at EXTRA name_to_handle_at i:isppi name_to_handle_at -open_by_handle_at EXTRA open_by_handle_at Ci:ipi open_by_handle_at setns EXTRA setns i:ii setns From patchwork Fri May 12 17:58:13 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [12/13] posix: Consolidate Linux mq_timedreceive syscall X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 99723 Message-Id: <1494611894-9282-12-git-send-email-adhemerval.zanella@linaro.org> To: libc-alpha@sourceware.org Date: Fri, 12 May 2017 14:58:13 -0300 From: Adhemerval Zanella List-Id: This patch consolidates the mq_timedreceive Linux syscall generation on sysdeps/unix/sysv/linux/mq_timedreceive.c. It basically removes it from architecture auto-generation list. Checked on i686-linux-gnu, x86_64-linux-gnu, x86_64-linux-gnux32, arch64-linux-gnu, arm-linux-gnueabihf, powerpc64le-linux-gnu, sparc64-linux-gnu, and sparcv9-linux-gnu. * rt/Makefile (CFLAGS-mq_timedreceive.c): New flag. * sysdeps/unix/sysv/linux/mq_timedreceive.c: New file. * sysdeps/unix/sysv/linux/syscalls.list (mq_timedreceive): Remove from auto-generation list. --- ChangeLog | 5 +++++ rt/Makefile | 1 + sysdeps/unix/sysv/linux/mq_timedreceive.c | 34 +++++++++++++++++++++++++++++++ sysdeps/unix/sysv/linux/syscalls.list | 1 - 4 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 sysdeps/unix/sysv/linux/mq_timedreceive.c -- 2.7.4 diff --git a/rt/Makefile b/rt/Makefile index 5283839..0ffa12d 100644 --- a/rt/Makefile +++ b/rt/Makefile @@ -61,6 +61,7 @@ extra-libs-others := $(extra-libs) include ../Rules CFLAGS-aio_suspend.c = -fexceptions +CFLAGS-mq_timedreceive.c = -fexceptions -fasynchronous-unwind-tables CFLAGS-clock_nanosleep.c = -fexceptions -fasynchronous-unwind-tables CFLAGS-librt-cancellation.c = -fasynchronous-unwind-tables diff --git a/sysdeps/unix/sysv/linux/mq_timedreceive.c b/sysdeps/unix/sysv/linux/mq_timedreceive.c new file mode 100644 index 0000000..6d1c145 --- /dev/null +++ b/sysdeps/unix/sysv/linux/mq_timedreceive.c @@ -0,0 +1,34 @@ +/* Receive a message from a message queue with a timeout. Linux version. + Copyright (C) 2017 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include +#include + +/* Receive the oldest from highest priority messages in message queue + MQDES, stop waiting if ABS_TIMEOUT expires. */ +ssize_t +__mq_timedreceive (mqd_t mqdes, char *__restrict msg_ptr, size_t msg_len, + unsigned int *__restrict msg_prio, + const struct timespec *__restrict abs_timeout) +{ + return SYSCALL_CANCEL (mq_timedreceive, mqdes, msg_ptr, msg_len, msg_prio, + abs_timeout); +} +hidden_def (__mq_timedreceive) +weak_alias (__mq_timedreceive, mq_timedreceive) +hidden_weak (mq_timedreceive) diff --git a/sysdeps/unix/sysv/linux/syscalls.list b/sysdeps/unix/sysv/linux/syscalls.list index a8d1299..63914bc 100644 --- a/sysdeps/unix/sysv/linux/syscalls.list +++ b/sysdeps/unix/sysv/linux/syscalls.list @@ -96,7 +96,6 @@ lremovexattr - lremovexattr i:ss lremovexattr fremovexattr - fremovexattr i:is fremovexattr mq_timedsend - mq_timedsend Ci:ipiip __mq_timedsend mq_timedsend -mq_timedreceive - mq_timedreceive Ci:ipipp __mq_timedreceive mq_timedreceive mq_setattr - mq_getsetattr i:ipp mq_setattr timerfd_create EXTRA timerfd_create i:ii timerfd_create From patchwork Fri May 12 17:58:14 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [13/13] posix: Consolidate Linux mq_timedsend syscall X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 99724 Message-Id: <1494611894-9282-13-git-send-email-adhemerval.zanella@linaro.org> To: libc-alpha@sourceware.org Date: Fri, 12 May 2017 14:58:14 -0300 From: Adhemerval Zanella List-Id: This patch consolidates the mq_timedsend Linux syscall generation on sysdeps/unix/sysv/linux/mq_timedsend.c. It basically removes it from architecture auto-generation list. Checked on i686-linux-gnu, x86_64-linux-gnu, x86_64-linux-gnux32, arch64-linux-gnu, arm-linux-gnueabihf, powerpc64le-linux-gnu, sparc64-linux-gnu, and sparcv9-linux-gnu. * rt/Makefile (CFLAGS-mq_timedsend.c): New flag. * sysdeps/unix/sysv/linux/mq_timedsend.c: New file. * sysdeps/unix/sysv/linux/syscalls.list (mq_timedsend): Remove from auto-generation list. --- ChangeLog | 5 +++++ rt/Makefile | 1 + sysdeps/unix/sysv/linux/mq_timedsend.c | 33 +++++++++++++++++++++++++++++++++ sysdeps/unix/sysv/linux/syscalls.list | 1 - 4 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 sysdeps/unix/sysv/linux/mq_timedsend.c -- 2.7.4 diff --git a/rt/Makefile b/rt/Makefile index 0ffa12d..9740dc2 100644 --- a/rt/Makefile +++ b/rt/Makefile @@ -62,6 +62,7 @@ include ../Rules CFLAGS-aio_suspend.c = -fexceptions CFLAGS-mq_timedreceive.c = -fexceptions -fasynchronous-unwind-tables +CFLAGS-mq_timedsend.c = -fexceptions -fasynchronous-unwind-tables CFLAGS-clock_nanosleep.c = -fexceptions -fasynchronous-unwind-tables CFLAGS-librt-cancellation.c = -fasynchronous-unwind-tables diff --git a/sysdeps/unix/sysv/linux/mq_timedsend.c b/sysdeps/unix/sysv/linux/mq_timedsend.c new file mode 100644 index 0000000..7995554 --- /dev/null +++ b/sysdeps/unix/sysv/linux/mq_timedsend.c @@ -0,0 +1,33 @@ +/* Send a message to a message queue with a timeout. Linux version. + Copyright (C) 2017 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include +#include + +/* Add message pointed by MSG_PTR to message queue MQDES, stop blocking + on full message queue if ABS_TIMEOUT expires. */ +int +__mq_timedsend (mqd_t mqdes, const char *msg_ptr, size_t msg_len, + unsigned int msg_prio, const struct timespec *abs_timeout) +{ + return SYSCALL_CANCEL (mq_timedsend, mqdes, msg_ptr, msg_len, msg_prio, + abs_timeout); +} +hidden_def (__mq_timedsend) +weak_alias (__mq_timedsend, mq_timedsend) +hidden_weak (mq_timedsend) diff --git a/sysdeps/unix/sysv/linux/syscalls.list b/sysdeps/unix/sysv/linux/syscalls.list index 63914bc..8bfb080 100644 --- a/sysdeps/unix/sysv/linux/syscalls.list +++ b/sysdeps/unix/sysv/linux/syscalls.list @@ -95,7 +95,6 @@ removexattr - removexattr i:ss removexattr lremovexattr - lremovexattr i:ss lremovexattr fremovexattr - fremovexattr i:is fremovexattr -mq_timedsend - mq_timedsend Ci:ipiip __mq_timedsend mq_timedsend mq_setattr - mq_getsetattr i:ipp mq_setattr timerfd_create EXTRA timerfd_create i:ii timerfd_create