unofficial mirror of libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Adhemerval Zanella via Libc-alpha <libc-alpha@sourceware.org>
To: libc-alpha@sourceware.org, Stafford Horne <shorne@gmail.com>
Subject: [PATCH 4/6] linux: Implement pipe in terms of __NR_pipe2
Date: Mon, 22 Nov 2021 15:54:35 -0300	[thread overview]
Message-ID: <20211122185437.1934590-5-adhemerval.zanella@linaro.org> (raw)
In-Reply-To: <20211122185437.1934590-1-adhemerval.zanella@linaro.org>

It removes the arch-specific implementation for alpha, ia64,
mips, sh, and sparc which requires a different kernel ABI
than the usual one.

Checked on x86_64-linux-gnu and with a build for the affected ABIs.
---
 sysdeps/unix/alpha/pipe.S                    | 30 --------------
 sysdeps/unix/mips/pipe.S                     | 31 ---------------
 sysdeps/unix/sysv/linux/alpha/pipe.S         |  1 -
 sysdeps/unix/sysv/linux/ia64/pipe.S          | 36 -----------------
 sysdeps/unix/sysv/linux/mips/pipe.S          |  1 -
 sysdeps/unix/sysv/linux/{generic => }/pipe.c |  5 ++-
 sysdeps/unix/sysv/linux/sh/pipe.S            | 42 --------------------
 sysdeps/unix/sysv/linux/sparc/sparc32/pipe.S | 38 ------------------
 sysdeps/unix/sysv/linux/sparc/sparc64/pipe.S | 39 ------------------
 sysdeps/unix/sysv/linux/syscalls.list        |  1 -
 10 files changed, 3 insertions(+), 221 deletions(-)
 delete mode 100644 sysdeps/unix/alpha/pipe.S
 delete mode 100644 sysdeps/unix/mips/pipe.S
 delete mode 100644 sysdeps/unix/sysv/linux/alpha/pipe.S
 delete mode 100644 sysdeps/unix/sysv/linux/ia64/pipe.S
 delete mode 100644 sysdeps/unix/sysv/linux/mips/pipe.S
 rename sysdeps/unix/sysv/linux/{generic => }/pipe.c (87%)
 delete mode 100644 sysdeps/unix/sysv/linux/sh/pipe.S
 delete mode 100644 sysdeps/unix/sysv/linux/sparc/sparc32/pipe.S
 delete mode 100644 sysdeps/unix/sysv/linux/sparc/sparc64/pipe.S

