* [PATCH 04/13] linux: Consolidate Linux tee implementation
2017-05-12 17:58 [PATCH 01/13] posix: Consolidate Linux pause syscall Adhemerval Zanella
@ 2017-05-12 17:58 ` Adhemerval Zanella
2017-05-15 10:51 ` Florian Weimer
2017-05-12 17:58 ` [PATCH 02/13] posix: Consolidate Linux waitpid syscall Adhemerval Zanella
` (11 subsequent siblings)
12 siblings, 1 reply; 36+ messages in thread
From: Adhemerval Zanella @ 2017-05-12 17:58 UTC (permalink / raw)
To: libc-alpha
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
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
+ <http://www.gnu.org/licenses/>. */
+
+#include <fcntl.h>
+#include <sysdep-cancel.h>
+
+ssize_t
+tee (int src, int dest, size_t len, unsigned int flags)
+{
+ return SYSCALL_CANCEL (tee, src, dest, len, flags);
+}
--
2.7.4
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH 04/13] linux: Consolidate Linux tee implementation
2017-05-12 17:58 ` [PATCH 04/13] linux: Consolidate Linux tee implementation Adhemerval Zanella
@ 2017-05-15 10:51 ` Florian Weimer
2017-05-15 11:41 ` Joseph Myers
0 siblings, 1 reply; 36+ messages in thread
From: Florian Weimer @ 2017-05-15 10:51 UTC (permalink / raw)
To: Adhemerval Zanella, libc-alpha
On 05/12/2017 07:58 PM, Adhemerval Zanella wrote:
> -tee EXTRA tee Ci:iiii tee
> +ssize_t
> +tee (int src, int dest, size_t len, unsigned int flags)
> +{
> + return SYSCALL_CANCEL (tee, src, dest, len, flags);
> +}
This might be a silly question, but could we adjust the âCâ system call
generation to make this kind of change automatically?
Or is the goal to remove the C handling eventually?
Thanks,
Florian
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH 04/13] linux: Consolidate Linux tee implementation
2017-05-15 10:51 ` Florian Weimer
@ 2017-05-15 11:41 ` Joseph Myers
2017-05-15 11:42 ` Florian Weimer
0 siblings, 1 reply; 36+ messages in thread
From: Joseph Myers @ 2017-05-15 11:41 UTC (permalink / raw)
To: Florian Weimer; +Cc: Adhemerval Zanella, libc-alpha
[-- Attachment #1: Type: text/plain, Size: 1175 bytes --]
On Mon, 15 May 2017, Florian Weimer wrote:
> On 05/12/2017 07:58 PM, Adhemerval Zanella wrote:
> > -tee EXTRA tee Ci:iiii tee
>
> > +ssize_t
> > +tee (int src, int dest, size_t len, unsigned int flags)
> > +{
> > + return SYSCALL_CANCEL (tee, src, dest, len, flags);
> > +}
>
> This might be a silly question, but could we adjust the âCâ system call
> generation to make this kind of change automatically?
>
> Or is the goal to remove the C handling eventually?
My understanding is that the goal is to eliminate generation of
cancellable syscalls via asm templates. Generating them via generated C
code with inline asm (rather than having such code checked in as a .c file
for each syscall) would be possible - but preferably with more information
about appropriate return type and argument types and names (which could in
principle come from the public headers), to generate useful debug
information and so help users with a program stopped in such a syscall.
(There's an old notion that even with asm templates for syscalls we should
generate debug info somehow to help users debugging through them.)
--
Joseph S. Myers
joseph@codesourcery.com
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH 04/13] linux: Consolidate Linux tee implementation
2017-05-15 11:41 ` Joseph Myers
@ 2017-05-15 11:42 ` Florian Weimer
0 siblings, 0 replies; 36+ messages in thread
From: Florian Weimer @ 2017-05-15 11:42 UTC (permalink / raw)
To: Joseph Myers; +Cc: Adhemerval Zanella, libc-alpha
On 05/15/2017 01:40 PM, Joseph Myers wrote:
> On Mon, 15 May 2017, Florian Weimer wrote:
>
>> On 05/12/2017 07:58 PM, Adhemerval Zanella wrote:
>>> -tee EXTRA tee Ci:iiii tee
>>
>>> +ssize_t
>>> +tee (int src, int dest, size_t len, unsigned int flags)
>>> +{
>>> + return SYSCALL_CANCEL (tee, src, dest, len, flags);
>>> +}
>>
>> This might be a silly question, but could we adjust the âCâ system call
>> generation to make this kind of change automatically?
>>
>> Or is the goal to remove the C handling eventually?
>
> My understanding is that the goal is to eliminate generation of
> cancellable syscalls via asm templates. Generating them via generated C
> code with inline asm (rather than having such code checked in as a .c file
> for each syscall) would be possible - but preferably with more information
> about appropriate return type and argument types and names (which could in
> principle come from the public headers), to generate useful debug
> information and so help users with a program stopped in such a syscall.
Okay, in that case, the patch looks okay to me.
> (There's an old notion that even with asm templates for syscalls we should
> generate debug info somehow to help users debugging through them.)
Right, I ran into that deficiency many times, too.
Florian
^ permalink raw reply [flat|nested] 36+ messages in thread
* [PATCH 02/13] posix: Consolidate Linux waitpid syscall
2017-05-12 17:58 [PATCH 01/13] posix: Consolidate Linux pause syscall Adhemerval Zanella
2017-05-12 17:58 ` [PATCH 04/13] linux: Consolidate Linux tee implementation Adhemerval Zanella
@ 2017-05-12 17:58 ` Adhemerval Zanella
2017-05-18 19:10 ` Siddhesh Poyarekar
2017-05-12 17:58 ` [PATCH 08/13] posix: Consolidate Linux fsync syscall Adhemerval Zanella
` (10 subsequent siblings)
12 siblings, 1 reply; 36+ messages in thread
From: Adhemerval Zanella @ 2017-05-12 17:58 UTC (permalink / raw)
To: libc-alpha
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
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 <sysdep-cancel.h>
-
-PSEUDO (__waitpid, wait4, 3)
-ret
-PSEUDO_END(__waitpid)
-
-libc_hidden_def (__waitpid)
-weak_alias (__waitpid, waitpid)
-libc_hidden_weak (waitpid)
-
-#endif
--
2.7.4
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH 02/13] posix: Consolidate Linux waitpid syscall
2017-05-12 17:58 ` [PATCH 02/13] posix: Consolidate Linux waitpid syscall Adhemerval Zanella
@ 2017-05-18 19:10 ` Siddhesh Poyarekar
0 siblings, 0 replies; 36+ messages in thread
From: Siddhesh Poyarekar @ 2017-05-18 19:10 UTC (permalink / raw)
To: Adhemerval Zanella, libc-alpha
On Friday 12 May 2017 11:28 PM, Adhemerval Zanella wrote:
> 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.
This is fine.
Siddhesh
^ permalink raw reply [flat|nested] 36+ messages in thread
* [PATCH 08/13] posix: Consolidate Linux fsync syscall
2017-05-12 17:58 [PATCH 01/13] posix: Consolidate Linux pause syscall Adhemerval Zanella
2017-05-12 17:58 ` [PATCH 04/13] linux: Consolidate Linux tee implementation Adhemerval Zanella
2017-05-12 17:58 ` [PATCH 02/13] posix: Consolidate Linux waitpid syscall Adhemerval Zanella
@ 2017-05-12 17:58 ` Adhemerval Zanella
2017-05-18 19:20 ` Siddhesh Poyarekar
2017-05-12 17:58 ` [PATCH 03/13] posix: Consolidate Linux nanosleep syscall Adhemerval Zanella
` (9 subsequent siblings)
12 siblings, 1 reply; 36+ messages in thread
From: Adhemerval Zanella @ 2017-05-12 17:58 UTC (permalink / raw)
To: libc-alpha
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
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
+ <http://www.gnu.org/licenses/>. */
+
+#include <unistd.h>
+#include <sysdep-cancel.h>
+
+/* Make all changes done to FD actually appear on disk. */
+int
+fsync (int fd)
+{
+ return SYSCALL_CANCEL (fsync, fd);
+}
--
2.7.4
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH 08/13] posix: Consolidate Linux fsync syscall
2017-05-12 17:58 ` [PATCH 08/13] posix: Consolidate Linux fsync syscall Adhemerval Zanella
@ 2017-05-18 19:20 ` Siddhesh Poyarekar
0 siblings, 0 replies; 36+ messages in thread
From: Siddhesh Poyarekar @ 2017-05-18 19:20 UTC (permalink / raw)
To: Adhemerval Zanella, libc-alpha
On Friday 12 May 2017 11:28 PM, Adhemerval Zanella wrote:
> 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.
LGTM.
Siddhesh
^ permalink raw reply [flat|nested] 36+ messages in thread
* [PATCH 03/13] posix: Consolidate Linux nanosleep syscall
2017-05-12 17:58 [PATCH 01/13] posix: Consolidate Linux pause syscall Adhemerval Zanella
` (2 preceding siblings ...)
2017-05-12 17:58 ` [PATCH 08/13] posix: Consolidate Linux fsync syscall Adhemerval Zanella
@ 2017-05-12 17:58 ` Adhemerval Zanella
2017-05-12 18:21 ` Florian Weimer
2017-05-12 17:58 ` [PATCH 06/13] posix: Consolidate Linux msync syscall Adhemerval Zanella
` (8 subsequent siblings)
12 siblings, 1 reply; 36+ messages in thread
From: Adhemerval Zanella @ 2017-05-12 17:58 UTC (permalink / raw)
To: libc-alpha
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
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
+ <http://www.gnu.org/licenses/>. */
+
+#include <time.h>
+#include <sysdep-cancel.h>
+
+/* 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
--
2.7.4
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH 03/13] posix: Consolidate Linux nanosleep syscall
2017-05-12 17:58 ` [PATCH 03/13] posix: Consolidate Linux nanosleep syscall Adhemerval Zanella
@ 2017-05-12 18:21 ` Florian Weimer
2017-05-12 18:30 ` Adhemerval Zanella
0 siblings, 1 reply; 36+ messages in thread
From: Florian Weimer @ 2017-05-12 18:21 UTC (permalink / raw)
To: Adhemerval Zanella, libc-alpha
On 05/12/2017 07:58 PM, Adhemerval Zanella wrote:
> +++ b/nptl/Makefile
> +CFLAGS-nanosleep.c = -fexceptions -fasynchronous-unwind-tables
> +++ b/posix/Makefile
> +CFLAGS-nanosleep.c = -fexceptions
Why the discrepancy? I suppose both implementations could be called in
a multi-threaded program.
Thanks,
Florian
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH 03/13] posix: Consolidate Linux nanosleep syscall
2017-05-12 18:21 ` Florian Weimer
@ 2017-05-12 18:30 ` Adhemerval Zanella
2017-05-15 9:43 ` Stack unwinding requirements (was: Re: [PATCH 03/13] posix: Consolidate Linux nanosleep syscall) Florian Weimer
0 siblings, 1 reply; 36+ messages in thread
From: Adhemerval Zanella @ 2017-05-12 18:30 UTC (permalink / raw)
To: Florian Weimer, libc-alpha
On 12/05/2017 15:21, Florian Weimer wrote:
> On 05/12/2017 07:58 PM, Adhemerval Zanella wrote:
>> +++ b/nptl/Makefile
>
>> +CFLAGS-nanosleep.c = -fexceptions -fasynchronous-unwind-tables
>
>
>> +++ b/posix/Makefile
>
>> +CFLAGS-nanosleep.c = -fexceptions
>
> Why the discrepancy? I suppose both implementations could be called in a multi-threaded program.
I do not recall a reason why these are different, I will set both to
-fexceptions -fasynchronous-unwind-tables. AFAIK -fexception is the
required flag for cancelable syscall to work correctly, while
-fasynchronous-unwind-tables is make it work also through signals
(not really sure though). So I would say to be safe we should set
both.
^ permalink raw reply [flat|nested] 36+ messages in thread
* Stack unwinding requirements (was: Re: [PATCH 03/13] posix: Consolidate Linux nanosleep syscall)
2017-05-12 18:30 ` Adhemerval Zanella
@ 2017-05-15 9:43 ` Florian Weimer
2017-05-15 11:37 ` Joseph Myers
0 siblings, 1 reply; 36+ messages in thread
From: Florian Weimer @ 2017-05-15 9:43 UTC (permalink / raw)
To: Adhemerval Zanella; +Cc: libc-alpha
On 05/12/2017 08:30 PM, Adhemerval Zanella wrote:
>
>
> On 12/05/2017 15:21, Florian Weimer wrote:
>> On 05/12/2017 07:58 PM, Adhemerval Zanella wrote:
>>> +++ b/nptl/Makefile
>>
>>> +CFLAGS-nanosleep.c = -fexceptions -fasynchronous-unwind-tables
>>
>>
>>> +++ b/posix/Makefile
>>
>>> +CFLAGS-nanosleep.c = -fexceptions
>>
>> Why the discrepancy? I suppose both implementations could be called in a multi-threaded program.
>
> I do not recall a reason why these are different, I will set both to
> -fexceptions -fasynchronous-unwind-tables. AFAIK -fexception is the
> required flag for cancelable syscall to work correctly, while
> -fasynchronous-unwind-tables is make it work also through signals
> (not really sure though). So I would say to be safe we should set
> both.
glibc itself no longer uses the libgcc unwinder and the
__gcc_personality_v0 personality routine. As far as I know, the C front
end never supported exceptions in this way, and we have since removed
all assembly routines which used this functionality.
The replacement is a chain list of cleanup routines, rooted in a
thread-local variable. Cleanup code is specified by function pointers
on the stack. From a security perspective, this is far worse than
unwinding based on tables stored in read-only memory. We can likely
obfuscate the function pointers (like we do for setjmp buffers), but
that's it.
Technically, __gcc_personality_v0 is part of the ABI, so there could
still be user code out there that uses it. And of course, Ada and C++
code which is called from glibc code (or which runs from a signal
handler that interrupts glibc code) could have stack frames with crucial
unwinding information when thread cancellation happens.
In order to reach those stack frames, the cancellation code needs to
unwind through glibc code. This could be any code in glibc which calls
a function which is a cancellation point.
Based on that, I think we should compile all of glibc with unwinding
support, and considering that asynchronous cancellation can happen
through synchronous cancellation within signal handlers, we need both
-fexceptions *and* -fasynchronous-unwind-tables.
Comments?
Thanks,
Florian
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: Stack unwinding requirements (was: Re: [PATCH 03/13] posix: Consolidate Linux nanosleep syscall)
2017-05-15 9:43 ` Stack unwinding requirements (was: Re: [PATCH 03/13] posix: Consolidate Linux nanosleep syscall) Florian Weimer
@ 2017-05-15 11:37 ` Joseph Myers
2017-05-15 11:46 ` Stack unwinding requirements Florian Weimer
0 siblings, 1 reply; 36+ messages in thread
From: Joseph Myers @ 2017-05-15 11:37 UTC (permalink / raw)
To: Florian Weimer; +Cc: Adhemerval Zanella, libc-alpha
On Mon, 15 May 2017, Florian Weimer wrote:
> Technically, __gcc_personality_v0 is part of the ABI, so there could still be
> user code out there that uses it. And of course, Ada and C++ code which is
> called from glibc code (or which runs from a signal handler that interrupts
> glibc code) could have stack frames with crucial unwinding information when
> thread cancellation happens.
>
> In order to reach those stack frames, the cancellation code needs to unwind
> through glibc code. This could be any code in glibc which calls a function
> which is a cancellation point.
>
> Based on that, I think we should compile all of glibc with unwinding support,
> and considering that asynchronous cancellation can happen through synchronous
> cancellation within signal handlers, we need both -fexceptions *and*
> -fasynchronous-unwind-tables.
See <https://sourceware.org/ml/libc-alpha/2015-10/msg00569.html> and
followups for discussion of the circumstances when those options may be
needed.
--
Joseph S. Myers
joseph@codesourcery.com
^ permalink raw reply [flat|nested] 36+ messages in thread
* [PATCH 06/13] posix: Consolidate Linux msync syscall
2017-05-12 17:58 [PATCH 01/13] posix: Consolidate Linux pause syscall Adhemerval Zanella
` (3 preceding siblings ...)
2017-05-12 17:58 ` [PATCH 03/13] posix: Consolidate Linux nanosleep syscall Adhemerval Zanella
@ 2017-05-12 17:58 ` Adhemerval Zanella
2017-05-18 19:18 ` Siddhesh Poyarekar
2017-05-12 17:58 ` [PATCH 09/13] linux: Consolidate Linux vmsplice syscall Adhemerval Zanella
` (7 subsequent siblings)
12 siblings, 1 reply; 36+ messages in thread
From: Adhemerval Zanella @ 2017-05-12 17:58 UTC (permalink / raw)
To: libc-alpha
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
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
+ <http://www.gnu.org/licenses/>. */
+
+#include <sys/mman.h>
+#include <sysdep-cancel.h>
+
+int
+msync (void *addr, size_t length, int flags)
+{
+ return SYSCALL_CANCEL (msync, addr, length, flags);
+}
--
2.7.4
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH 06/13] posix: Consolidate Linux msync syscall
2017-05-12 17:58 ` [PATCH 06/13] posix: Consolidate Linux msync syscall Adhemerval Zanella
@ 2017-05-18 19:18 ` Siddhesh Poyarekar
0 siblings, 0 replies; 36+ messages in thread
From: Siddhesh Poyarekar @ 2017-05-18 19:18 UTC (permalink / raw)
To: Adhemerval Zanella, libc-alpha
On Friday 12 May 2017 11:28 PM, Adhemerval Zanella wrote:
> 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.
This is fine.
Siddhesh
^ permalink raw reply [flat|nested] 36+ messages in thread
* [PATCH 09/13] linux: Consolidate Linux vmsplice syscall
2017-05-12 17:58 [PATCH 01/13] posix: Consolidate Linux pause syscall Adhemerval Zanella
` (4 preceding siblings ...)
2017-05-12 17:58 ` [PATCH 06/13] posix: Consolidate Linux msync syscall Adhemerval Zanella
@ 2017-05-12 17:58 ` Adhemerval Zanella
2017-05-18 19:21 ` Siddhesh Poyarekar
2017-05-19 11:24 ` Joseph Myers
2017-05-12 17:58 ` [PATCH 11/13] linux: Consolidate Linux open_by_handle_at syscall Adhemerval Zanella
` (6 subsequent siblings)
12 siblings, 2 replies; 36+ messages in thread
From: Adhemerval Zanella @ 2017-05-12 17:58 UTC (permalink / raw)
To: libc-alpha
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
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
+ <http://www.gnu.org/licenses/>. */
+
+#include <fcntl.h>
+#include <sys/uio.h>
+#include <sysdep-cancel.h>
+
+ssize_t
+vmsplice (int fd, const struct iovec *iov, size_t count, unsigned int flags)
+{
+ return SYSCALL_CANCEL (vmsplice, fd, iov, count, flags);
+}
--
2.7.4
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH 09/13] linux: Consolidate Linux vmsplice syscall
2017-05-12 17:58 ` [PATCH 09/13] linux: Consolidate Linux vmsplice syscall Adhemerval Zanella
@ 2017-05-18 19:21 ` Siddhesh Poyarekar
2017-05-19 11:24 ` Joseph Myers
1 sibling, 0 replies; 36+ messages in thread
From: Siddhesh Poyarekar @ 2017-05-18 19:21 UTC (permalink / raw)
To: Adhemerval Zanella, libc-alpha
On Friday 12 May 2017 11:28 PM, Adhemerval Zanella wrote:
> 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.
This is fine.
Siddhesh
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH 09/13] linux: Consolidate Linux vmsplice syscall
2017-05-12 17:58 ` [PATCH 09/13] linux: Consolidate Linux vmsplice syscall Adhemerval Zanella
2017-05-18 19:21 ` Siddhesh Poyarekar
@ 2017-05-19 11:24 ` Joseph Myers
2017-05-19 12:41 ` Adhemerval Zanella
1 sibling, 1 reply; 36+ messages in thread
From: Joseph Myers @ 2017-05-19 11:24 UTC (permalink / raw)
To: Adhemerval Zanella; +Cc: libc-alpha
On Fri, 12 May 2017, Adhemerval Zanella wrote:
> * sysdeps/unix/sysv/linux/Makefile (CFLAGS-vmsplice.c): New flag.
This ChangeLog entry refers to CFLAGS-vmsplice.c in
sysdeps/unix/sysv/linux/Makefile. However, you appear to have committed
an addition of CFLAGS-vmsplice.c to misc/Makefile. That's wrong; vmsplice
is a Linux-specific API, not otherwise mentioned in misc/Makefile at all,
so the CFLAGS setting belongs in sysdeps/unix/sysv/linux/Makefile.
The same applies to splice and open_by_handle_at: when it's a sysdeps
Makefile that causes the source for the API to be built at all (as opposed
to having an ENOSYS system-independent stub and a system-independent
Makefile entry to build the API everywhere), all other relevant Makefile
settings should also be in sysdeps.
--
Joseph S. Myers
joseph@codesourcery.com
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH 09/13] linux: Consolidate Linux vmsplice syscall
2017-05-19 11:24 ` Joseph Myers
@ 2017-05-19 12:41 ` Adhemerval Zanella
0 siblings, 0 replies; 36+ messages in thread
From: Adhemerval Zanella @ 2017-05-19 12:41 UTC (permalink / raw)
To: Joseph Myers; +Cc: libc-alpha
On 19/05/2017 08:24, Joseph Myers wrote:
> On Fri, 12 May 2017, Adhemerval Zanella wrote:
>
>> * sysdeps/unix/sysv/linux/Makefile (CFLAGS-vmsplice.c): New flag.
>
> This ChangeLog entry refers to CFLAGS-vmsplice.c in
> sysdeps/unix/sysv/linux/Makefile. However, you appear to have committed
> an addition of CFLAGS-vmsplice.c to misc/Makefile. That's wrong; vmsplice
> is a Linux-specific API, not otherwise mentioned in misc/Makefile at all,
> so the CFLAGS setting belongs in sysdeps/unix/sysv/linux/Makefile.
>
> The same applies to splice and open_by_handle_at: when it's a sysdeps
> Makefile that causes the source for the API to be built at all (as opposed
> to having an ENOSYS system-independent stub and a system-independent
> Makefile entry to build the API everywhere), all other relevant Makefile
> settings should also be in sysdeps.
>
Thanks for spotting it, I fixed it on 1d71a63.
^ permalink raw reply [flat|nested] 36+ messages in thread
* [PATCH 11/13] linux: Consolidate Linux open_by_handle_at syscall
2017-05-12 17:58 [PATCH 01/13] posix: Consolidate Linux pause syscall Adhemerval Zanella
` (5 preceding siblings ...)
2017-05-12 17:58 ` [PATCH 09/13] linux: Consolidate Linux vmsplice syscall Adhemerval Zanella
@ 2017-05-12 17:58 ` Adhemerval Zanella
2017-05-18 19:23 ` Siddhesh Poyarekar
2017-05-12 17:58 ` [PATCH 07/13] posix: Consolidate Linux fdatasync syscall Adhemerval Zanella
` (5 subsequent siblings)
12 siblings, 1 reply; 36+ messages in thread
From: Adhemerval Zanella @ 2017-05-12 17:58 UTC (permalink / raw)
To: libc-alpha
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
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
+ <http://www.gnu.org/licenses/>. */
+
+#include <fcntl.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sysdep-cancel.h>
+
+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
--
2.7.4
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH 11/13] linux: Consolidate Linux open_by_handle_at syscall
2017-05-12 17:58 ` [PATCH 11/13] linux: Consolidate Linux open_by_handle_at syscall Adhemerval Zanella
@ 2017-05-18 19:23 ` Siddhesh Poyarekar
2017-05-18 19:43 ` Adhemerval Zanella
0 siblings, 1 reply; 36+ messages in thread
From: Siddhesh Poyarekar @ 2017-05-18 19:23 UTC (permalink / raw)
To: Adhemerval Zanella, libc-alpha
On Friday 12 May 2017 11:28 PM, Adhemerval Zanella wrote:
> 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.
Looks fine, but please update the summary above to say
open_by_handle_at.c and not fdatasync.c :)
Siddhesh
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH 11/13] linux: Consolidate Linux open_by_handle_at syscall
2017-05-18 19:23 ` Siddhesh Poyarekar
@ 2017-05-18 19:43 ` Adhemerval Zanella
0 siblings, 0 replies; 36+ messages in thread
From: Adhemerval Zanella @ 2017-05-18 19:43 UTC (permalink / raw)
To: Siddhesh Poyarekar, libc-alpha
On 18/05/2017 16:23, Siddhesh Poyarekar wrote:
> On Friday 12 May 2017 11:28 PM, Adhemerval Zanella wrote:
>> 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.
>
> Looks fine, but please update the summary above to say
> open_by_handle_at.c and not fdatasync.c :)
>
> Siddhesh
>
Thank you for spotting it.
^ permalink raw reply [flat|nested] 36+ messages in thread
* [PATCH 07/13] posix: Consolidate Linux fdatasync syscall
2017-05-12 17:58 [PATCH 01/13] posix: Consolidate Linux pause syscall Adhemerval Zanella
` (6 preceding siblings ...)
2017-05-12 17:58 ` [PATCH 11/13] linux: Consolidate Linux open_by_handle_at syscall Adhemerval Zanella
@ 2017-05-12 17:58 ` Adhemerval Zanella
2017-05-18 19:18 ` Siddhesh Poyarekar
2017-05-12 17:58 ` [PATCH 12/13] posix: Consolidate Linux mq_timedreceive syscall Adhemerval Zanella
` (4 subsequent siblings)
12 siblings, 1 reply; 36+ messages in thread
From: Adhemerval Zanella @ 2017-05-12 17:58 UTC (permalink / raw)
To: libc-alpha
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
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
+ <http://www.gnu.org/licenses/>. */
+
+#include <unistd.h>
+#include <sysdep-cancel.h>
+
+/* 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
--
2.7.4
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH 07/13] posix: Consolidate Linux fdatasync syscall
2017-05-12 17:58 ` [PATCH 07/13] posix: Consolidate Linux fdatasync syscall Adhemerval Zanella
@ 2017-05-18 19:18 ` Siddhesh Poyarekar
0 siblings, 0 replies; 36+ messages in thread
From: Siddhesh Poyarekar @ 2017-05-18 19:18 UTC (permalink / raw)
To: Adhemerval Zanella, libc-alpha
On Friday 12 May 2017 11:28 PM, Adhemerval Zanella wrote:
> 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.
LGTM.
Siddhesh
^ permalink raw reply [flat|nested] 36+ messages in thread
* [PATCH 12/13] posix: Consolidate Linux mq_timedreceive syscall
2017-05-12 17:58 [PATCH 01/13] posix: Consolidate Linux pause syscall Adhemerval Zanella
` (7 preceding siblings ...)
2017-05-12 17:58 ` [PATCH 07/13] posix: Consolidate Linux fdatasync syscall Adhemerval Zanella
@ 2017-05-12 17:58 ` Adhemerval Zanella
2017-05-18 19:24 ` Siddhesh Poyarekar
2017-05-12 17:58 ` [PATCH 10/13] linux: Consolidate Linux splice syscall Adhemerval Zanella
` (3 subsequent siblings)
12 siblings, 1 reply; 36+ messages in thread
From: Adhemerval Zanella @ 2017-05-12 17:58 UTC (permalink / raw)
To: libc-alpha
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
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
+ <http://www.gnu.org/licenses/>. */
+
+#include <mqueue.h>
+#include <sysdep-cancel.h>
+
+/* 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
--
2.7.4
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH 12/13] posix: Consolidate Linux mq_timedreceive syscall
2017-05-12 17:58 ` [PATCH 12/13] posix: Consolidate Linux mq_timedreceive syscall Adhemerval Zanella
@ 2017-05-18 19:24 ` Siddhesh Poyarekar
0 siblings, 0 replies; 36+ messages in thread
From: Siddhesh Poyarekar @ 2017-05-18 19:24 UTC (permalink / raw)
To: Adhemerval Zanella, libc-alpha
On Friday 12 May 2017 11:28 PM, Adhemerval Zanella wrote:
> 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.
LGTM.
Siddhesh
^ permalink raw reply [flat|nested] 36+ messages in thread
* [PATCH 10/13] linux: Consolidate Linux splice syscall
2017-05-12 17:58 [PATCH 01/13] posix: Consolidate Linux pause syscall Adhemerval Zanella
` (8 preceding siblings ...)
2017-05-12 17:58 ` [PATCH 12/13] posix: Consolidate Linux mq_timedreceive syscall Adhemerval Zanella
@ 2017-05-12 17:58 ` Adhemerval Zanella
2017-05-18 19:22 ` Siddhesh Poyarekar
2017-05-12 17:58 ` [PATCH 13/13] posix: Consolidate Linux mq_timedsend syscall Adhemerval Zanella
` (2 subsequent siblings)
12 siblings, 1 reply; 36+ messages in thread
From: Adhemerval Zanella @ 2017-05-12 17:58 UTC (permalink / raw)
To: libc-alpha
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
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
+ <http://www.gnu.org/licenses/>. */
+
+#include <fcntl.h>
+#include <sysdep-cancel.h>
+
+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
--
2.7.4
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH 10/13] linux: Consolidate Linux splice syscall
2017-05-12 17:58 ` [PATCH 10/13] linux: Consolidate Linux splice syscall Adhemerval Zanella
@ 2017-05-18 19:22 ` Siddhesh Poyarekar
0 siblings, 0 replies; 36+ messages in thread
From: Siddhesh Poyarekar @ 2017-05-18 19:22 UTC (permalink / raw)
To: Adhemerval Zanella, libc-alpha
On Friday 12 May 2017 11:28 PM, Adhemerval Zanella wrote:
> 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.
LGTM.
Siddhesh
^ permalink raw reply [flat|nested] 36+ messages in thread
* [PATCH 13/13] posix: Consolidate Linux mq_timedsend syscall
2017-05-12 17:58 [PATCH 01/13] posix: Consolidate Linux pause syscall Adhemerval Zanella
` (9 preceding siblings ...)
2017-05-12 17:58 ` [PATCH 10/13] linux: Consolidate Linux splice syscall Adhemerval Zanella
@ 2017-05-12 17:58 ` Adhemerval Zanella
2017-05-18 19:25 ` Siddhesh Poyarekar
2017-05-12 17:58 ` [PATCH 05/13] posix: Consolidate Linux sigsuspend implementation Adhemerval Zanella
2017-05-12 18:15 ` [PATCH 01/13] posix: Consolidate Linux pause syscall Florian Weimer
12 siblings, 1 reply; 36+ messages in thread
From: Adhemerval Zanella @ 2017-05-12 17:58 UTC (permalink / raw)
To: libc-alpha
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
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
+ <http://www.gnu.org/licenses/>. */
+
+#include <mqueue.h>
+#include <sysdep-cancel.h>
+
+/* 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
--
2.7.4
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH 13/13] posix: Consolidate Linux mq_timedsend syscall
2017-05-12 17:58 ` [PATCH 13/13] posix: Consolidate Linux mq_timedsend syscall Adhemerval Zanella
@ 2017-05-18 19:25 ` Siddhesh Poyarekar
0 siblings, 0 replies; 36+ messages in thread
From: Siddhesh Poyarekar @ 2017-05-18 19:25 UTC (permalink / raw)
To: Adhemerval Zanella, libc-alpha
On Friday 12 May 2017 11:28 PM, Adhemerval Zanella wrote:
> 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.
LGTM.
Siddhesh
^ permalink raw reply [flat|nested] 36+ messages in thread
* [PATCH 05/13] posix: Consolidate Linux sigsuspend implementation
2017-05-12 17:58 [PATCH 01/13] posix: Consolidate Linux pause syscall Adhemerval Zanella
` (10 preceding siblings ...)
2017-05-12 17:58 ` [PATCH 13/13] posix: Consolidate Linux mq_timedsend syscall Adhemerval Zanella
@ 2017-05-12 17:58 ` Adhemerval Zanella
2017-05-18 19:16 ` Siddhesh Poyarekar
2017-05-12 18:15 ` [PATCH 01/13] posix: Consolidate Linux pause syscall Florian Weimer
12 siblings, 1 reply; 36+ messages in thread
From: Adhemerval Zanella @ 2017-05-12 17:58 UTC (permalink / raw)
To: libc-alpha
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
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 <davidm@cs.arizona.edu>, 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
- <http://www.gnu.org/licenses/>. */
-
-/* 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 <sysdep-cancel.h>
-
-#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
<http://www.gnu.org/licenses/>. */
-#include <errno.h>
#include <signal.h>
-#include <unistd.h>
-
#include <sysdep-cancel.h>
-#include <sys/syscall.h>
/* Change the set of blocked signals to SET,
wait until a signal arrives, and restore the set of blocked signals. */
--
2.7.4
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH 05/13] posix: Consolidate Linux sigsuspend implementation
2017-05-12 17:58 ` [PATCH 05/13] posix: Consolidate Linux sigsuspend implementation Adhemerval Zanella
@ 2017-05-18 19:16 ` Siddhesh Poyarekar
0 siblings, 0 replies; 36+ messages in thread
From: Siddhesh Poyarekar @ 2017-05-18 19:16 UTC (permalink / raw)
To: Adhemerval Zanella, libc-alpha
On Friday 12 May 2017 11:28 PM, Adhemerval Zanella wrote:
> 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.
This is fine.
Siddhesh
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH 01/13] posix: Consolidate Linux pause syscall
2017-05-12 17:58 [PATCH 01/13] posix: Consolidate Linux pause syscall Adhemerval Zanella
` (11 preceding siblings ...)
2017-05-12 17:58 ` [PATCH 05/13] posix: Consolidate Linux sigsuspend implementation Adhemerval Zanella
@ 2017-05-12 18:15 ` Florian Weimer
2017-05-12 18:41 ` Adhemerval Zanella
12 siblings, 1 reply; 36+ messages in thread
From: Florian Weimer @ 2017-05-12 18:15 UTC (permalink / raw)
To: Adhemerval Zanella, libc-alpha
On 05/12/2017 07:58 PM, Adhemerval Zanella wrote:
> +/* 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
I think you can #undef unconditionally, there isn't a warning for that.
+ return SYSCALL_CANCEL (ppoll, 0, 0, 0, 0, 0);
I think some of the arguments should be NULL instead of 0.
I'm not completely sure if an empty ppoll without a timeout has the
required semantics, but I can't think of a reason why it would not work.
Thanks,
Florian
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH 01/13] posix: Consolidate Linux pause syscall
2017-05-12 18:15 ` [PATCH 01/13] posix: Consolidate Linux pause syscall Florian Weimer
@ 2017-05-12 18:41 ` Adhemerval Zanella
0 siblings, 0 replies; 36+ messages in thread
From: Adhemerval Zanella @ 2017-05-12 18:41 UTC (permalink / raw)
To: Florian Weimer, libc-alpha
On 12/05/2017 15:15, Florian Weimer wrote:
> On 05/12/2017 07:58 PM, Adhemerval Zanella wrote:
>> +/* 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
>
> I think you can #undef unconditionally, there isn't a warning for that.
Alright, I will change it.
>
> + return SYSCALL_CANCEL (ppoll, 0, 0, 0, 0, 0);
>
> I think some of the arguments should be NULL instead of 0.
I will change to SYSCALL_CANCEL (ppoll, NULL, 0, NULL, NULL).
>
> I'm not completely sure if an empty ppoll without a timeout has the required semantics, but I can't think of a reason why it would not work.
I though about Linux syscall with similar semantics regarding signals,
but I couldn't find one.
^ permalink raw reply [flat|nested] 36+ messages in thread