[04/13] linux: Consolidate Linux tee implementation
Commit Message
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
Comments
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.)
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
@@ -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))"
@@ -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
new file mode 100644
@@ -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);
+}