diff --git a/sysdeps/unix/alpha/pipe.S b/sysdeps/unix/alpha/pipe.S
deleted file mode 100644
index 45944535cd..0000000000
--- a/sysdeps/unix/alpha/pipe.S
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Copyright (C) 1993-2021 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
-   <https://www.gnu.org/licenses/>.  */
-
-/* __pipe is a special syscall since it returns two values.  */
-
-#include <sysdep.h>
-
-PSEUDO (__pipe, pipe, 0)
-	stl	r0, 0(a0)
-	stl	r1, 4(a0)
-	mov	zero, v0
-	ret
-PSEUDO_END(__pipe)
-
-libc_hidden_def (__pipe)
-weak_alias (__pipe, pipe)
diff --git a/sysdeps/unix/mips/pipe.S b/sysdeps/unix/mips/pipe.S
deleted file mode 100644
index 6fbea01d44..0000000000
--- a/sysdeps/unix/mips/pipe.S
+++ /dev/null
@@ -1,31 +0,0 @@
-/* Copyright (C) 1992-2021 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
-   <https://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-
-SYSCALL__ (pipe, 1)
-	/* Plop in the two descriptors.  */
-	sw v0, 0(a0)
-	sw v1, 4(a0)
-
-	/* Go out with a clean status.  */
-	move v0, zero
-	j ra
-PSEUDO_END(__pipe)
-
-libc_hidden_def (__pipe)
-weak_alias (__pipe, pipe)
diff --git a/sysdeps/unix/sysv/linux/alpha/pipe.S b/sysdeps/unix/sysv/linux/alpha/pipe.S
deleted file mode 100644
index 1e7ec1c199..0000000000
--- a/sysdeps/unix/sysv/linux/alpha/pipe.S
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/alpha/pipe.S>
diff --git a/sysdeps/unix/sysv/linux/ia64/pipe.S b/sysdeps/unix/sysv/linux/ia64/pipe.S
deleted file mode 100644
index ffda712920..0000000000
--- a/sysdeps/unix/sysv/linux/ia64/pipe.S
+++ /dev/null
@@ -1,36 +0,0 @@
-/* Copyright (C) 1999-2021 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
-   <https://www.gnu.org/licenses/>.  */
-
-/* __pipe is a special syscall since it returns two values.  */
-
-#include <sysdep.h>
-
-ENTRY(__pipe)
-       .regstk 1,0,0,0
-       DO_CALL (SYS_ify (pipe))
-       cmp.ne p6,p0=-1,r10
-       ;;
-(p6)   st4 [in0]=r8,4
-(p6)   mov ret0=0
-       ;;
-(p6)   st4 [in0]=r9
-(p6)   ret
-       br.cond.spnt.few __syscall_error
-PSEUDO_END(__pipe)
-
-libc_hidden_def (__pipe)
-weak_alias (__pipe, pipe)
diff --git a/sysdeps/unix/sysv/linux/mips/pipe.S b/sysdeps/unix/sysv/linux/mips/pipe.S
deleted file mode 100644
index 1708888da4..0000000000
--- a/sysdeps/unix/sysv/linux/mips/pipe.S
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/mips/pipe.S>
diff --git a/sysdeps/unix/sysv/linux/generic/pipe.c b/sysdeps/unix/sysv/linux/pipe.c
similarity index 87%
rename from sysdeps/unix/sysv/linux/generic/pipe.c
rename to sysdeps/unix/sysv/linux/pipe.c
index a73a4e89fc..c873bed11a 100644
--- a/sysdeps/unix/sysv/linux/generic/pipe.c
+++ b/sysdeps/unix/sysv/linux/pipe.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 2011-2021 Free Software Foundation, Inc.
+/* Create create pipe.  Linux generic version.
+   Copyright (C) 2021 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
@@ -25,7 +26,7 @@
 int
 __pipe (int __pipedes[2])
 {
-  return INLINE_SYSCALL (pipe2, 2, __pipedes, 0);
+  return INLINE_SYSCALL_CALL (pipe2, (int *) __pipedes, 0);
 }
 libc_hidden_def (__pipe)
 weak_alias (__pipe, pipe)
diff --git a/sysdeps/unix/sysv/linux/sh/pipe.S b/sysdeps/unix/sysv/linux/sh/pipe.S
deleted file mode 100644
index 0f3eb16588..0000000000
--- a/sysdeps/unix/sysv/linux/sh/pipe.S
+++ /dev/null
@@ -1,42 +0,0 @@
-/* Copyright (C) 1999-2021 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
-   <https://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-
-ENTRY (__libc_pipe)
-	mov	#+__NR_pipe, r3
-	trapa	#0x10
-	mov     r0, r3
-	mov	#-12, r2
-	shad	r2, r3
-	not	r3, r3			// r1=0 means r0 = -1 to -4095
-	tst	r3, r3			// i.e. error in linux
-	bt	1f
-	mov.l	r0, @r4
-	mov.l	r1, @(4, r4)
-	rts
-	 mov	#0, r0
-1:
-	SYSCALL_ERROR_HANDLER
-.Lpseudo_end:
-	rts
-	 nop
-PSEUDO_END (__libc_pipe)
-
-weak_alias (__libc_pipe, __pipe)
-libc_hidden_def (__pipe)
-weak_alias (__libc_pipe, pipe)
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/pipe.S b/sysdeps/unix/sysv/linux/sparc/sparc32/pipe.S
deleted file mode 100644
index 0fa155fa61..0000000000
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/pipe.S
+++ /dev/null
@@ -1,38 +0,0 @@
-/* Copyright (C) 1997-2021 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
-   <https://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-
-	.text
-	.globl		__syscall_error
-ENTRY(__libc_pipe)
-        mov	%o0, %o2            /* Save PIPEDES. */
-	mov	SYS_ify(pipe),%g1
-	ta	0x10
-	bcc	1f
-	 mov	%o7, %g1
-	call	__syscall_error
-	 mov	%g1, %o7
-1:	st	%o0, [%o2]           /* PIPEDES[0] = %o0; */
-        st	%o1, [%o2 + 4]       /* PIPEDES[1] = %o1; */
-	retl
-	 clr	%o0
-END(__libc_pipe)
-
-weak_alias (__libc_pipe, __pipe)
-libc_hidden_def (__pipe)
-weak_alias (__libc_pipe, pipe)
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/pipe.S b/sysdeps/unix/sysv/linux/sparc/sparc64/pipe.S
deleted file mode 100644
index da6ea71729..0000000000
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/pipe.S
+++ /dev/null
@@ -1,39 +0,0 @@
-/* Copyright (C) 1997-2021 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
-   <https://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-
-	.text
-
-	.globl	__syscall_error
-ENTRY(__libc_pipe)
-	mov	%o0, %o2		/* Save PIPEDES. */
-	LOADSYSCALL(pipe)
-	ta	0x6d
-	bcc,pt	%xcc, 1f
-	 mov	%o7, %g1
-	call	__syscall_error
-	 mov	%g1, %o7
-1:	st	%o0, [%o2]		/* PIPEDES[0] = %o0; */
-	st	%o1, [%o2 + 4]		/* PIPEDES[1] = %o1; */
-	retl
-	 clr	%o0
-END(__libc_pipe)
-
-weak_alias (__libc_pipe, __pipe)
-libc_hidden_def (__pipe)
-weak_alias (__libc_pipe, pipe)
diff --git a/sysdeps/unix/sysv/linux/syscalls.list b/sysdeps/unix/sysv/linux/syscalls.list
index 2acd7551d3..8a32b354a9 100644
--- a/sysdeps/unix/sysv/linux/syscalls.list
+++ b/sysdeps/unix/sysv/linux/syscalls.list
@@ -38,7 +38,6 @@ mount		EXTRA	mount		i:sssUp	__mount	mount
 munlock		-	munlock		i:aU	munlock
 munlockall	-	munlockall	i:	munlockall
 nfsservctl	EXTRA	nfsservctl	i:ipp	__compat_nfsservctl	nfsservctl@GLIBC_2.0:GLIBC_2.28
