Message ID | 1494611894-9282-4-git-send-email-adhemerval.zanella@linaro.org |
---|---|
State | New |
Headers | show |
Series | [01/13] posix: Consolidate Linux pause syscall | expand |
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
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
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
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); +}