From owner-freebsd-arch@FreeBSD.ORG Sun Nov 9 19:27:49 2008 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 81656106567E for ; Sun, 9 Nov 2008 19:27:49 +0000 (UTC) (envelope-from ed@hoeg.nl) Received: from palm.hoeg.nl (unknown [IPv6:2001:7b8:613:100::211]) by mx1.freebsd.org (Postfix) with ESMTP id 68A8B8FC08 for ; Sun, 9 Nov 2008 19:27:48 +0000 (UTC) (envelope-from ed@hoeg.nl) Received: by palm.hoeg.nl (Postfix, from userid 1000) id C7E0D1D07E; Sun, 9 Nov 2008 20:27:46 +0100 (CET) Date: Sun, 9 Nov 2008 20:27:46 +0100 From: Ed Schouten To: FreeBSD Arch Message-ID: <20081109192746.GO1165@hoeg.nl> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="zHKSuzk+vZNe6bCt" Content-Disposition: inline User-Agent: Mutt/1.5.18 (2008-05-17) Subject: pipe(2) calling convention: why? X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 Nov 2008 19:27:49 -0000 --zHKSuzk+vZNe6bCt Content-Type: multipart/mixed; boundary="qxmd2aOE9n9J83EO" Content-Disposition: inline --qxmd2aOE9n9J83EO Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hello all, After having a discussion on IRC with some friends of mine about system call conventions, we couldn't exactly determine why pipe(2)'s calling convention has to be different from the rest. Unlike most system calls, pipe(2) has two return values. Instead of just copying out an array of two elements, it uses two registers to store the file descriptor numbers. It seems a lot of BSD-style system calls used to work that way, but pipe(2) seems to be the only system call on FreeBSD that uses this today. Some system calls only seem to set td_retval[1] to zero, which makes little sense to me. Maybe those assignments can be removed. In my opinion there are a couple of disadvantages of having multiple return values: - As documented in syscall(2), there is no way to obtain the second return value if you use this functions. - Each of those system calls needs to have its own implementation written in assembly for each architecture we support. Why can hundreds of system calls be handled in a generic fashion, while interfaces like pipe(2) can't? As a small experiment I've written a patch to allocate a new system call (506) which uses a generic calling convention to implement pipe(2). It seems Linux also uses this method, so I've removed linux_pipe() from the Linuxolator as well, which seems to work. I could commit this if people think it makes sense. Any comments? --=20 Ed Schouten WWW: http://80386.nl/ --qxmd2aOE9n9J83EO Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="pipe.diff" Content-Transfer-Encoding: quoted-printable Index: lib/libc/powerpc/sys/Makefile.inc =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- lib/libc/powerpc/sys/Makefile.inc (revision 184790) +++ lib/libc/powerpc/sys/Makefile.inc (working copy) @@ -1,6 +1,6 @@ # $FreeBSD$ =20 -MDASM+=3D brk.S cerror.S exect.S pipe.S ptrace.S sbrk.S setlogin.S +MDASM+=3D brk.S cerror.S exect.S ptrace.S sbrk.S setlogin.S =20 # Don't generate default code for these syscalls: NOASM=3D break.o exit.o getlogin.o openbsd_poll.o sstk.o yield.o Index: lib/libc/powerpc/sys/pipe.S =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- lib/libc/powerpc/sys/pipe.S (revision 184790) +++ lib/libc/powerpc/sys/pipe.S (working copy) @@ -1,43 +0,0 @@ -/*- - * Copyright (c) 2002 Peter Grehan. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURP= OSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENT= IAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STR= ICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY W= AY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ -/* $NetBSD: pipe.S,v 1.6 2000/09/28 08:38:54 kleink Exp $ */ - -#include -__FBSDID("$FreeBSD$"); - -#include "SYS.h" - -ENTRY(pipe) - mr %r5,%r3 /* save pointer */ - li %r0,SYS_pipe - sc /* r5 is preserved */ - bso 1f - stw %r3,0(%r5) /* success, store fds */ - stw %r4,4(%r5) - li %r3,0 - blr /* and return 0 */ -1: - b PIC_PLT(HIDENAME(cerror)) Index: lib/libc/arm/sys/Makefile.inc =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- lib/libc/arm/sys/Makefile.inc (revision 184790) +++ lib/libc/arm/sys/Makefile.inc (working copy) @@ -1,6 +1,6 @@ # $FreeBSD$ =20 -MDASM=3D Ovfork.S brk.S cerror.S pipe.S ptrace.S sbrk.S shmat.S sigreturn.= S syscall.S +MDASM=3D Ovfork.S brk.S cerror.S ptrace.S sbrk.S shmat.S sigreturn.S sysca= ll.S =20 # Don't generate default code for these syscalls: NOASM=3D break.o exit.o getlogin.o openbsd_poll.o sstk.o vfork.o yield.o Index: lib/libc/arm/sys/pipe.S =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- lib/libc/arm/sys/pipe.S (revision 184790) +++ lib/libc/arm/sys/pipe.S (working copy) @@ -1,50 +0,0 @@ -/* $NetBSD: pipe.S,v 1.5 2003/08/07 16:42:04 agc Exp $ */ - -/*- - * Copyright (c) 1990 The Regents of the University of California. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURP= OSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENT= IAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STR= ICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY W= AY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: @(#)pipe.s 5.1 (Berkeley) 4/23/90 - */ - -#include -__FBSDID("$FreeBSD$"); -#include "SYS.h" - -#ifdef WEAK_ALIAS -WEAK_ALIAS(pipe, _pipe) -WEAK_ALIAS(__sys_pipe, _pipe) -#endif - -ENTRY(_pipe) - mov r2, r0 - SYSTRAP(pipe) - bcs PIC_SYM(CERROR, PLT) - str r0, [r2, #0x0000] - str r1, [r2, #0x0004] - mov r0, #0x00000000 - RET Index: lib/libc/sparc64/sys/Makefile.inc =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- lib/libc/sparc64/sys/Makefile.inc (revision 184790) +++ lib/libc/sparc64/sys/Makefile.inc (working copy) @@ -15,7 +15,7 @@ CFLAGS+=3D -DSUN4V .endif =20 -MDASM+=3D brk.S cerror.S exect.S pipe.S ptrace.S sbrk.S setlogin.S sigacti= on.S +MDASM+=3D brk.S cerror.S exect.S ptrace.S sbrk.S setlogin.S sigaction.S =20 # Don't generate default code for these syscalls: NOASM=3D break.o exit.o getlogin.o openbsd_poll.o sstk.o yield.o Index: lib/libc/sparc64/sys/pipe.S =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- lib/libc/sparc64/sys/pipe.S (revision 184790) +++ lib/libc/sparc64/sys/pipe.S (working copy) @@ -1,57 +0,0 @@ -/* - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This software was developed by the Computer Systems Engineering group - * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and - * contributed to Berkeley. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURP= OSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENT= IAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STR= ICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY W= AY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: Header: pipe.s,v 1.1 91/07/06 13:05:58 torek Exp - */ - -#if defined(SYSLIBC_SCCS) && !defined(lint) - .asciz "@(#)pipe.s 8.1 (Berkeley) 6/4/93" -#if 0 - RCSID("$NetBSD: pipe.S,v 1.3 2000/09/28 08:38:55 kleink Exp $") -#endif -#endif /* SYSLIBC_SCCS and not lint */ -#include -__FBSDID("$FreeBSD$"); - -#include "SYS.h" - -_SYSENTRY(pipe) - mov %o0, %o2 - mov SYS_pipe, %g1 - ta %xcc, ST_SYSCALL - bcc,a,pt %xcc, 1f - stw %o0, [%o2] - ERROR() -1: stw %o1, [%o2 + 4] - retl - clr %o0 -_SYSEND(pipe) Index: lib/libc/ia64/sys/Makefile.inc =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- lib/libc/ia64/sys/Makefile.inc (revision 184790) +++ lib/libc/ia64/sys/Makefile.inc (working copy) @@ -1,6 +1,6 @@ # $FreeBSD$ =20 -MDASM+=3D Ovfork.S brk.S cerror.S exect.S fork.S getcontext.S pipe.S ptrac= e.S \ +MDASM+=3D Ovfork.S brk.S cerror.S exect.S fork.S getcontext.S ptrace.S \ sbrk.S setlogin.S sigreturn.S swapcontext.S =20 # Don't generate default code for these syscalls: Index: lib/libc/ia64/sys/pipe.S =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- lib/libc/ia64/sys/pipe.S (revision 184790) +++ lib/libc/ia64/sys/pipe.S (working copy) @@ -1,47 +0,0 @@ -/* $NetBSD: pipe.S,v 1.1 1995/02/10 17:50:35 cgd Exp $ */ - -/* - * Copyright (c) 1994, 1995 Carnegie-Mellon University. - * All rights reserved. - * - * Author: Chris G. Demetriou - *=20 - * Permission to use, copy, modify and distribute this software and - * its documentation is hereby granted, provided that both the copyright - * notice and this permission notice appear in all copies of the - * software, derivative works or modified versions, and any portions - * thereof, and that both notices appear in supporting documentation. - *=20 - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"=20 - * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND=20 - * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - *=20 - * Carnegie Mellon requests users of this software to return to - * - * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU - * School of Computer Science - * Carnegie Mellon University - * Pittsburgh PA 15213-3890 - * - * any improvements or extensions that they make and grant Carnegie the - * rights to redistribute these changes. - */ - -#include -__FBSDID("$FreeBSD$"); - -#include "SYS.h" - -ENTRY(__sys_pipe, 1) - WEAK_ALIAS(pipe, __sys_pipe) - WEAK_ALIAS(_pipe, __sys_pipe) - st8 [sp]=3Dr32 - CALLSYS_ERROR(pipe) - ld8 r14=3D[sp] - ;; - st4 [r14]=3Dret0,4 - ;; - st4 [r14]=3Dret1 - mov ret0=3D0 - br.ret.sptk.few rp -END(__sys_pipe) Index: lib/libc/mips/sys/Makefile.inc =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- lib/libc/mips/sys/Makefile.inc (revision 184790) +++ lib/libc/mips/sys/Makefile.inc (working copy) @@ -1,7 +1,7 @@ # $FreeBSD$ =20 MDASM=3D Ovfork.S brk.S cerror.S exect.S \ - fork.S pipe.S ptrace.S sbrk.S shmat.S syscall.S + fork.S ptrace.S sbrk.S shmat.S syscall.S =20 # Don't generate default code for these syscalls: NOASM=3D break.o exit.o ftruncate.o getlogin.o lseek.o mmap.o \ Index: lib/libc/mips/sys/pipe.S =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- lib/libc/mips/sys/pipe.S (revision 184790) +++ lib/libc/mips/sys/pipe.S (working copy) @@ -1,62 +0,0 @@ -/* $NetBSD: pipe.S,v 1.11 2005/04/22 06:58:01 simonb Exp $ */ - -/*- - * Copyright (c) 1991, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Ralph Campbell. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURP= OSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENT= IAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STR= ICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY W= AY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include -__FBSDID("$FreeBSD$"); -#include "SYS.h" - -#if defined(LIBC_SCCS) && !defined(lint) - ASMSTR("from: @(#)pipe.s 8.1 (Berkeley) 6/4/93") - ASMSTR("$NetBSD: pipe.S,v 1.11 2005/04/22 06:58:01 simonb Exp $") -#endif /* LIBC_SCCS and not lint */ - -LEAF(__sys_pipe) - WEAK_ALIAS(pipe, __sys_pipe) - WEAK_ALIAS(_pipe, __sys_pipe) -#ifdef __ABICALLS__ - .set noreorder - .cpload t9 - .set reorder -#endif - li v0, SYS_pipe # pipe(fildes) int fildes[2]; - syscall - bne a3, zero, 1f - sw v0, 0(a0) # store the two file descriptors - sw v1, 4(a0) - move v0, zero - j ra -1: - la t9, _C_LABEL(__cerror) - jr t9 -END(__sys_pipe) Index: lib/libc/i386/sys/Makefile.inc =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- lib/libc/i386/sys/Makefile.inc (revision 184790) +++ lib/libc/i386/sys/Makefile.inc (working copy) @@ -8,7 +8,7 @@ SRCS+=3D i386_get_fsbase.c i386_get_gsbase.c i386_get_ldt.c \ i386_set_fsbase.c i386_set_gsbase.c i386_set_ldt.c =20 -MDASM=3D Ovfork.S brk.S cerror.S exect.S getcontext.S pipe.S ptrace.S \ +MDASM=3D Ovfork.S brk.S cerror.S exect.S getcontext.S ptrace.S \ reboot.S sbrk.S setlogin.S sigreturn.S syscall.S =20 # Don't generate default code for these syscalls: Index: lib/libc/i386/sys/pipe.S =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- lib/libc/i386/sys/pipe.S (revision 184790) +++ lib/libc/i386/sys/pipe.S (working copy) @@ -1,47 +0,0 @@ -/*- - * Copyright (c) 1990 The Regents of the University of California. - * All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * William Jolitz. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURP= OSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENT= IAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STR= ICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY W= AY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#if defined(SYSLIBC_SCCS) && !defined(lint) - .asciz "@(#)pipe.s 5.1 (Berkeley) 4/23/90" -#endif /* SYSLIBC_SCCS and not lint */ -#include -__FBSDID("$FreeBSD$"); - -#include "SYS.h" - -SYSCALL(pipe) - movl 4(%esp),%ecx - movl %eax,(%ecx) - movl %edx,4(%ecx) - movl $0,%eax - ret -END(pipe) Index: lib/libc/amd64/sys/Makefile.inc =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- lib/libc/amd64/sys/Makefile.inc (revision 184790) +++ lib/libc/amd64/sys/Makefile.inc (working copy) @@ -3,7 +3,7 @@ =20 SRCS+=3D amd64_get_fsbase.c amd64_get_gsbase.c amd64_set_fsbase.c amd64_se= t_gsbase.c =20 -MDASM=3D vfork.S brk.S cerror.S exect.S getcontext.S pipe.S ptrace.S \ +MDASM=3D vfork.S brk.S cerror.S exect.S getcontext.S ptrace.S \ reboot.S sbrk.S setlogin.S sigreturn.S =20 # Don't generate default code for these syscalls: Index: lib/libc/amd64/sys/pipe.S =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- lib/libc/amd64/sys/pipe.S (revision 184790) +++ lib/libc/amd64/sys/pipe.S (working copy) @@ -1,60 +0,0 @@ -/*- - * Copyright (c) 1990 The Regents of the University of California. - * All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * William Jolitz. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURP= OSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENT= IAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STR= ICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY W= AY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#if defined(SYSLIBC_SCCS) && !defined(lint) - .asciz "@(#)pipe.s 5.1 (Berkeley) 4/23/90" -#endif /* SYSLIBC_SCCS and not lint */ -#include -__FBSDID("$FreeBSD$"); - -#include "SYS.h" - - .weak _pipe - .set _pipe,__sys_pipe - .weak pipe - .set pipe,__sys_pipe -ENTRY(__sys_pipe) - mov $SYS_pipe,%rax - KERNCALL - jb 1f - movl %eax,(%rdi) /* %rdi is preserved by syscall */ - movl %edx,4(%rdi) - movq $0,%rax - ret -1: -#ifdef PIC - movq PIC_GOT(HIDENAME(cerror)),%rdx - jmp *%rdx -#else - jmp HIDENAME(cerror) -#endif -END(__sys_pipe) Index: lib/libc/sys/syscall.2 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- lib/libc/sys/syscall.2 (revision 184790) +++ lib/libc/sys/syscall.2 (working copy) @@ -72,6 +72,4 @@ function appeared in .Bx 4.0 . .Sh BUGS -There is no way to simulate system calls that have multiple return values -such as -.Xr pipe 2 . +There is no way to simulate system calls that have multiple return values. Index: lib/libc/sys/pipe.2 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- lib/libc/sys/pipe.2 (revision 184790) +++ lib/libc/sys/pipe.2 (working copy) @@ -39,7 +39,7 @@ .Sh SYNOPSIS .In unistd.h .Ft int -.Fn pipe "int *fildes" +.Fn pipe "int fildes[2]" .Sh DESCRIPTION The .Fn pipe Index: sys/kern/init_sysent.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- sys/kern/init_sysent.c (revision 184790) +++ sys/kern/init_sysent.c (working copy) @@ -70,7 +70,7 @@ { 0, (sy_call_t *)getppid, AUE_GETPPID, NULL, 0, 0 }, /* 39 =3D getppid = */ { compat(AS(olstat_args),lstat), AUE_LSTAT, NULL, 0, 0 }, /* 40 =3D old l= stat */ { AS(dup_args), (sy_call_t *)dup, AUE_DUP, NULL, 0, 0 }, /* 41 =3D dup */ - { 0, (sy_call_t *)pipe, AUE_PIPE, NULL, 0, 0 }, /* 42 =3D pipe */ + { 0, (sy_call_t *)freebsd7_pipe, AUE_PIPE, NULL, 0, 0 }, /* 42 =3D freebs= d7_pipe */ { 0, (sy_call_t *)getegid, AUE_GETEGID, NULL, 0, 0 }, /* 43 =3D getegid = */ { AS(profil_args), (sy_call_t *)profil, AUE_PROFILE, NULL, 0, 0 }, /* 44 = =3D profil */ { AS(ktrace_args), (sy_call_t *)ktrace, AUE_KTRACE, NULL, 0, 0 }, /* 45 = =3D ktrace */ @@ -534,4 +534,5 @@ { AS(unlinkat_args), (sy_call_t *)unlinkat, AUE_UNLINKAT, NULL, 0, 0 }, /= * 503 =3D unlinkat */ { AS(posix_openpt_args), (sy_call_t *)posix_openpt, AUE_POSIX_OPENPT, NUL= L, 0, 0 }, /* 504 =3D posix_openpt */ { AS(gssd_syscall_args), (sy_call_t *)lkmressys, AUE_NULL, NULL, 0, 0 }, = /* 505 =3D gssd_syscall */ + { AS(pipe_args), (sy_call_t *)pipe, AUE_PIPE, NULL, 0, 0 }, /* 506 =3D pi= pe */ }; Index: sys/kern/sys_pipe.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- sys/kern/sys_pipe.c (revision 184790) +++ sys/kern/sys_pipe.c (working copy) @@ -110,6 +110,7 @@ #include #include #include +#include #include #include #include @@ -307,13 +308,8 @@ * The pipe system call for the DTYPE_PIPE type of pipes. If we fail, let * the zone pick up the pieces via pipeclose(). */ -/* ARGSUSED */ -int -pipe(td, uap) - struct thread *td; - struct pipe_args /* { - int dummy; - } */ *uap; +static int +kern_pipe(struct thread *td, int fildes[2]) { struct filedesc *fdp =3D td->td_proc->p_fd; struct file *rf, *wf; @@ -357,7 +353,7 @@ return (error); } /* An extra reference on `rf' has been held for us by falloc(). */ - td->td_retval[0] =3D fd; + fildes[0] =3D fd; =20 /* * Warning: once we've gotten past allocation of the fd for the @@ -368,7 +364,7 @@ finit(rf, FREAD | FWRITE, DTYPE_PIPE, rpipe, &pipeops); error =3D falloc(td, &wf, &fd); if (error) { - fdclose(fdp, rf, td->td_retval[0], td); + fdclose(fdp, rf, fildes[0], td); fdrop(rf, td); /* rpipe has been closed by fdrop(). */ pipeclose(wpipe); @@ -377,12 +373,48 @@ /* An extra reference on `wf' has been held for us by falloc(). */ finit(wf, FREAD | FWRITE, DTYPE_PIPE, wpipe, &pipeops); fdrop(wf, td); - td->td_retval[1] =3D fd; + fildes[1] =3D fd; fdrop(rf, td); =20 return (0); } =20 +int +pipe(struct thread *td, struct pipe_args *uap) +{ + int error; + int fildes[2]; + + error =3D kern_pipe(td, fildes); + if (error) + return (error); +=09 + error =3D copyout(fildes, uap->fildes, sizeof fildes); + if (error) { + /* XXX: Close descriptors. */ + return (error); + } + + return (0); +} + +/* ARGSUSED */ +int +freebsd7_pipe(struct thread *td, struct freebsd7_pipe_args *uap) +{ + int error; + int fildes[2]; + + error =3D kern_pipe(td, fildes); + if (error) + return (error); +=09 + td->td_retval[0] =3D fildes[0]; + td->td_retval[1] =3D fildes[1]; + + return (0); +} + /* * Allocate kva for pipe circular buffer, the space is pageable * This routine will 'realloc' the size of a pipe safely, if it fails Index: sys/kern/syscalls.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- sys/kern/syscalls.c (revision 184790) +++ sys/kern/syscalls.c (working copy) @@ -49,7 +49,7 @@ "getppid", /* 39 =3D getppid */ "compat.lstat", /* 40 =3D old lstat */ "dup", /* 41 =3D dup */ - "pipe", /* 42 =3D pipe */ + "freebsd7_pipe", /* 42 =3D freebsd7_pipe */ "getegid", /* 43 =3D getegid */ "profil", /* 44 =3D profil */ "ktrace", /* 45 =3D ktrace */ @@ -513,4 +513,5 @@ "unlinkat", /* 503 =3D unlinkat */ "posix_openpt", /* 504 =3D posix_openpt */ "gssd_syscall", /* 505 =3D gssd_syscall */ + "pipe", /* 506 =3D pipe */ }; Index: sys/kern/syscalls.master =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- sys/kern/syscalls.master (revision 184790) +++ sys/kern/syscalls.master (working copy) @@ -121,7 +121,7 @@ 39 AUE_GETPPID STD { pid_t getppid(void); } 40 AUE_LSTAT COMPAT { int lstat(char *path, struct ostat *ub); } 41 AUE_DUP STD { int dup(u_int fd); } -42 AUE_PIPE STD { int pipe(void); } +42 AUE_PIPE STD { int freebsd7_pipe(void); } 43 AUE_GETEGID STD { gid_t getegid(void); } 44 AUE_PROFILE STD { int profil(caddr_t samples, size_t size, \ size_t offset, u_int scale); } @@ -897,5 +897,6 @@ 504 AUE_POSIX_OPENPT STD { int posix_openpt(int flags); } ; 505 is initialised by the kgssapi code, if present. 505 AUE_NULL NOSTD { int gssd_syscall(char *path); } +506 AUE_PIPE STD { int pipe(int *fildes); } ; Please copy any additions and changes to the following compatability tab= les: ; sys/compat/freebsd32/syscalls.master Index: sys/kern/systrace_args.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- sys/kern/systrace_args.c (revision 184790) +++ sys/kern/systrace_args.c (working copy) @@ -290,7 +290,7 @@ *n_args =3D 1; break; } - /* pipe */ + /* freebsd7_pipe */ case 42: { *n_args =3D 0; break; @@ -3040,6 +3040,13 @@ *n_args =3D 1; break; } + /* pipe */ + case 506: { + struct pipe_args *p =3D params; + uarg[0] =3D (intptr_t) p->fildes; /* int * */ + *n_args =3D 1; + break; + } default: *n_args =3D 0; break; @@ -3484,7 +3491,7 @@ break; }; break; - /* pipe */ + /* freebsd7_pipe */ case 42: break; /* getegid */ @@ -8070,6 +8077,16 @@ break; }; break; + /* pipe */ + case 506: + switch(ndx) { + case 0: + p =3D "int *"; + break; + default: + break; + }; + break; default: break; }; Index: sys/compat/freebsd32/freebsd32_syscall.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- sys/compat/freebsd32/freebsd32_syscall.h (revision 184790) +++ sys/compat/freebsd32/freebsd32_syscall.h (working copy) @@ -46,7 +46,7 @@ #define FREEBSD32_SYS_kill 37 #define FREEBSD32_SYS_getppid 39 #define FREEBSD32_SYS_dup 41 -#define FREEBSD32_SYS_pipe 42 +#define FREEBSD32_SYS_freebsd7_pipe 42 #define FREEBSD32_SYS_getegid 43 #define FREEBSD32_SYS_profil 44 #define FREEBSD32_SYS_ktrace 45 @@ -356,4 +356,5 @@ #define FREEBSD32_SYS_symlinkat 502 #define FREEBSD32_SYS_unlinkat 503 #define FREEBSD32_SYS_posix_openpt 504 -#define FREEBSD32_SYS_MAXSYSCALL 506 +#define FREEBSD32_SYS_pipe 506 +#define FREEBSD32_SYS_MAXSYSCALL 507 Index: sys/compat/freebsd32/freebsd32_sysent.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- sys/compat/freebsd32/freebsd32_sysent.c (revision 184790) +++ sys/compat/freebsd32/freebsd32_sysent.c (working copy) @@ -80,7 +80,7 @@ { 0, (sy_call_t *)getppid, AUE_GETPPID, NULL, 0, 0 }, /* 39 =3D getppid = */ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 40 =3D olstat */ { AS(dup_args), (sy_call_t *)dup, AUE_DUP, NULL, 0, 0 }, /* 41 =3D dup */ - { 0, (sy_call_t *)pipe, AUE_PIPE, NULL, 0, 0 }, /* 42 =3D pipe */ + { 0, (sy_call_t *)freebsd7_pipe, AUE_PIPE, NULL, 0, 0 }, /* 42 =3D freebs= d7_pipe */ { 0, (sy_call_t *)getegid, AUE_GETEGID, NULL, 0, 0 }, /* 43 =3D getegid = */ { AS(profil_args), (sy_call_t *)profil, AUE_PROFILE, NULL, 0, 0 }, /* 44 = =3D profil */ { AS(ktrace_args), (sy_call_t *)ktrace, AUE_KTRACE, NULL, 0, 0 }, /* 45 = =3D ktrace */ @@ -544,4 +544,5 @@ { AS(unlinkat_args), (sy_call_t *)unlinkat, AUE_UNLINKAT, NULL, 0, 0 }, /= * 503 =3D unlinkat */ { AS(posix_openpt_args), (sy_call_t *)posix_openpt, AUE_POSIX_OPENPT, NUL= L, 0, 0 }, /* 504 =3D posix_openpt */ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 505 =3D gssd_syscal= l */ + { AS(pipe_args), (sy_call_t *)pipe, AUE_PIPE, NULL, 0, 0 }, /* 506 =3D pi= pe */ }; Index: sys/compat/freebsd32/syscalls.master =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- sys/compat/freebsd32/syscalls.master (revision 184790) +++ sys/compat/freebsd32/syscalls.master (working copy) @@ -114,7 +114,7 @@ 39 AUE_GETPPID NOPROTO { pid_t getppid(void); } 40 AUE_LSTAT UNIMPL olstat 41 AUE_DUP NOPROTO { int dup(u_int fd); } -42 AUE_PIPE NOPROTO { int pipe(void); } +42 AUE_PIPE NOPROTO { int freebsd7_pipe(void); } 43 AUE_GETEGID NOPROTO { gid_t getegid(void); } 44 AUE_PROFILE NOPROTO { int profil(caddr_t samples, size_t size, \ size_t offset, u_int scale); } @@ -854,3 +854,4 @@ 504 AUE_POSIX_OPENPT NOPROTO { int posix_openpt(int flags); } ; 505 is initialised by the kgssapi code, if present. 505 AUE_NULL UNIMPL gssd_syscall +506 AUE_PIPE NOPROTO { int pipe(int *fildes); } Index: sys/compat/freebsd32/freebsd32_syscalls.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- sys/compat/freebsd32/freebsd32_syscalls.c (revision 184790) +++ sys/compat/freebsd32/freebsd32_syscalls.c (working copy) @@ -49,7 +49,7 @@ "getppid", /* 39 =3D getppid */ "#40", /* 40 =3D olstat */ "dup", /* 41 =3D dup */ - "pipe", /* 42 =3D pipe */ + "freebsd7_pipe", /* 42 =3D freebsd7_pipe */ "getegid", /* 43 =3D getegid */ "profil", /* 44 =3D profil */ "ktrace", /* 45 =3D ktrace */ @@ -513,4 +513,5 @@ "unlinkat", /* 503 =3D unlinkat */ "posix_openpt", /* 504 =3D posix_openpt */ "#505", /* 505 =3D gssd_syscall */ + "pipe", /* 506 =3D pipe */ }; Index: sys/i386/linux/linux_syscall.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- sys/i386/linux/linux_syscall.h (revision 184790) +++ sys/i386/linux/linux_syscall.h (working copy) @@ -43,7 +43,7 @@ #define LINUX_SYS_linux_mkdir 39 #define LINUX_SYS_linux_rmdir 40 #define LINUX_SYS_dup 41 -#define LINUX_SYS_linux_pipe 42 +#define LINUX_SYS_pipe 42 #define LINUX_SYS_linux_times 43 #define LINUX_SYS_linux_brk 45 #define LINUX_SYS_linux_setgid16 46 Index: sys/i386/linux/linux_sysent.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- sys/i386/linux/linux_sysent.c (revision 184790) +++ sys/i386/linux/linux_sysent.c (working copy) @@ -60,7 +60,7 @@ { AS(linux_mkdir_args), (sy_call_t *)linux_mkdir, AUE_MKDIR, NULL, 0, 0 }= , /* 39 =3D linux_mkdir */ { AS(linux_rmdir_args), (sy_call_t *)linux_rmdir, AUE_RMDIR, NULL, 0, 0 }= , /* 40 =3D linux_rmdir */ { AS(dup_args), (sy_call_t *)dup, AUE_DUP, NULL, 0, 0 }, /* 41 =3D dup */ - { AS(linux_pipe_args), (sy_call_t *)linux_pipe, AUE_PIPE, NULL, 0, 0 }, /= * 42 =3D linux_pipe */ + { AS(pipe_args), (sy_call_t *)pipe, AUE_PIPE, NULL, 0, 0 }, /* 42 =3D pip= e */ { AS(linux_times_args), (sy_call_t *)linux_times, AUE_NULL, NULL, 0, 0 },= /* 43 =3D linux_times */ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 44 =3D prof */ { AS(linux_brk_args), (sy_call_t *)linux_brk, AUE_NULL, NULL, 0, 0 }, /* = 45 =3D linux_brk */ Index: sys/i386/linux/syscalls.master =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- sys/i386/linux/syscalls.master (revision 184790) +++ sys/i386/linux/syscalls.master (working copy) @@ -95,7 +95,7 @@ 39 AUE_MKDIR STD { int linux_mkdir(char *path, l_int mode); } 40 AUE_RMDIR STD { int linux_rmdir(char *path); } 41 AUE_DUP NOPROTO { int dup(u_int fd); } -42 AUE_PIPE STD { int linux_pipe(l_ulong *pipefds); } +42 AUE_PIPE NOPROTO { int pipe(int *fildes); } 43 AUE_NULL STD { int linux_times(struct l_times_argv *buf); } 44 AUE_NULL UNIMPL prof 45 AUE_NULL STD { int linux_brk(l_ulong dsend); } Index: sys/i386/linux/linux_machdep.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- sys/i386/linux/linux_machdep.c (revision 184790) +++ sys/i386/linux/linux_machdep.c (working copy) @@ -810,35 +810,6 @@ } =20 int -linux_pipe(struct thread *td, struct linux_pipe_args *args) -{ - int error; - int reg_edx; - -#ifdef DEBUG - if (ldebug(pipe)) - printf(ARGS(pipe, "*")); -#endif - - reg_edx =3D td->td_retval[1]; - error =3D pipe(td, 0); - if (error) { - td->td_retval[1] =3D reg_edx; - return (error); - } - - error =3D copyout(td->td_retval, args->pipefds, 2*sizeof(int)); - if (error) { - td->td_retval[1] =3D reg_edx; - return (error); - } - - td->td_retval[1] =3D reg_edx; - td->td_retval[0] =3D 0; - return (0); -} - -int linux_ioperm(struct thread *td, struct linux_ioperm_args *args) { int error; Index: sys/i386/linux/linux_proto.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- sys/i386/linux/linux_proto.h (revision 184790) +++ sys/i386/linux/linux_proto.h (working copy) @@ -155,9 +155,6 @@ struct linux_rmdir_args { char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)]; }; -struct linux_pipe_args { - char pipefds_l_[PADL_(l_ulong *)]; l_ulong * pipefds; char pipefds_r_[PAD= R_(l_ulong *)]; -}; struct linux_times_args { char buf_l_[PADL_(struct l_times_argv *)]; struct l_times_argv * buf; cha= r buf_r_[PADR_(struct l_times_argv *)]; }; @@ -1044,7 +1041,6 @@ int linux_rename(struct thread *, struct linux_rename_args *); int linux_mkdir(struct thread *, struct linux_mkdir_args *); int linux_rmdir(struct thread *, struct linux_rmdir_args *); -int linux_pipe(struct thread *, struct linux_pipe_args *); int linux_times(struct thread *, struct linux_times_args *); int linux_brk(struct thread *, struct linux_brk_args *); int linux_setgid16(struct thread *, struct linux_setgid16_args *); @@ -1308,7 +1304,6 @@ #define LINUX_SYS_AUE_linux_rename AUE_RENAME #define LINUX_SYS_AUE_linux_mkdir AUE_MKDIR #define LINUX_SYS_AUE_linux_rmdir AUE_RMDIR -#define LINUX_SYS_AUE_linux_pipe AUE_PIPE #define LINUX_SYS_AUE_linux_times AUE_NULL #define LINUX_SYS_AUE_linux_brk AUE_NULL #define LINUX_SYS_AUE_linux_setgid16 AUE_SETGID Index: sys/amd64/linux32/linux32_syscall.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- sys/amd64/linux32/linux32_syscall.h (revision 184790) +++ sys/amd64/linux32/linux32_syscall.h (working copy) @@ -42,7 +42,7 @@ #define LINUX_SYS_linux_mkdir 39 #define LINUX_SYS_linux_rmdir 40 #define LINUX_SYS_dup 41 -#define LINUX_SYS_linux_pipe 42 +#define LINUX_SYS_pipe 42 #define LINUX_SYS_linux_times 43 #define LINUX_SYS_linux_brk 45 #define LINUX_SYS_linux_setgid16 46 Index: sys/amd64/linux32/linux32_machdep.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- sys/amd64/linux32/linux32_machdep.c (revision 184790) +++ sys/amd64/linux32/linux32_machdep.c (working copy) @@ -975,38 +975,6 @@ } =20 int -linux_pipe(struct thread *td, struct linux_pipe_args *args) -{ - int pip[2]; - int error; - register_t reg_rdx; - -#ifdef DEBUG - if (ldebug(pipe)) - printf(ARGS(pipe, "*")); -#endif - - reg_rdx =3D td->td_retval[1]; - error =3D pipe(td, 0); - if (error) { - td->td_retval[1] =3D reg_rdx; - return (error); - } - - pip[0] =3D td->td_retval[0]; - pip[1] =3D td->td_retval[1]; - error =3D copyout(pip, args->pipefds, 2 * sizeof(int)); - if (error) { - td->td_retval[1] =3D reg_rdx; - return (error); - } - - td->td_retval[1] =3D reg_rdx; - td->td_retval[0] =3D 0; - return (0); -} - -int linux_sigaction(struct thread *td, struct linux_sigaction_args *args) { l_osigaction_t osa; Index: sys/amd64/linux32/syscalls.master =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- sys/amd64/linux32/syscalls.master (revision 184790) +++ sys/amd64/linux32/syscalls.master (working copy) @@ -95,7 +95,7 @@ 39 AUE_MKDIR STD { int linux_mkdir(char *path, l_int mode); } 40 AUE_RMDIR STD { int linux_rmdir(char *path); } 41 AUE_DUP NOPROTO { int dup(u_int fd); } -42 AUE_PIPE STD { int linux_pipe(l_ulong *pipefds); } +42 AUE_PIPE NOPROTO { int pipe(int *fildes); } 43 AUE_NULL STD { int linux_times(struct l_times_argv *buf); } 44 AUE_NULL UNIMPL prof 45 AUE_NULL STD { int linux_brk(l_ulong dsend); } Index: sys/amd64/linux32/linux32_sysent.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- sys/amd64/linux32/linux32_sysent.c (revision 184790) +++ sys/amd64/linux32/linux32_sysent.c (working copy) @@ -61,7 +61,7 @@ { AS(linux_mkdir_args), (sy_call_t *)linux_mkdir, AUE_MKDIR, NULL, 0, 0 }= , /* 39 =3D linux_mkdir */ { AS(linux_rmdir_args), (sy_call_t *)linux_rmdir, AUE_RMDIR, NULL, 0, 0 }= , /* 40 =3D linux_rmdir */ { AS(dup_args), (sy_call_t *)dup, AUE_DUP, NULL, 0, 0 }, /* 41 =3D dup */ - { AS(linux_pipe_args), (sy_call_t *)linux_pipe, AUE_PIPE, NULL, 0, 0 }, /= * 42 =3D linux_pipe */ + { AS(pipe_args), (sy_call_t *)pipe, AUE_PIPE, NULL, 0, 0 }, /* 42 =3D pip= e */ { AS(linux_times_args), (sy_call_t *)linux_times, AUE_NULL, NULL, 0, 0 },= /* 43 =3D linux_times */ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 44 =3D prof */ { AS(linux_brk_args), (sy_call_t *)linux_brk, AUE_NULL, NULL, 0, 0 }, /* = 45 =3D linux_brk */ Index: sys/amd64/linux32/linux32_proto.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- sys/amd64/linux32/linux32_proto.h (revision 184790) +++ sys/amd64/linux32/linux32_proto.h (working copy) @@ -151,9 +151,6 @@ struct linux_rmdir_args { char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)]; }; -struct linux_pipe_args { - char pipefds_l_[PADL_(l_ulong *)]; l_ulong * pipefds; char pipefds_r_[PAD= R_(l_ulong *)]; -}; struct linux_times_args { char buf_l_[PADL_(struct l_times_argv *)]; struct l_times_argv * buf; cha= r buf_r_[PADR_(struct l_times_argv *)]; }; @@ -1024,7 +1021,6 @@ int linux_rename(struct thread *, struct linux_rename_args *); int linux_mkdir(struct thread *, struct linux_mkdir_args *); int linux_rmdir(struct thread *, struct linux_rmdir_args *); -int linux_pipe(struct thread *, struct linux_pipe_args *); int linux_times(struct thread *, struct linux_times_args *); int linux_brk(struct thread *, struct linux_brk_args *); int linux_setgid16(struct thread *, struct linux_setgid16_args *); @@ -1287,7 +1283,6 @@ #define LINUX_SYS_AUE_linux_rename AUE_RENAME #define LINUX_SYS_AUE_linux_mkdir AUE_MKDIR #define LINUX_SYS_AUE_linux_rmdir AUE_RMDIR -#define LINUX_SYS_AUE_linux_pipe AUE_PIPE #define LINUX_SYS_AUE_linux_times AUE_NULL #define LINUX_SYS_AUE_linux_brk AUE_NULL #define LINUX_SYS_AUE_linux_setgid16 AUE_SETGID Index: sys/sys/syscall.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- sys/sys/syscall.h (revision 184790) +++ sys/sys/syscall.h (working copy) @@ -48,7 +48,7 @@ #define SYS_getppid 39 /* 40 is old lstat */ #define SYS_dup 41 -#define SYS_pipe 42 +#define SYS_freebsd7_pipe 42 #define SYS_getegid 43 #define SYS_profil 44 #define SYS_ktrace 45 @@ -421,4 +421,5 @@ #define SYS_unlinkat 503 #define SYS_posix_openpt 504 #define SYS_gssd_syscall 505 -#define SYS_MAXSYSCALL 506 +#define SYS_pipe 506 +#define SYS_MAXSYSCALL 507 Index: sys/sys/syscall.mk =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- sys/sys/syscall.mk (revision 184790) +++ sys/sys/syscall.mk (working copy) @@ -40,7 +40,7 @@ kill.o \ getppid.o \ dup.o \ - pipe.o \ + freebsd7_pipe.o \ getegid.o \ profil.o \ ktrace.o \ @@ -369,4 +369,5 @@ symlinkat.o \ unlinkat.o \ posix_openpt.o \ - gssd_syscall.o + gssd_syscall.o \ + pipe.o Index: sys/sys/sysproto.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- sys/sys/sysproto.h (revision 184790) +++ sys/sys/sysproto.h (working copy) @@ -181,7 +181,7 @@ struct dup_args { char fd_l_[PADL_(u_int)]; u_int fd; char fd_r_[PADR_(u_int)]; }; -struct pipe_args { +struct freebsd7_pipe_args { register_t dummy; }; struct getegid_args { @@ -1625,6 +1625,9 @@ struct gssd_syscall_args { char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)]; }; +struct pipe_args { + char fildes_l_[PADL_(int *)]; int * fildes; char fildes_r_[PADR_(int *)]; +}; int nosys(struct thread *, struct nosys_args *); void sys_exit(struct thread *, struct sys_exit_args *); int fork(struct thread *, struct fork_args *); @@ -1661,7 +1664,7 @@ int kill(struct thread *, struct kill_args *); int getppid(struct thread *, struct getppid_args *); int dup(struct thread *, struct dup_args *); -int pipe(struct thread *, struct pipe_args *); +int freebsd7_pipe(struct thread *, struct freebsd7_pipe_args *); int getegid(struct thread *, struct getegid_args *); int profil(struct thread *, struct profil_args *); int ktrace(struct thread *, struct ktrace_args *); @@ -1979,6 +1982,7 @@ int unlinkat(struct thread *, struct unlinkat_args *); int posix_openpt(struct thread *, struct posix_openpt_args *); int gssd_syscall(struct thread *, struct gssd_syscall_args *); +int pipe(struct thread *, struct pipe_args *); =20 #ifdef COMPAT_43 =20 @@ -2254,7 +2258,7 @@ #define SYS_AUE_kill AUE_KILL #define SYS_AUE_getppid AUE_GETPPID #define SYS_AUE_dup AUE_DUP -#define SYS_AUE_pipe AUE_PIPE +#define SYS_AUE_freebsd7_pipe AUE_PIPE #define SYS_AUE_getegid AUE_GETEGID #define SYS_AUE_profil AUE_PROFILE #define SYS_AUE_ktrace AUE_KTRACE @@ -2572,6 +2576,7 @@ #define SYS_AUE_unlinkat AUE_UNLINKAT #define SYS_AUE_posix_openpt AUE_POSIX_OPENPT #define SYS_AUE_gssd_syscall AUE_NULL +#define SYS_AUE_pipe AUE_PIPE =20 #undef PAD_ #undef PADL_ --qxmd2aOE9n9J83EO-- --zHKSuzk+vZNe6bCt Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEARECAAYFAkkXObIACgkQ52SDGA2eCwUBUgCfdtK16fbLWflaoAQYtXlQpS9e NHEAoIAgvGxQItL/Vn6kPuw/Gm5ger1x =4STg -----END PGP SIGNATURE----- --zHKSuzk+vZNe6bCt--