-pipe		-	pipe		i:f	__pipe		pipe
 pipe2		-	pipe2		i:fi	__pipe2		pipe2
 pivot_root	EXTRA	pivot_root	i:ss	pivot_root
 query_module	EXTRA	query_module	i:sipip	__compat_query_module	query_module@GLIBC_2.0:GLIBC_2.23
-- 
2.32.0


  parent reply	other threads:[~2021-11-22 18:57 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-22 18:54 [PATCH 0/6] linux: Some syscall refactors Adhemerval Zanella via Libc-alpha
2021-11-22 18:54 ` [PATCH 1/6] linux: Add fanotify_mark C implementation Adhemerval Zanella via Libc-alpha
2021-11-24 21:45   ` Stafford Horne via Libc-alpha
2021-11-25 12:55     ` Adhemerval Zanella via Libc-alpha
2021-11-22 18:54 ` [PATCH 2/6] linux: Add prlimit64 " Adhemerval Zanella via Libc-alpha
2021-11-25 23:39   ` Stafford Horne via Libc-alpha
2021-11-30 11:51     ` Adhemerval Zanella via Libc-alpha
2021-11-22 18:54 ` [PATCH 3/6] linux: Implement mremap in C Adhemerval Zanella via Libc-alpha
2021-11-26  0:26   ` Stafford Horne via Libc-alpha
2021-11-30 11:55     ` Adhemerval Zanella via Libc-alpha
2021-11-22 18:54 ` Adhemerval Zanella via Libc-alpha [this message]
2021-11-26 23:03   ` [PATCH 4/6] linux: Implement pipe in terms of __NR_pipe2 Stafford Horne via Libc-alpha
2021-11-30 14:53     ` Adhemerval Zanella via Libc-alpha
2021-11-22 18:54 ` [PATCH 5/6] linux: Add generic syscall implementation Adhemerval Zanella via Libc-alpha
2021-11-22 18:54 ` [PATCH 6/6] linux: Add generic ioctl implementation Adhemerval Zanella via Libc-alpha
2021-12-04  7:50   ` Stafford Horne via Libc-alpha

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/libc/involved.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211122185437.1934590-5-adhemerval.zanella@linaro.org \
    --to=libc-alpha@sourceware.org \
    --cc=adhemerval.zanella@linaro.org \
    --cc=shorne@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).