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-- From owner-freebsd-arch@FreeBSD.ORG Sun Nov 9 21:02:54 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 3ACA0106567B for ; Sun, 9 Nov 2008 21:02:54 +0000 (UTC) (envelope-from bright@elvis.mu.org) Received: from elvis.mu.org (elvis.mu.org [192.203.228.196]) by mx1.freebsd.org (Postfix) with ESMTP id 3222C8FC1B for ; Sun, 9 Nov 2008 21:02:54 +0000 (UTC) (envelope-from bright@elvis.mu.org) Received: by elvis.mu.org (Postfix, from userid 1192) id E62B91A3C3E; Sun, 9 Nov 2008 12:43:42 -0800 (PST) Date: Sun, 9 Nov 2008 12:43:42 -0800 From: Alfred Perlstein To: Ed Schouten Message-ID: <20081109204342.GB53877@elvis.mu.org> References: <20081109192746.GO1165@hoeg.nl> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20081109192746.GO1165@hoeg.nl> User-Agent: Mutt/1.4.2.3i Cc: FreeBSD Arch Subject: Re: 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 21:02:54 -0000 Looks really good, simplifies and reduces code. * Ed Schouten [081109 11:27] wrote: > 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? > > -- > Ed Schouten > WWW: http://80386.nl/ -- - Alfred Perlstein From owner-freebsd-arch@FreeBSD.ORG Sun Nov 9 21:14:05 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 BC430106564A for ; Sun, 9 Nov 2008 21:14:05 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.terabit.net.ua (mail.terabit.net.ua [195.137.202.147]) by mx1.freebsd.org (Postfix) with ESMTP id 640A88FC0A for ; Sun, 9 Nov 2008 21:14:05 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from skuns.zoral.com.ua ([91.193.166.194] helo=mail.zoral.com.ua) by mail.terabit.net.ua with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63 (FreeBSD)) (envelope-from ) id 1KzH3c-0008k1-GD; Sun, 09 Nov 2008 22:38:52 +0200 Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id mA9Kcmdw072933 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 9 Nov 2008 22:38:49 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.3/8.14.3) with ESMTP id mA9Kcmwu081746; Sun, 9 Nov 2008 22:38:48 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.3/8.14.3/Submit) id mA9KcmtO081745; Sun, 9 Nov 2008 22:38:48 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Sun, 9 Nov 2008 22:38:48 +0200 From: Kostik Belousov To: Ed Schouten Message-ID: <20081109203848.GP18100@deviant.kiev.zoral.com.ua> References: <20081109192746.GO1165@hoeg.nl> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="k6ZcKdd3yPXXXL9P" Content-Disposition: inline In-Reply-To: <20081109192746.GO1165@hoeg.nl> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: ClamAV version 0.93.3, clamav-milter version 0.93.3 on skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua X-Virus-Scanned: mail.terabit.net.ua 1KzH3c-0008k1-GD b8f941f6187919ab3e07f2bcfd5a1ba2 X-Terabit: YES Cc: FreeBSD Arch Subject: Re: 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 21:14:05 -0000 --k6ZcKdd3yPXXXL9P Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Nov 09, 2008 at 08:27:46PM +0100, Ed Schouten wrote: > Hello all, >=20 > 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. >=20 > 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. >=20 > In my opinion there are a couple of disadvantages of having multiple > return values: >=20 > - As documented in syscall(2), there is no way to obtain the second > return value if you use this functions. >=20 > - 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? >=20 > 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. >=20 > I could commit this if people think it makes sense. Any comments? >=20 The convention of returning pipe descriptors in the registers comes back at least to the Six Edition. Check the Lion' book for the reference. Amusingly, Solaris uses the same calling convention for pipe(2). I do not see what we gain by the change. Now, we have one syscall and some arch-dependend wrappers in the libc. After the patch, we get rid of the wrappers, but grow two syscalls. The only reason of doing this I can imagine is to allow syscall(2) to work for SYS_pipe from C code. Since we did not heard complaints about this for ~15 years, we can live with it. --k6ZcKdd3yPXXXL9P Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEARECAAYFAkkXSlgACgkQC3+MBN1Mb4grDwCg93mTTWc9KOqwgGNjq9Lu5YDm fFMAn2ESdGhNL+Wd3yNLJa0qFpuCO7+8 =xH8s -----END PGP SIGNATURE----- --k6ZcKdd3yPXXXL9P-- From owner-freebsd-arch@FreeBSD.ORG Sun Nov 9 21:14:06 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 647F01065673 for ; Sun, 9 Nov 2008 21:14:06 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.terabit.net.ua (mail.terabit.net.ua [195.137.202.147]) by mx1.freebsd.org (Postfix) with ESMTP id 0C2E98FC17 for ; Sun, 9 Nov 2008 21:14:06 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from skuns.zoral.com.ua ([91.193.166.194] helo=mail.zoral.com.ua) by mail.terabit.net.ua with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63 (FreeBSD)) (envelope-from ) id 1KzHBC-0009D3-Mp; Sun, 09 Nov 2008 22:46:42 +0200 Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id mA9KkdDh073356 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 9 Nov 2008 22:46:40 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.3/8.14.3) with ESMTP id mA9KkdV3081989; Sun, 9 Nov 2008 22:46:39 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.3/8.14.3/Submit) id mA9Kkdbs081988; Sun, 9 Nov 2008 22:46:39 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Sun, 9 Nov 2008 22:46:39 +0200 From: Kostik Belousov To: Ed Schouten Message-ID: <20081109204639.GQ18100@deviant.kiev.zoral.com.ua> References: <20081109192746.GO1165@hoeg.nl> <20081109203848.GP18100@deviant.kiev.zoral.com.ua> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="fxAWlMnXhsHl2yhM" Content-Disposition: inline In-Reply-To: <20081109203848.GP18100@deviant.kiev.zoral.com.ua> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: ClamAV version 0.93.3, clamav-milter version 0.93.3 on skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua X-Virus-Scanned: mail.terabit.net.ua 1KzHBC-0009D3-Mp 8f6e96d609e66d01e73cae4546665334 X-Terabit: YES Cc: FreeBSD Arch Subject: Re: 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 21:14:06 -0000 --fxAWlMnXhsHl2yhM Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Nov 09, 2008 at 10:38:48PM +0200, Kostik Belousov wrote: > On Sun, Nov 09, 2008 at 08:27:46PM +0100, Ed Schouten wrote: > > Hello all, > >=20 > > 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. > >=20 > > 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. > >=20 > > In my opinion there are a couple of disadvantages of having multiple > > return values: > >=20 > > - As documented in syscall(2), there is no way to obtain the second > > return value if you use this functions. > >=20 > > - 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? > >=20 > > 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. > >=20 > > I could commit this if people think it makes sense. Any comments? > >=20 >=20 > The convention of returning pipe descriptors in the registers comes > back at least to the Six Edition. Check the Lion' book for the reference. > Amusingly, Solaris uses the same calling convention for pipe(2). >=20 > I do not see what we gain by the change. Now, we have one syscall and > some arch-dependend wrappers in the libc. After the patch, we get rid > of the wrappers, but grow two syscalls. >=20 > The only reason of doing this I can imagine is to allow syscall(2) to > work for SYS_pipe from C code. Since we did not heard complaints about > this for ~15 years, we can live with it. Part that updates man page, introduces kern_pipe and simplifies linuxolator has a stand-alone value. I think that should be committed in any case. --fxAWlMnXhsHl2yhM Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEARECAAYFAkkXTC4ACgkQC3+MBN1Mb4j3bACgtXJaWLeNc5TRBHVTSt6Tvbww MeQAnRIVSUsDJEJ7my/m3NPMgLFKxWKJ =vyWd -----END PGP SIGNATURE----- --fxAWlMnXhsHl2yhM-- From owner-freebsd-arch@FreeBSD.ORG Sun Nov 9 22:31:23 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 E408A1065674 for ; Sun, 9 Nov 2008 22:31:23 +0000 (UTC) (envelope-from phk@critter.freebsd.dk) Received: from phk.freebsd.dk (phk.freebsd.dk [130.225.244.222]) by mx1.freebsd.org (Postfix) with ESMTP id B06668FC18 for ; Sun, 9 Nov 2008 22:31:23 +0000 (UTC) (envelope-from phk@critter.freebsd.dk) Received: from critter.freebsd.dk (unknown [192.168.61.3]) by phk.freebsd.dk (Postfix) with ESMTP id A092B170E3; Sun, 9 Nov 2008 22:12:26 +0000 (UTC) Received: from critter.freebsd.dk (localhost [127.0.0.1]) by critter.freebsd.dk (8.14.3/8.14.3) with ESMTP id mA9MCPVk071216; Sun, 9 Nov 2008 22:12:25 GMT (envelope-from phk@critter.freebsd.dk) To: Ed Schouten From: "Poul-Henning Kamp" In-Reply-To: Your message of "Sun, 09 Nov 2008 20:27:46 +0100." <20081109192746.GO1165@hoeg.nl> Date: Sun, 09 Nov 2008 22:12:25 +0000 Message-ID: <71215.1226268745@critter.freebsd.dk> Sender: phk@critter.freebsd.dk Cc: FreeBSD Arch Subject: Re: 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 22:31:24 -0000 In message <20081109192746.GO1165@hoeg.nl>, Ed Schouten writes: >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. It will take some time before we can remove the old syscall, but I'd say it is worth it, just for getting more consistency and less pointless magic. -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk@FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence. From owner-freebsd-arch@FreeBSD.ORG Sun Nov 9 23:04:01 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 232C61065674 for ; Sun, 9 Nov 2008 23:04:01 +0000 (UTC) (envelope-from peter@wemm.org) Received: from rv-out-0506.google.com (rv-out-0506.google.com [209.85.198.232]) by mx1.freebsd.org (Postfix) with ESMTP id 0A35D8FC12 for ; Sun, 9 Nov 2008 23:04:00 +0000 (UTC) (envelope-from peter@wemm.org) Received: by rv-out-0506.google.com with SMTP id b25so2055239rvf.43 for ; Sun, 09 Nov 2008 15:04:00 -0800 (PST) Received: by 10.142.178.2 with SMTP id a2mr2018990wff.214.1226270178409; Sun, 09 Nov 2008 14:36:18 -0800 (PST) Received: by 10.142.255.21 with HTTP; Sun, 9 Nov 2008 14:36:18 -0800 (PST) Message-ID: Date: Sun, 9 Nov 2008 14:36:18 -0800 From: "Peter Wemm" To: "Kostik Belousov" In-Reply-To: <20081109203848.GP18100@deviant.kiev.zoral.com.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <20081109192746.GO1165@hoeg.nl> <20081109203848.GP18100@deviant.kiev.zoral.com.ua> Cc: Ed Schouten , FreeBSD Arch Subject: Re: 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 23:04:01 -0000 On Sun, Nov 9, 2008 at 12:38 PM, Kostik Belousov wrote: > On Sun, Nov 09, 2008 at 08:27:46PM +0100, Ed Schouten wrote: >> 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? >> > > The convention of returning pipe descriptors in the registers comes > back at least to the Six Edition. Check the Lion' book for the reference. > Amusingly, Solaris uses the same calling convention for pipe(2). > > I do not see what we gain by the change. Now, we have one syscall and > some arch-dependend wrappers in the libc. After the patch, we get rid > of the wrappers, but grow two syscalls. > > The only reason of doing this I can imagine is to allow syscall(2) to > work for SYS_pipe from C code. Since we did not heard complaints about > this for ~15 years, we can live with it. > The other side effect of the change is to remove one asm instruction code in the syscall handler and replace it by potentially hundreds of instructions to do the copyout. Plus we gain another syscall, lose backwards compatability with kernel.old again, and so on. I really don't see an overall benefit. What I do see some use for is to do the kern_pipe() split (like in the patch) which simplifies the linux abi wrappers (and other ABI wrappers, not just linux!). Just have our syscall return in retval[0] and [1] like before. But we get the benefit of simplifying a bunch of wrappers. The patch is incomplete anyway, It leaks fds if the copyout fails. There is a comment about this in the patch anyway. Other historical notes.. Ancient unix systems used to implement syscalls by having userland do a call (jsr) to a shared page. The trap handler would verify the entry point, and if it was approved, it would then give privilige and continue. The problem was that this severely limited the number of syscalls because we were talking tiny address spaces. Given that syscall numbers were at a premium, it made sense to pack as much functionality into syscalls as possible. eg: getpid syscall could return both pid and ppid, saving a kernel syscall entry point, and so on. This is also one of the reasons for SIGSYS. Calling an illegal kernel entry point in a process that had run wild could be easily converted into a signal. WIld processes could easily hit the kernel entry points. Again, this doesn't really apply these days. It is somewhat archaic by today's standards - linux doesn't even bother with SIGSYS - it has bad syscalls just return ENOSYS. fork() currently uses both retval[0] and [1], in spite of it appearing not to. See cpu_fork() for the other half. We use both return values for 64 bit returns. eg: lseek(). Some places that set it to 0 are silly. I really don't see td_retval[0] and td_retval[1] ever going away entirely, at least not while we share the syscall vector between 32 and 64 bit systems. I don't think it is worth breaking kernel.old compatability, replacing the current syscall for pipe() with a slower one, and having to have both anyway is much of a win. Splitting pipe() and kern_pipe() would help ABI wrappers. I don't see value in adding a new way for pipe(2) to fail (right now, pipe(2) causes a segfault if you pass a bad address. The new wrapper causes it to return EFAULT instead, and NOT crash the app. The failure mode has changed.) As an aside.. I'm very very very painfully aware of the dual return from syscalls. I've been fighting with this in valgrind for quite some time now. We have some very interesting semantics on i386. * syscalls preserve all registers except for %eax and %eflags. Even scratch registers. * .. except for %edx sometimes, for 64 bit returns, or dual-returns. Otherwise %edx is preserved. * libc depends on this in a couple of hand-written asm stubs, eg: brk()/sbrk(). Nothing else cares about this. * some libc syscall wrappers trash the scratch registers though. * in spite of syscalls not using C calling conventions, the kernel assumes you've done a C-style call to libc. It assumes the C return address was pushed onto the stack before the args. In retrospect I wish it never had started out this way. But it did, it still is, and I feel the costs of changing it are not worth it for such little gain. -- Peter Wemm - peter@wemm.org; peter@FreeBSD.org; peter@yahoo-inc.com; KI6FJV "All of this is for nothing if we don't go to the stars" - JMS/B5 "If Java had true garbage collection, most programs would delete themselves upon execution." -- Robert Sewell From owner-freebsd-arch@FreeBSD.ORG Mon Nov 10 11:06:47 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 B8DA810656A3 for ; Mon, 10 Nov 2008 11:06:47 +0000 (UTC) (envelope-from owner-bugmaster@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 866648FC13 for ; Mon, 10 Nov 2008 11:06:47 +0000 (UTC) (envelope-from owner-bugmaster@FreeBSD.org) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.3/8.14.3) with ESMTP id mAAB6lTG049652 for ; Mon, 10 Nov 2008 11:06:47 GMT (envelope-from owner-bugmaster@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.3/8.14.3/Submit) id mAAB6loD049648 for freebsd-arch@FreeBSD.org; Mon, 10 Nov 2008 11:06:47 GMT (envelope-from owner-bugmaster@FreeBSD.org) Date: Mon, 10 Nov 2008 11:06:47 GMT Message-Id: <200811101106.mAAB6loD049648@freefall.freebsd.org> X-Authentication-Warning: freefall.freebsd.org: gnats set sender to owner-bugmaster@FreeBSD.org using -f From: FreeBSD bugmaster To: freebsd-arch@FreeBSD.org Cc: Subject: Current problem reports assigned to freebsd-arch@FreeBSD.org 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: Mon, 10 Nov 2008 11:06:47 -0000 Note: to view an individual PR, use: http://www.freebsd.org/cgi/query-pr.cgi?pr=(number). The following is a listing of current problems submitted by FreeBSD users. These represent problem reports covering all versions including experimental development code and obsolete releases. S Tracker Resp. Description -------------------------------------------------------------------------------- o kern/120749 arch [request] Suggest upping the default kern.ps_arg_cache 1 problem total. From owner-freebsd-arch@FreeBSD.ORG Mon Nov 10 20:39:31 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 DE2541065680 for ; Mon, 10 Nov 2008 20:39:31 +0000 (UTC) (envelope-from prvs=julian=19336e908@elischer.org) Received: from smtp-outbound.ironport.com (smtp-outbound.ironport.com [63.251.108.112]) by mx1.freebsd.org (Postfix) with ESMTP id BB5EC8FC17 for ; Mon, 10 Nov 2008 20:39:31 +0000 (UTC) (envelope-from prvs=julian=19336e908@elischer.org) Received: from jelischer-laptop.sfo.ironport.com (HELO julian-mac.elischer.org) ([10.251.22.38]) by smtp-outbound.ironport.com with ESMTP; 10 Nov 2008 12:10:39 -0800 Message-ID: <4918953F.7070006@elischer.org> Date: Mon, 10 Nov 2008 12:10:39 -0800 From: Julian Elischer User-Agent: Thunderbird 2.0.0.17 (Macintosh/20080914) MIME-Version: 1.0 To: Kostik Belousov References: <20081109192746.GO1165@hoeg.nl> <20081109203848.GP18100@deviant.kiev.zoral.com.ua> In-Reply-To: <20081109203848.GP18100@deviant.kiev.zoral.com.ua> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Ed Schouten , FreeBSD Arch Subject: Re: 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: Mon, 10 Nov 2008 20:39:32 -0000 Kostik Belousov wrote: > On Sun, Nov 09, 2008 at 08:27:46PM +0100, Ed Schouten wrote: >> 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. don't forget that we will still need to support the old convention because we support running old binaries "forever" (generally). I occasionally run freebsd 1.0 binaries on -current (you should see how fast a "make world" is in a 1.0 chroot!) >> >> 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? >> > > The convention of returning pipe descriptors in the registers comes > back at least to the Six Edition. Check the Lion' book for the reference. > Amusingly, Solaris uses the same calling convention for pipe(2). > > I do not see what we gain by the change. Now, we have one syscall and > some arch-dependend wrappers in the libc. After the patch, we get rid > of the wrappers, but grow two syscalls. > > The only reason of doing this I can imagine is to allow syscall(2) to > work for SYS_pipe from C code. Since we did not heard complaints about > this for ~15 years, we can live with it. From owner-freebsd-arch@FreeBSD.ORG Tue Nov 11 15:00:40 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 BB179106564A for ; Tue, 11 Nov 2008 15:00:40 +0000 (UTC) (envelope-from ed@hoeg.nl) Received: from palm.hoeg.nl (mx0.hoeg.nl [IPv6:2001:7b8:613:100::211]) by mx1.freebsd.org (Postfix) with ESMTP id 556AC8FC08 for ; Tue, 11 Nov 2008 15:00:40 +0000 (UTC) (envelope-from ed@hoeg.nl) Received: by palm.hoeg.nl (Postfix, from userid 1000) id 3311E1D07E; Tue, 11 Nov 2008 16:00:39 +0100 (CET) Date: Tue, 11 Nov 2008 16:00:39 +0100 From: Ed Schouten To: FreeBSD Arch Message-ID: <20081111150039.GV1165@hoeg.nl> References: <20081109192746.GO1165@hoeg.nl> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="alTGMKZKEXf64S3V" Content-Disposition: inline In-Reply-To: <20081109192746.GO1165@hoeg.nl> User-Agent: Mutt/1.5.18 (2008-05-17) Subject: Re: 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: Tue, 11 Nov 2008 15:00:40 -0000 --alTGMKZKEXf64S3V Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hello all, It seems most people liked some things that were in the patch, while others preferred to keep things as they were. I've just committed a patch to SVN (r184849) which keeps pipe(2) as it is now, but does some cleanups: - I've added kern_pipe(), so we can make linux_pipe() and linux32_pipe() less ugly (discussed with rdivacky). - I've also changed the manual page to not mention EFAULT, because we just get a segmentation fault if we pass an invalid address. Thanks all for commenting on this topic! --=20 Ed Schouten WWW: http://80386.nl/ --alTGMKZKEXf64S3V Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEARECAAYFAkkZnhcACgkQ52SDGA2eCwVFswCbBdyuv5lcBtWUsrQOJC7FtIex c6IAnRmI8hAf03kkpoEPf2dAYGnT1VC7 =CjU+ -----END PGP SIGNATURE----- --alTGMKZKEXf64S3V-- From owner-freebsd-arch@FreeBSD.ORG Wed Nov 12 09:00:15 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 B74FA106568E for ; Wed, 12 Nov 2008 09:00:15 +0000 (UTC) (envelope-from pjd@garage.freebsd.pl) Received: from mail.garage.freebsd.pl (chello087206045082.chello.pl [87.206.45.82]) by mx1.freebsd.org (Postfix) with ESMTP id 476A28FC16 for ; Wed, 12 Nov 2008 09:00:14 +0000 (UTC) (envelope-from pjd@garage.freebsd.pl) Received: by mail.garage.freebsd.pl (Postfix, from userid 65534) id 0C08B456AB; Wed, 12 Nov 2008 09:27:05 +0100 (CET) Received: from localhost (pjdwl.wheel.pl [10.0.1.9]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.garage.freebsd.pl (Postfix) with ESMTP id DB73945685; Wed, 12 Nov 2008 09:26:58 +0100 (CET) Date: Wed, 12 Nov 2008 09:26:58 +0100 From: Pawel Jakub Dawidek To: Ceri Davies Message-ID: <20081112082658.GA2441@garage.freebsd.pl> References: <20081027193545.GA95872@pin.if.uz.zgora.pl> <20081028161855.GA45129@zim.MIT.EDU> <20081106192829.GA98742@pin.if.uz.zgora.pl> <20081106195558.GG2281@submonkey.net> <20081107123259.GC34757@submonkey.net> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="PEIAKu/WMn1b1Hv9" Content-Disposition: inline In-Reply-To: <20081107123259.GC34757@submonkey.net> User-Agent: Mutt/1.4.2.3i X-PGP-Key-URL: http://people.freebsd.org/~pjd/pjd.asc X-OS: FreeBSD 8.0-CURRENT i386 X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on mail.garage.freebsd.pl X-Spam-Level: X-Spam-Status: No, score=-5.9 required=3.0 tests=ALL_TRUSTED,BAYES_00 autolearn=ham version=3.0.4 Cc: freebsd-arch@freebsd.org Subject: Re: Directory rename semantics. 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: Wed, 12 Nov 2008 09:00:15 -0000 --PEIAKu/WMn1b1Hv9 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Nov 07, 2008 at 12:32:59PM +0000, Ceri Davies wrote: > On Fri, Nov 07, 2008 at 11:44:27AM +0100, Ivan Voras wrote: > > Ceri Davies wrote: > > > On Thu, Nov 06, 2008 at 08:28:29PM +0100, Edward Tomasz Napierala wro= te: > > >> After discussion about this with rwatson and pjd, I decided to do > > >> the opposite: change ZFS behaviour to match UFS. Reason is simple: > > >> this is security, and we want to be conservative here. It's impossi= ble > > >> to make sure this change wouldn't cause security problems. > > >=20 > > > Perhaps it would have been better to either do nothing or create a zfs > > > property that toggled this behaviour so that people who expect ZFS to > > > behave a certain way get it. I'm not sure why we would want all > > > filesystems to behave the same way, to be honest. > >=20 > > That would be desirable if we want file system semantics to be a > > property of the OS instead of individual file systems. (Though I don't > > know if there's ever been a conscious decision about this particular > > goal). If so, a knob that toggles between the behaviours should toggle > > it for all file systems. Having them behave differently can create > > problems in migration to and from ZFS. >=20 > That's essentially what has just happened, but without the knob. >=20 > I'm not really sure whether you agree with the change that was made or > not. =46rom user's perspective if I want to migrate from UFS to ZFS, I don't want to find out that there are differences in how FS behaves. I'm trying to make ZFS to be a full functional replacement for UFS, so that it supports chflags(2), extattrs, etc. Of course we need to draw a line what do we really want to support and what we may skip or support not fully. For example... ZFS/FreeBSD on directory creation inherits group ownership from the parent directory and now it also obeys directory write permissions when we want to move it to another directory. We support FreeBSD's extattrs, not Solaris fsattrs. We could support POSIX.1e ACLs easly (on top of extattrs), but we want to move to NFSv4-like ACLs with UFS too, AFAIK. We support chflags(2), but not all the flags. (I'm talking about perforce version.) --=20 Pawel Jakub Dawidek http://www.wheel.pl pjd@FreeBSD.org http://www.FreeBSD.org FreeBSD committer Am I Evil? Yes, I Am! --PEIAKu/WMn1b1Hv9 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.4 (FreeBSD) iD8DBQFJGpNRForvXbEpPzQRAjaMAJ9d6OeMcRWf235DzAvW0ufhxMvK8QCgtiFH +Tk7TCFmpT0VQzg7wiRU6jA= =ONrS -----END PGP SIGNATURE----- --PEIAKu/WMn1b1Hv9--