Index: contrib/gcc/config/sparc/freebsd.h =================================================================== RCS file: /home/ncvs/src/contrib/gcc/config/sparc/freebsd.h,v retrieving revision 1.2 diff -u -r1.2 freebsd.h --- contrib/gcc/config/sparc/freebsd.h 12 Sep 2002 17:19:09 -0000 1.2 +++ contrib/gcc/config/sparc/freebsd.h 29 Oct 2002 03:12:48 -0000 @@ -160,3 +160,34 @@ /* We use GNU ld so undefine this so that attribute((init_priority)) works. */ #undef CTORS_SECTION_ASM_OP #undef DTORS_SECTION_ASM_OP + +#define TRANSFER_FROM_TRAMPOLINE \ +static int need_enable_exec_stack; \ + \ +static void check_enabling(void) __attribute__ ((constructor)); \ +static void check_enabling(void) \ +{ \ + extern int sysctlbyname(const char *, void *, size_t *, void *, size_t);\ + size_t len; \ + int prot; \ + \ + prot = 0; \ + len = sizeof(prot); \ + sysctlbyname ("kern.stackprot", &prot, &len, NULL, 0); \ + if (prot != 7) \ + need_enable_exec_stack = 1; \ +} \ + \ +extern void __enable_execute_stack (void *); \ +void \ +__enable_execute_stack (addr) \ + void *addr; \ +{ \ + if (!need_enable_exec_stack) \ + return; \ + else { \ + /* 7 is PROT_READ | PROT_WRITE | PROT_EXEC */ \ + if (mprotect (addr, TRAMPOLINE_SIZE, 7) < 0) \ + perror ("mprotect of trampoline code"); \ + } \ +} Index: lib/libc/alpha/sys/Makefile.inc =================================================================== RCS file: /home/ncvs/src/lib/libc/alpha/sys/Makefile.inc,v retrieving revision 1.11 diff -u -r1.11 Makefile.inc --- lib/libc/alpha/sys/Makefile.inc 23 May 2002 23:51:56 -0000 1.11 +++ lib/libc/alpha/sys/Makefile.inc 30 Oct 2002 05:08:00 -0000 @@ -4,9 +4,8 @@ sbrk.S setlogin.S sigreturn.S # Don't generate default code for these syscalls: -NOASM= break.o exit.o ftruncate.o getdomainname.o getlogin.o \ - lseek.o mlockall.o mmap.o munlockall.o openbsd_poll.o pread.o \ - pwrite.o setdomainname.o sstk.o truncate.o uname.o vfork.o yield.o +NOASM= break.o exit.o getdomainname.o getlogin.o mlockall.o munlockall.o \ + openbsd_poll.o setdomainname.o sstk.o uname.o vfork.o yield.o PSEUDO= _getlogin.o _exit.o Index: lib/libc/i386/sys/Makefile.inc =================================================================== RCS file: /home/ncvs/src/lib/libc/i386/sys/Makefile.inc,v retrieving revision 1.24 diff -u -r1.24 Makefile.inc --- lib/libc/i386/sys/Makefile.inc 23 May 2002 23:51:57 -0000 1.24 +++ lib/libc/i386/sys/Makefile.inc 29 Oct 2002 16:23:08 -0000 @@ -8,9 +8,8 @@ setlogin.S sigreturn.S syscall.S # Don't generate default code for these syscalls: -NOASM= break.o exit.o ftruncate.o getdomainname.o getlogin.o \ - lseek.o mlockall.o mmap.o munlockall.o openbsd_poll.o pread.o \ - pwrite.o setdomainname.o sstk.o truncate.o uname.o vfork.o yield.o +NOASM= break.o exit.o getdomainname.o getlogin.o mlockall.o munlockall.o \ + openbsd_poll.o setdomainname.o sstk.o uname.o vfork.o yield.o PSEUDO= _getlogin.o _exit.o Index: lib/libc/ia64/sys/Makefile.inc =================================================================== RCS file: /home/ncvs/src/lib/libc/ia64/sys/Makefile.inc,v retrieving revision 1.6 diff -u -r1.6 Makefile.inc --- lib/libc/ia64/sys/Makefile.inc 23 May 2002 23:51:57 -0000 1.6 +++ lib/libc/ia64/sys/Makefile.inc 29 Oct 2002 16:24:44 -0000 @@ -4,8 +4,7 @@ sbrk.S setlogin.S sigreturn.S # Don't generate default code for these syscalls: -NOASM= break.o exit.o ftruncate.o getdomainname.o getlogin.o \ - lseek.o mlockall.o mmap.o munlockall.o openbsd_poll.o pread.o \ - pwrite.o setdomainname.o sstk.o truncate.o uname.o vfork.o yield.o +NOASM= break.o exit.o getdomainname.o getlogin.o mlockall.o munlockall.o \ + openbsd_poll.o setdomainname.o sstk.o uname.o vfork.o yield.o PSEUDO= _getlogin.o _exit.o Index: lib/libc/sparc64/sys/Makefile.inc =================================================================== RCS file: /home/ncvs/src/lib/libc/sparc64/sys/Makefile.inc,v retrieving revision 1.8 diff -u -r1.8 Makefile.inc --- lib/libc/sparc64/sys/Makefile.inc 3 Sep 2002 14:55:29 -0000 1.8 +++ lib/libc/sparc64/sys/Makefile.inc 29 Oct 2002 05:28:55 -0000 @@ -12,12 +12,13 @@ CFLAGS+= -I${.CURDIR}/sparc64/fpu -MDASM+= brk.S cerror.S exect.S pipe.S ptrace.S sbrk.S setlogin.S sigaction.S +MDASM+= brk.S cerror.S exect.S pipe.S ptrace.S sbrk.S setlogin.S sigaction.S \ + syscall.S # Don't generate default code for these syscalls: -NOASM= break.o exit.o ftruncate.o getdomainname.o getlogin.o \ - lseek.o mlockall.o mmap.o munlockall.o openbsd_poll.o pread.o \ - pwrite.o setdomainname.o sstk.o truncate.o uname.o yield.o +NOASM= break.o exit.o getdomainname.o getlogin.o mlockall.o munlockall.o \ + openbsd_poll.o syscall.o __syscall.o setdomainname.o sstk.o uname.o \ + yield.o PSEUDO= _getlogin.o _exit.o Index: lib/libc/sparc64/sys/syscall.S =================================================================== RCS file: lib/libc/sparc64/sys/syscall.S diff -N lib/libc/sparc64/sys/syscall.S --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lib/libc/sparc64/sys/syscall.S 27 Oct 2002 22:36:01 -0000 @@ -0,0 +1,57 @@ +/*- + * Copyright (c) 2002 Jake Burkholder. + * 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 PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * 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, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include "SYS.h" + +_SYSENTRY(__syscall) +_SYSENTRY(syscall) + save %sp, -(CCFSZ + (5 * 8)), %sp + ldx [%fp + SPOFF + 176 + (0 * 8)], %o5 + ldx [%fp + SPOFF + 176 + (1 * 8)], %l0 + ldx [%fp + SPOFF + 176 + (2 * 8)], %l1 + ldx [%fp + SPOFF + 176 + (3 * 8)], %l2 + ldx [%fp + SPOFF + 176 + (4 * 8)], %l3 + stx %l0, [%sp + SPOFF + 176 + (0 * 8)] + stx %l1, [%sp + SPOFF + 176 + (1 * 8)] + stx %l2, [%sp + SPOFF + 176 + (2 * 8)] + stx %l3, [%sp + SPOFF + 176 + (3 * 8)] + mov %i1, %o0 + mov %i2, %o1 + mov %i3, %o2 + mov %i4, %o3 + mov %i5, %o4 + mov %i0, %g1 + ta %xcc, ST_SYSCALL + bcc,a,pt %xcc, 1f + nop + restore %o0, 0, %o0 + ERROR() +1: ret + restore %o0, 0, %o0 +_SYSEND(syscall) Index: lib/libc/sys/Makefile.inc =================================================================== RCS file: /home/ncvs/src/lib/libc/sys/Makefile.inc,v retrieving revision 1.97 diff -u -r1.97 Makefile.inc --- lib/libc/sys/Makefile.inc 8 Oct 2002 17:43:40 -0000 1.97 +++ lib/libc/sys/Makefile.inc 28 Oct 2002 03:42:22 -0000 @@ -18,7 +18,10 @@ .endif # Sources common to both syscall interfaces: -SRCS+= ftruncate.c lseek.c mmap.c pread.c pwrite.c sem.c truncate.c __error.c +.if 0 +SRCS+= ftruncate.c lseek.c mmap.c pread.c pwrite.c truncate.c +.endif +SRCS+= sem.c __error.c # Add machine dependent asm sources: SRCS+=${MDASM} Index: lib/libc/sys/ftruncate.c =================================================================== RCS file: lib/libc/sys/ftruncate.c diff -N lib/libc/sys/ftruncate.c --- lib/libc/sys/ftruncate.c 22 Mar 2002 21:53:24 -0000 1.5 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,55 +0,0 @@ -/* - * Copyright (c) 1992, 1993 - * 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. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 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 PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * 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, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)ftruncate.c 8.1 (Berkeley) 6/17/93"; -#endif /* LIBC_SCCS and not lint */ -#include -__FBSDID("$FreeBSD: src/lib/libc/sys/ftruncate.c,v 1.5 2002/03/22 21:53:24 obrien Exp $"); - -#include -#include -#include - -/* - * This function provides 64-bit offset padding that - * is not supplied by GCC 1.X but is supplied by GCC 2.X. - */ -int -ftruncate(fd, length) - int fd; - off_t length; -{ - - return(__syscall((quad_t)SYS_ftruncate, fd, 0, length)); -} Index: lib/libc/sys/lseek.c =================================================================== RCS file: lib/libc/sys/lseek.c diff -N lib/libc/sys/lseek.c --- lib/libc/sys/lseek.c 22 Mar 2002 21:53:24 -0000 1.5 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,55 +0,0 @@ -/* - * Copyright (c) 1992, 1993 - * 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. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 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 PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * 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, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)lseek.c 8.1 (Berkeley) 6/17/93"; -#endif /* LIBC_SCCS and not lint */ -#include -__FBSDID("$FreeBSD: src/lib/libc/sys/lseek.c,v 1.5 2002/03/22 21:53:24 obrien Exp $"); - -#include -#include -#include - -/* - * This function provides 64-bit offset padding that - * is not supplied by GCC 1.X but is supplied by GCC 2.X. - */ -off_t -lseek(fd, offset, whence) - int fd; - off_t offset; - int whence; -{ - return(__syscall((quad_t)SYS_lseek, fd, 0, offset, whence)); -} Index: lib/libc/sys/mmap.c =================================================================== RCS file: lib/libc/sys/mmap.c diff -N lib/libc/sys/mmap.c --- lib/libc/sys/mmap.c 22 Mar 2002 21:53:24 -0000 1.4 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,61 +0,0 @@ -/* - * Copyright (c) 1992, 1993 - * 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. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 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 PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * 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, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)mmap.c 8.1 (Berkeley) 6/17/93"; -#endif /* LIBC_SCCS and not lint */ -#include -__FBSDID("$FreeBSD: src/lib/libc/sys/mmap.c,v 1.4 2002/03/22 21:53:24 obrien Exp $"); - -#include -#include -#include -#include - -/* - * This function provides 64-bit offset padding that - * is not supplied by GCC 1.X but is supplied by GCC 2.X. - */ -void * -mmap(addr, len, prot, flags, fd, offset) - void * addr; - size_t len; - int prot; - int flags; - int fd; - off_t offset; -{ - - return((void *)(long)__syscall((quad_t)SYS_mmap, addr, len, prot, flags, - fd, 0, offset)); -} Index: lib/libc/sys/pread.c =================================================================== RCS file: lib/libc/sys/pread.c diff -N lib/libc/sys/pread.c --- lib/libc/sys/pread.c 22 Mar 2002 21:53:24 -0000 1.2 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,56 +0,0 @@ -/* - * Copyright (c) 1992, 1993 - * 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. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 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 PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * 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, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)mmap.c 8.1 (Berkeley) 6/17/93"; -#endif /* LIBC_SCCS and not lint */ -#include -__FBSDID("$FreeBSD: src/lib/libc/sys/pread.c,v 1.2 2002/03/22 21:53:24 obrien Exp $"); - -#include -#include -#include - -/* - * This function provides 64-bit offset padding that - * is not supplied by GCC 1.X but is supplied by GCC 2.X. - */ -ssize_t -pread(fd, buf, nbyte, offset) - int fd; - void *buf; - size_t nbyte; - off_t offset; -{ - return ((ssize_t)__syscall((quad_t)SYS_pread, fd, buf, nbyte, 0, offset)); -} Index: lib/libc/sys/pwrite.c =================================================================== RCS file: lib/libc/sys/pwrite.c diff -N lib/libc/sys/pwrite.c --- lib/libc/sys/pwrite.c 22 Mar 2002 21:53:24 -0000 1.2 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,56 +0,0 @@ -/* - * Copyright (c) 1992, 1993 - * 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. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 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 PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * 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, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)mmap.c 8.1 (Berkeley) 6/17/93"; -#endif /* LIBC_SCCS and not lint */ -#include -__FBSDID("$FreeBSD: src/lib/libc/sys/pwrite.c,v 1.2 2002/03/22 21:53:24 obrien Exp $"); - -#include -#include -#include - -/* - * This function provides 64-bit offset padding that - * is not supplied by GCC 1.X but is supplied by GCC 2.X. - */ -ssize_t -pwrite(fd, buf, nbyte, offset) - int fd; - const void *buf; - size_t nbyte; - off_t offset; -{ - return ((ssize_t)__syscall((quad_t)SYS_pwrite, fd, buf, nbyte, 0, offset)); -} Index: lib/libc/sys/truncate.c =================================================================== RCS file: lib/libc/sys/truncate.c diff -N lib/libc/sys/truncate.c --- lib/libc/sys/truncate.c 22 Mar 2002 21:53:24 -0000 1.3 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,56 +0,0 @@ -/* - * Copyright (c) 1992, 1993 - * 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. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 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 PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * 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, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)truncate.c 8.1 (Berkeley) 6/17/93"; -#endif /* LIBC_SCCS and not lint */ -#include -__FBSDID("$FreeBSD: src/lib/libc/sys/truncate.c,v 1.3 2002/03/22 21:53:24 obrien Exp $"); - -#include -#include - -#include - -/* - * This function provides 64-bit offset padding that - * is not supplied by GCC 1.X but is supplied by GCC 2.X. - */ -int -truncate(path, length) - const char *path; - off_t length; -{ - - return(__syscall((quad_t)SYS_truncate, path, 0, length)); -} Index: sys/alpha/linux/linux_machdep.c =================================================================== RCS file: /home/ncvs/src/sys/alpha/linux/linux_machdep.c,v retrieving revision 1.24 diff -u -r1.24 linux_machdep.c --- sys/alpha/linux/linux_machdep.c 2 Oct 2002 14:30:14 -0000 1.24 +++ sys/alpha/linux/linux_machdep.c 30 Oct 2002 06:23:42 -0000 @@ -278,7 +278,6 @@ if(linux_args->fd == 0) bsd_args.fd = -1; - bsd_args.pad = 0; #ifdef DEBUG if (ldebug(mmap)) printf(ARGS(mmap, "%p, 0x%lx, 0x%x, 0x%x, 0x%x, 0x%lx)", Index: sys/alpha/osf1/osf1_misc.c =================================================================== RCS file: /home/ncvs/src/sys/alpha/osf1/osf1_misc.c,v retrieving revision 1.33 diff -u -r1.33 osf1_misc.c --- sys/alpha/osf1/osf1_misc.c 30 Aug 2002 04:04:34 -0000 1.33 +++ sys/alpha/osf1/osf1_misc.c 30 Oct 2002 06:50:41 -0000 @@ -467,7 +467,6 @@ syscallarg(int) prot; syscallarg(int) flags; syscallarg(int) fd; - syscallarg(long) pad; syscallarg(off_t) pos; } */ a; int retval; @@ -480,7 +479,6 @@ SCARG(&a, len) = SCARG(uap, len); SCARG(&a, prot) = SCARG(uap, prot); SCARG(&a, fd) = SCARG(uap, fd); - SCARG(&a, pad) = 0; SCARG(&a, pos) = SCARG(uap, pos); SCARG(&a, flags) = 0; @@ -547,7 +545,7 @@ retval = mmap(td, &a); #ifdef DEBUG uprintf( - "\nosf1_mmap: addr=%p (%p), len = 0x%lx, prot=0x%x, fd=%d, pad=0, pos=0x%lx", + "\nosf1_mmap: addr=%p (%p), len = 0x%lx, prot=0x%x, fd=%d, pos=0x%lx", SCARG(uap, addr), SCARG(&a, addr),SCARG(uap, len), SCARG(uap, prot), SCARG(uap, fd), SCARG(uap, pos)); printf(" flags = 0x%x\n",SCARG(uap, flags)); @@ -1026,7 +1024,6 @@ struct lseek_args a; SCARG(&a, fd) = SCARG(uap, fd); - SCARG(&a, pad) = 0; SCARG(&a, offset) = SCARG(uap, offset); SCARG(&a, whence) = SCARG(uap, whence); @@ -1256,9 +1253,6 @@ } -/* - * More of the stupid off_t padding! - */ int osf1_truncate(td, uap) struct thread *td; @@ -1271,7 +1265,6 @@ CHECKALTEXIST(td, &sg, uap->path); SCARG(&a, path) = SCARG(uap, path); - SCARG(&a, pad) = 0; SCARG(&a, length) = SCARG(uap, length); return truncate(td, &a); @@ -1286,7 +1279,6 @@ struct ftruncate_args a; SCARG(&a, fd) = SCARG(uap, fd); - SCARG(&a, pad) = 0; SCARG(&a, length) = SCARG(uap, length); return ftruncate(td, &a); Index: sys/i386/ibcs2/ibcs2_xenix.c =================================================================== RCS file: /home/ncvs/src/sys/i386/ibcs2/ibcs2_xenix.c,v retrieving revision 1.28 diff -u -r1.28 ibcs2_xenix.c --- sys/i386/ibcs2/ibcs2_xenix.c 23 Sep 2002 18:54:31 -0000 1.28 +++ sys/i386/ibcs2/ibcs2_xenix.c 30 Oct 2002 03:23:36 -0000 @@ -97,7 +97,6 @@ DPRINTF(("IBCS2: 'xenix chsize'\n")); SCARG(&sa, fd) = SCARG(uap, fd); - SCARG(&sa, pad) = 0; SCARG(&sa, length) = SCARG(uap, size); return ftruncate(td, &sa); } Index: sys/i386/linux/linux_machdep.c =================================================================== RCS file: /home/ncvs/src/sys/i386/linux/linux_machdep.c,v retrieving revision 1.33 diff -u -r1.33 linux_machdep.c --- sys/i386/linux/linux_machdep.c 19 Oct 2002 11:57:38 -0000 1.33 +++ sys/i386/linux/linux_machdep.c 30 Oct 2002 02:49:57 -0000 @@ -440,7 +440,6 @@ int prot; int flags; int fd; - long pad; off_t pos; } */ bsd_args; @@ -527,7 +526,6 @@ else bsd_args.fd = linux_args->fd; bsd_args.pos = linux_args->pos; - bsd_args.pad = 0; #ifdef DEBUG if (ldebug(mmap)) @@ -817,7 +815,6 @@ #endif sa.fd = args->fd; - sa.pad = 0; sa.length = args->length; return ftruncate(td, &sa); } Index: sys/ia64/conf/GENERIC =================================================================== RCS file: /home/ncvs/src/sys/ia64/conf/GENERIC,v retrieving revision 1.42 diff -u -r1.42 GENERIC --- sys/ia64/conf/GENERIC 26 Oct 2002 04:58:36 -0000 1.42 +++ sys/ia64/conf/GENERIC 30 Oct 2002 15:53:16 -0000 @@ -57,6 +57,8 @@ options SYSVSEM #SYSV-style semaphores options _KPOSIX_PRIORITY_SCHEDULING #Posix P1003_1B real-time extensions +options IA32 + # SMP options SMP Index: sys/kern/init_sysent.c =================================================================== RCS file: /home/ncvs/src/sys/kern/init_sysent.c,v retrieving revision 1.140 diff -u -r1.140 init_sysent.c --- sys/kern/init_sysent.c 25 Oct 2002 19:10:57 -0000 1.140 +++ sys/kern/init_sysent.c 29 Oct 2002 05:14:45 -0000 @@ -2,8 +2,8 @@ * System call switch table. * * DO NOT EDIT-- this file is automatically generated. - * $FreeBSD: src/sys/kern/init_sysent.c,v 1.140 2002/10/25 19:10:57 peter Exp $ - * created from FreeBSD: src/sys/kern/syscalls.master,v 1.133 2002/10/22 14:22:24 rwatson Exp + * $FreeBSD$ + * created from FreeBSD: src/sys/kern/syscalls.master,v 1.134 2002/10/25 19:10:57 peter Exp */ #include "opt_compat.h" @@ -201,8 +201,8 @@ { SYF_MPSAFE | AS(msgsys_args), (sy_call_t *)lkmressys }, /* 170 = msgsys */ { SYF_MPSAFE | AS(shmsys_args), (sy_call_t *)lkmressys }, /* 171 = shmsys */ { 0, (sy_call_t *)nosys }, /* 172 = nosys */ - { SYF_MPSAFE | AS(pread_args), (sy_call_t *)pread }, /* 173 = pread */ - { SYF_MPSAFE | AS(pwrite_args), (sy_call_t *)pwrite }, /* 174 = pwrite */ + { compat4(SYF_MPSAFE | AS(freebsd4_pread_args),pread) }, /* 173 = old pread */ + { compat4(SYF_MPSAFE | AS(freebsd4_pwrite_args),pwrite) }, /* 174 = old pwrite */ { 0, (sy_call_t *)nosys }, /* 175 = nosys */ { SYF_MPSAFE | AS(ntp_adjtime_args), (sy_call_t *)ntp_adjtime }, /* 176 = ntp_adjtime */ { 0, (sy_call_t *)nosys }, /* 177 = sfork */ @@ -225,11 +225,11 @@ { SYF_MPSAFE | AS(__getrlimit_args), (sy_call_t *)getrlimit }, /* 194 = getrlimit */ { SYF_MPSAFE | AS(__setrlimit_args), (sy_call_t *)setrlimit }, /* 195 = setrlimit */ { AS(getdirentries_args), (sy_call_t *)getdirentries }, /* 196 = getdirentries */ - { SYF_MPSAFE | AS(mmap_args), (sy_call_t *)mmap }, /* 197 = mmap */ + { compat4(SYF_MPSAFE | AS(freebsd4_mmap_args),mmap) }, /* 197 = old mmap */ { 0, (sy_call_t *)nosys }, /* 198 = __syscall */ - { AS(lseek_args), (sy_call_t *)lseek }, /* 199 = lseek */ - { AS(truncate_args), (sy_call_t *)truncate }, /* 200 = truncate */ - { AS(ftruncate_args), (sy_call_t *)ftruncate }, /* 201 = ftruncate */ + { compat4(AS(freebsd4_lseek_args),lseek) }, /* 199 = old lseek */ + { compat4(AS(freebsd4_truncate_args),truncate) }, /* 200 = old truncate */ + { compat4(AS(freebsd4_ftruncate_args),ftruncate) }, /* 201 = old ftruncate */ { SYF_MPSAFE | AS(sysctl_args), (sy_call_t *)__sysctl }, /* 202 = __sysctl */ { SYF_MPSAFE | AS(mlock_args), (sy_call_t *)mlock }, /* 203 = mlock */ { SYF_MPSAFE | AS(munlock_args), (sy_call_t *)munlock }, /* 204 = munlock */ @@ -449,4 +449,10 @@ { 0, (sy_call_t *)nosys }, /* 418 = __xstat */ { 0, (sy_call_t *)nosys }, /* 419 = __xfstat */ { 0, (sy_call_t *)nosys }, /* 420 = __xlstat */ + { AS(lseek_args), (sy_call_t *)lseek }, /* 421 = lseek */ + { AS(ftruncate_args), (sy_call_t *)ftruncate }, /* 422 = ftruncate */ + { SYF_MPSAFE | AS(mmap_args), (sy_call_t *)mmap }, /* 423 = mmap */ + { SYF_MPSAFE | AS(pread_args), (sy_call_t *)pread }, /* 424 = pread */ + { SYF_MPSAFE | AS(pwrite_args), (sy_call_t *)pwrite }, /* 425 = pwrite */ + { AS(truncate_args), (sy_call_t *)truncate }, /* 426 = truncate */ }; Index: sys/kern/sys_generic.c =================================================================== RCS file: /home/ncvs/src/sys/kern/sys_generic.c,v retrieving revision 1.115 diff -u -r1.115 sys_generic.c --- sys/kern/sys_generic.c 28 Sep 2002 17:14:55 -0000 1.115 +++ sys/kern/sys_generic.c 29 Oct 2002 04:58:49 -0000 @@ -39,6 +39,7 @@ * $FreeBSD: src/sys/kern/sys_generic.c,v 1.115 2002/09/28 17:14:55 phk Exp $ */ +#include "opt_compat.h" #include "opt_ktrace.h" #include @@ -119,7 +120,6 @@ int fd; void *buf; size_t nbyte; - int pad; off_t offset; }; #endif @@ -146,6 +146,36 @@ return(error); } +#ifdef COMPAT_FREEBSD4 +#ifndef _SYS_SYSPROTO_H_ +struct freebsd4_pread_args { + int fd; + void *buf; + size_t nbyte; + int pad; + off_t offset; +}; +#endif +/* + * MPSAFE + */ +int +freebsd4_pread(td, uap) + struct thread *td; + struct freebsd4_pread_args *uap; +{ + struct pread_args nuap; + int error; + + nuap.fd = uap->fd; + nuap.buf = uap->buf; + nuap.nbyte = uap->nbyte; + nuap.offset = uap->offset; + error = pread(td, &nuap); + return (error); +} +#endif + /* * Code common for read and pread */ @@ -343,7 +373,6 @@ int fd; const void *buf; size_t nbyte; - int pad; off_t offset; }; #endif @@ -371,6 +400,36 @@ } return(error); } + +#ifdef COMPAT_FREEBSD4 +#ifndef _SYS_SYSPROTO_H_ +struct freebsd4_pwrite_args { + int fd; + void *buf; + size_t nbyte; + int pad; + off_t offset; +}; +#endif +/* + * MPSAFE + */ +int +freebsd4_pwrite(td, uap) + struct thread *td; + struct freebsd4_pwrite_args *uap; +{ + struct pwrite_args nuap; + int error; + + nuap.fd = uap->fd; + nuap.buf = uap->buf; + nuap.nbyte = uap->nbyte; + nuap.offset = uap->offset; + error = pwrite(td, &nuap); + return (error); +} +#endif static int dofilewrite(td, fp, fd, buf, nbyte, offset, flags) Index: sys/kern/syscalls.c =================================================================== RCS file: /home/ncvs/src/sys/kern/syscalls.c,v retrieving revision 1.125 diff -u -r1.125 syscalls.c --- sys/kern/syscalls.c 25 Oct 2002 19:10:57 -0000 1.125 +++ sys/kern/syscalls.c 29 Oct 2002 05:14:44 -0000 @@ -2,8 +2,8 @@ * System call names. * * DO NOT EDIT-- this file is automatically generated. - * $FreeBSD: src/sys/kern/syscalls.c,v 1.125 2002/10/25 19:10:57 peter Exp $ - * created from FreeBSD: src/sys/kern/syscalls.master,v 1.133 2002/10/22 14:22:24 rwatson Exp + * $FreeBSD$ + * created from FreeBSD: src/sys/kern/syscalls.master,v 1.134 2002/10/25 19:10:57 peter Exp */ char *syscallnames[] = { @@ -180,8 +180,8 @@ "msgsys", /* 170 = msgsys */ "shmsys", /* 171 = shmsys */ "#172", /* 172 = nosys */ - "pread", /* 173 = pread */ - "pwrite", /* 174 = pwrite */ + "old.pread", /* 173 = old pread */ + "old.pwrite", /* 174 = old pwrite */ "#175", /* 175 = nosys */ "ntp_adjtime", /* 176 = ntp_adjtime */ "#177", /* 177 = sfork */ @@ -204,11 +204,11 @@ "getrlimit", /* 194 = getrlimit */ "setrlimit", /* 195 = setrlimit */ "getdirentries", /* 196 = getdirentries */ - "mmap", /* 197 = mmap */ + "old.mmap", /* 197 = old mmap */ "__syscall", /* 198 = __syscall */ - "lseek", /* 199 = lseek */ - "truncate", /* 200 = truncate */ - "ftruncate", /* 201 = ftruncate */ + "old.lseek", /* 199 = old lseek */ + "old.truncate", /* 200 = old truncate */ + "old.ftruncate", /* 201 = old ftruncate */ "__sysctl", /* 202 = __sysctl */ "mlock", /* 203 = mlock */ "munlock", /* 204 = munlock */ @@ -428,4 +428,10 @@ "#418", /* 418 = __xstat */ "#419", /* 419 = __xfstat */ "#420", /* 420 = __xlstat */ + "lseek", /* 421 = lseek */ + "ftruncate", /* 422 = ftruncate */ + "mmap", /* 423 = mmap */ + "pread", /* 424 = pread */ + "pwrite", /* 425 = pwrite */ + "truncate", /* 426 = truncate */ }; Index: sys/kern/syscalls.master =================================================================== RCS file: /home/ncvs/src/sys/kern/syscalls.master,v retrieving revision 1.134 diff -u -r1.134 syscalls.master --- sys/kern/syscalls.master 25 Oct 2002 19:10:57 -0000 1.134 +++ sys/kern/syscalls.master 29 Oct 2002 05:14:33 -0000 @@ -277,9 +277,9 @@ 171 MNOSTD BSD { int shmsys(int which, int a2, int a3, int a4); } ; XXX should be { int shmsys(int which, ...); } 172 UNIMPL NOHIDE nosys -173 MSTD POSIX { ssize_t pread(int fd, void *buf, size_t nbyte, \ +173 MCOMPAT4 POSIX { ssize_t pread(int fd, void *buf, size_t nbyte, \ int pad, off_t offset); } -174 MSTD POSIX { ssize_t pwrite(int fd, const void *buf, \ +174 MCOMPAT4 POSIX { ssize_t pwrite(int fd, const void *buf, \ size_t nbyte, int pad, off_t offset); } 175 UNIMPL NOHIDE nosys 176 MSTD BSD { int ntp_adjtime(struct timex *tp); } @@ -310,13 +310,13 @@ setrlimit __setrlimit_args int 196 STD BSD { int getdirentries(int fd, char *buf, u_int count, \ long *basep); } -197 MSTD BSD { caddr_t mmap(caddr_t addr, size_t len, int prot, \ +197 MCOMPAT4 BSD { caddr_t mmap(caddr_t addr, size_t len, int prot, \ int flags, int fd, int pad, off_t pos); } 198 STD NOHIDE { int nosys(void); } __syscall __syscall_args int -199 STD POSIX { off_t lseek(int fd, int pad, off_t offset, \ +199 COMPAT4 POSIX { off_t lseek(int fd, int pad, off_t offset, \ int whence); } -200 STD BSD { int truncate(char *path, int pad, off_t length); } -201 STD BSD { int ftruncate(int fd, int pad, off_t length); } +200 COMPAT4 BSD { int truncate(char *path, int pad, off_t length); } +201 COMPAT4 BSD { int ftruncate(int fd, int pad, off_t length); } 202 MSTD BSD { int __sysctl(int *name, u_int namelen, void *old, \ size_t *oldlenp, void *new, size_t newlen); } \ __sysctl sysctl_args int @@ -607,6 +607,15 @@ 418 UNIMPL BSD __xstat 419 UNIMPL BSD __xfstat 420 UNIMPL BSD __xlstat +421 STD POSIX { off_t lseek(int fd, off_t offset, int whence); } +422 STD BSD { int ftruncate(int fd, off_t length); } +423 MSTD BSD { caddr_t mmap(caddr_t addr, size_t len, int prot, \ + int flags, int fd, off_t pos); } +424 MSTD POSIX { ssize_t pread(int fd, void *buf, size_t nbyte, \ + off_t offset); } +425 MSTD POSIX { ssize_t pwrite(int fd, const void *buf, \ + size_t nbyte, off_t offset); } +426 STD BSD { int truncate(char *path, off_t length); } ; Please copy any additions and changes to the following compatability tables: ; sys/ia64/ia32/syscalls.master (take a best guess) Index: sys/kern/vfs_syscalls.c =================================================================== RCS file: /home/ncvs/src/sys/kern/vfs_syscalls.c,v retrieving revision 1.297 diff -u -r1.297 vfs_syscalls.c --- sys/kern/vfs_syscalls.c 27 Oct 2002 23:23:51 -0000 1.297 +++ sys/kern/vfs_syscalls.c 29 Oct 2002 05:38:52 -0000 @@ -1358,6 +1358,40 @@ return (0); } +#ifdef COMPAT_FREEBSD4 +#ifndef _SYS_SYSPROTO_H_ +struct freebsd4_lseek_args { + int fd; + int pad; + off_t offset; + int whence; +}; +#endif +int +freebsd4_lseek(td, uap) + struct thread *td; + struct freebsd4_lseek_args /* { + syscallarg(int) fd; + syscallarg(int) pad; + syscallarg(off_t) offset; + syscallarg(int) whence; + } */ *uap; +{ + struct lseek_args /* { + syscallarg(int) fd; + syscallarg(off_t) offset; + syscallarg(int) whence; + } */ nuap; + int error; + + nuap.fd = uap->fd; + nuap.offset = uap->offset; + nuap.whence = uap->whence; + error = lseek(td, &nuap); + return (error); +} +#endif + #if defined(COMPAT_43) || defined(COMPAT_SUNOS) /* * Reposition read/write file offset. @@ -1380,7 +1414,6 @@ { struct lseek_args /* { syscallarg(int) fd; - syscallarg(int) pad; syscallarg(off_t) offset; syscallarg(int) whence; } */ nuap; @@ -2507,7 +2540,6 @@ #ifndef _SYS_SYSPROTO_H_ struct truncate_args { char *path; - int pad; off_t length; }; #endif @@ -2517,6 +2549,27 @@ struct thread *td; register struct truncate_args /* { syscallarg(char *) path; + syscallarg(off_t) length; + } */ *uap; +{ + + return (kern_truncate(td, uap->path, UIO_USERSPACE, uap->length)); +} + +#ifdef COMPAT_FREEBSD4 +#ifndef _SYS_SYSPROTO_H_ +struct freebsd4_truncate_args { + char *path; + int pad; + off_t length; +}; +#endif +/* ARGSUSED */ +int +freebsd4_truncate(td, uap) + struct thread *td; + register struct freebsd4_truncate_args /* { + syscallarg(char *) path; syscallarg(int) pad; syscallarg(off_t) length; } */ *uap; @@ -2524,6 +2577,7 @@ return (kern_truncate(td, uap->path, UIO_USERSPACE, uap->length)); } +#endif int kern_truncate(struct thread *td, char *path, enum uio_seg pathseg, off_t length) @@ -2570,7 +2624,6 @@ #ifndef _SYS_SYSPROTO_H_ struct ftruncate_args { int fd; - int pad; off_t length; }; #endif @@ -2580,7 +2633,6 @@ struct thread *td; register struct ftruncate_args /* { syscallarg(int) fd; - syscallarg(int) pad; syscallarg(off_t) length; } */ *uap; { @@ -2623,6 +2675,37 @@ return (error); } +#ifdef COMPAT_FREEBSD4 +#ifndef _SYS_SYSPROTO_H_ +struct freebsd4_ftruncate_args { + int fd; + int pad; + off_t length; +}; +#endif +/* ARGSUSED */ +int +freebsd4_ftruncate(td, uap) + struct thread *td; + register struct freebsd4_ftruncate_args /* { + syscallarg(int) fd; + syscallarg(int) pad; + syscallarg(off_t) length; + } */ *uap; +{ + struct ftruncate_args /* { + syscallarg(int) fd; + syscallarg(off_t) length; + } */ nuap; + int error; + + nuap.fd = uap->fd; + nuap.length = uap->length; + error = ftruncate(td, &nuap); + return (error); +} +#endif + #if defined(COMPAT_43) || defined(COMPAT_SUNOS) /* * Truncate a file given its path name. @@ -2644,7 +2727,6 @@ { struct truncate_args /* { syscallarg(char *) path; - syscallarg(int) pad; syscallarg(off_t) length; } */ nuap; @@ -2673,7 +2755,6 @@ { struct ftruncate_args /* { syscallarg(int) fd; - syscallarg(int) pad; syscallarg(off_t) length; } */ nuap; Index: sys/sparc64/sparc64/trap.c =================================================================== RCS file: /home/ncvs/src/sys/sparc64/sparc64/trap.c,v retrieving revision 1.51 diff -u -r1.51 trap.c --- sys/sparc64/sparc64/trap.c 26 Oct 2002 17:38:20 -0000 1.51 +++ sys/sparc64/sparc64/trap.c 27 Oct 2002 17:40:40 -0000 @@ -40,6 +40,7 @@ * $FreeBSD: src/sys/sparc64/sparc64/trap.c,v 1.51 2002/10/26 17:38:20 jake Exp $ */ +#include "opt_compat.h" #include "opt_ddb.h" #include "opt_ktr.h" #include "opt_ktrace.h" @@ -510,17 +511,20 @@ tpc = tf->tf_tpc; TF_DONE(tf); +#if 0 if (p->p_sysent->sv_prepsyscall) { /* * The prep code is MP aware. */ -#if 0 (*p->p_sysent->sv_prepsyscall)(tf, args, &code, ¶ms); + } else #endif - } else if (code == SYS_syscall || code == SYS___syscall) { +#ifdef COMPAT_FREEBSD4 + if (code == SYS_syscall || code == SYS___syscall) { code = tf->tf_out[reg++]; regcnt--; } +#endif if (p->p_sysent->sv_mask) code &= p->p_sysent->sv_mask; Index: sys/sys/syscall.h =================================================================== RCS file: /home/ncvs/src/sys/sys/syscall.h,v retrieving revision 1.124 diff -u -r1.124 syscall.h --- sys/sys/syscall.h 25 Oct 2002 19:10:58 -0000 1.124 +++ sys/sys/syscall.h 29 Oct 2002 05:14:44 -0000 @@ -2,8 +2,8 @@ * System call numbers. * * DO NOT EDIT-- this file is automatically generated. - * $FreeBSD: src/sys/sys/syscall.h,v 1.124 2002/10/25 19:10:58 peter Exp $ - * created from FreeBSD: src/sys/kern/syscalls.master,v 1.133 2002/10/22 14:22:24 rwatson Exp + * $FreeBSD$ + * created from FreeBSD: src/sys/kern/syscalls.master,v 1.134 2002/10/25 19:10:57 peter Exp */ #define SYS_syscall 0 @@ -167,8 +167,8 @@ #define SYS_semsys 169 #define SYS_msgsys 170 #define SYS_shmsys 171 -#define SYS_pread 173 -#define SYS_pwrite 174 + /* 173 is old pread */ + /* 174 is old pwrite */ #define SYS_ntp_adjtime 176 #define SYS_setgid 181 #define SYS_setegid 182 @@ -181,11 +181,11 @@ #define SYS_getrlimit 194 #define SYS_setrlimit 195 #define SYS_getdirentries 196 -#define SYS_mmap 197 + /* 197 is old mmap */ #define SYS___syscall 198 -#define SYS_lseek 199 -#define SYS_truncate 200 -#define SYS_ftruncate 201 + /* 199 is old lseek */ + /* 200 is old truncate */ + /* 201 is old ftruncate */ #define SYS___sysctl 202 #define SYS_mlock 203 #define SYS_munlock 204 @@ -325,4 +325,10 @@ #define SYS_extattr_delete_link 414 #define SYS_sigaction 416 #define SYS_sigreturn 417 -#define SYS_MAXSYSCALL 421 +#define SYS_lseek 421 +#define SYS_ftruncate 422 +#define SYS_mmap 423 +#define SYS_pread 424 +#define SYS_pwrite 425 +#define SYS_truncate 426 +#define SYS_MAXSYSCALL 427 Index: sys/sys/syscall.mk =================================================================== RCS file: /home/ncvs/src/sys/sys/syscall.mk,v retrieving revision 1.79 diff -u -r1.79 syscall.mk --- sys/sys/syscall.mk 25 Oct 2002 19:10:58 -0000 1.79 +++ sys/sys/syscall.mk 29 Oct 2002 05:14:44 -0000 @@ -1,7 +1,7 @@ # FreeBSD system call names. # DO NOT EDIT-- this file is automatically generated. -# $FreeBSD: src/sys/sys/syscall.mk,v 1.79 2002/10/25 19:10:58 peter Exp $ -# created from FreeBSD: src/sys/kern/syscalls.master,v 1.133 2002/10/22 14:22:24 rwatson Exp +# $FreeBSD$ +# created from FreeBSD: src/sys/kern/syscalls.master,v 1.134 2002/10/25 19:10:57 peter Exp MIASM = \ syscall.o \ exit.o \ @@ -119,8 +119,6 @@ semsys.o \ msgsys.o \ shmsys.o \ - pread.o \ - pwrite.o \ ntp_adjtime.o \ setgid.o \ setegid.o \ @@ -133,11 +131,7 @@ getrlimit.o \ setrlimit.o \ getdirentries.o \ - mmap.o \ __syscall.o \ - lseek.o \ - truncate.o \ - ftruncate.o \ __sysctl.o \ mlock.o \ munlock.o \ @@ -270,4 +264,10 @@ extattr_get_link.o \ extattr_delete_link.o \ sigaction.o \ - sigreturn.o + sigreturn.o \ + lseek.o \ + ftruncate.o \ + mmap.o \ + pread.o \ + pwrite.o \ + truncate.o Index: sys/sys/sysproto.h =================================================================== RCS file: /home/ncvs/src/sys/sys/sysproto.h,v retrieving revision 1.117 diff -u -r1.117 sysproto.h --- sys/sys/sysproto.h 25 Oct 2002 19:10:58 -0000 1.117 +++ sys/sys/sysproto.h 29 Oct 2002 05:14:45 -0000 @@ -2,8 +2,8 @@ * System call prototypes. * * DO NOT EDIT-- this file is automatically generated. - * $FreeBSD: src/sys/sys/sysproto.h,v 1.117 2002/10/25 19:10:58 peter Exp $ - * created from FreeBSD: src/sys/kern/syscalls.master,v 1.133 2002/10/22 14:22:24 rwatson Exp + * $FreeBSD$ + * created from FreeBSD: src/sys/kern/syscalls.master,v 1.134 2002/10/25 19:10:57 peter Exp */ #ifndef _SYS_SYSPROTO_H_ @@ -540,20 +540,6 @@ char a3_l_[PADL_(int)]; int a3; char a3_r_[PADR_(int)]; char a4_l_[PADL_(int)]; int a4; char a4_r_[PADR_(int)]; }; -struct pread_args { - char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)]; - char buf_l_[PADL_(void *)]; void * buf; char buf_r_[PADR_(void *)]; - char nbyte_l_[PADL_(size_t)]; size_t nbyte; char nbyte_r_[PADR_(size_t)]; - char pad_l_[PADL_(int)]; int pad; char pad_r_[PADR_(int)]; - char offset_l_[PADL_(off_t)]; off_t offset; char offset_r_[PADR_(off_t)]; -}; -struct pwrite_args { - char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)]; - char buf_l_[PADL_(const void *)]; const void * buf; char buf_r_[PADR_(const void *)]; - char nbyte_l_[PADL_(size_t)]; size_t nbyte; char nbyte_r_[PADR_(size_t)]; - char pad_l_[PADL_(int)]; int pad; char pad_r_[PADR_(int)]; - char offset_l_[PADL_(off_t)]; off_t offset; char offset_r_[PADR_(off_t)]; -}; struct ntp_adjtime_args { char tp_l_[PADL_(struct timex *)]; struct timex * tp; char tp_r_[PADR_(struct timex *)]; }; @@ -600,31 +586,6 @@ char count_l_[PADL_(u_int)]; u_int count; char count_r_[PADR_(u_int)]; char basep_l_[PADL_(long *)]; long * basep; char basep_r_[PADR_(long *)]; }; -struct mmap_args { - char addr_l_[PADL_(caddr_t)]; caddr_t addr; char addr_r_[PADR_(caddr_t)]; - char len_l_[PADL_(size_t)]; size_t len; char len_r_[PADR_(size_t)]; - char prot_l_[PADL_(int)]; int prot; char prot_r_[PADR_(int)]; - char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)]; - char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)]; - char pad_l_[PADL_(int)]; int pad; char pad_r_[PADR_(int)]; - char pos_l_[PADL_(off_t)]; off_t pos; char pos_r_[PADR_(off_t)]; -}; -struct lseek_args { - char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)]; - char pad_l_[PADL_(int)]; int pad; char pad_r_[PADR_(int)]; - char offset_l_[PADL_(off_t)]; off_t offset; char offset_r_[PADR_(off_t)]; - char whence_l_[PADL_(int)]; int whence; char whence_r_[PADR_(int)]; -}; -struct truncate_args { - char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)]; - char pad_l_[PADL_(int)]; int pad; char pad_r_[PADR_(int)]; - char length_l_[PADL_(off_t)]; off_t length; char length_r_[PADR_(off_t)]; -}; -struct ftruncate_args { - char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)]; - char pad_l_[PADL_(int)]; int pad; char pad_r_[PADR_(int)]; - char length_l_[PADL_(off_t)]; off_t length; char length_r_[PADR_(off_t)]; -}; struct sysctl_args { char name_l_[PADL_(int *)]; int * name; char name_r_[PADR_(int *)]; char namelen_l_[PADL_(u_int)]; u_int namelen; char namelen_r_[PADR_(u_int)]; @@ -1185,6 +1146,39 @@ struct sigreturn_args { char sigcntxp_l_[PADL_(const struct __ucontext *)]; const struct __ucontext * sigcntxp; char sigcntxp_r_[PADR_(const struct __ucontext *)]; }; +struct lseek_args { + char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)]; + char offset_l_[PADL_(off_t)]; off_t offset; char offset_r_[PADR_(off_t)]; + char whence_l_[PADL_(int)]; int whence; char whence_r_[PADR_(int)]; +}; +struct ftruncate_args { + char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)]; + char length_l_[PADL_(off_t)]; off_t length; char length_r_[PADR_(off_t)]; +}; +struct mmap_args { + char addr_l_[PADL_(caddr_t)]; caddr_t addr; char addr_r_[PADR_(caddr_t)]; + char len_l_[PADL_(size_t)]; size_t len; char len_r_[PADR_(size_t)]; + char prot_l_[PADL_(int)]; int prot; char prot_r_[PADR_(int)]; + char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)]; + char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)]; + char pos_l_[PADL_(off_t)]; off_t pos; char pos_r_[PADR_(off_t)]; +}; +struct pread_args { + char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)]; + char buf_l_[PADL_(void *)]; void * buf; char buf_r_[PADR_(void *)]; + char nbyte_l_[PADL_(size_t)]; size_t nbyte; char nbyte_r_[PADR_(size_t)]; + char offset_l_[PADL_(off_t)]; off_t offset; char offset_r_[PADR_(off_t)]; +}; +struct pwrite_args { + char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)]; + char buf_l_[PADL_(const void *)]; const void * buf; char buf_r_[PADR_(const void *)]; + char nbyte_l_[PADL_(size_t)]; size_t nbyte; char nbyte_r_[PADR_(size_t)]; + char offset_l_[PADL_(off_t)]; off_t offset; char offset_r_[PADR_(off_t)]; +}; +struct truncate_args { + char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)]; + char length_l_[PADL_(off_t)]; off_t length; char length_r_[PADR_(off_t)]; +}; int nosys(struct thread *, struct nosys_args *); void sys_exit(struct thread *, struct sys_exit_args *); int fork(struct thread *, struct fork_args *); @@ -1301,8 +1295,6 @@ int semsys(struct thread *, struct semsys_args *); int msgsys(struct thread *, struct msgsys_args *); int shmsys(struct thread *, struct shmsys_args *); -int pread(struct thread *, struct pread_args *); -int pwrite(struct thread *, struct pwrite_args *); int ntp_adjtime(struct thread *, struct ntp_adjtime_args *); int setgid(struct thread *, struct setgid_args *); int setegid(struct thread *, struct setegid_args *); @@ -1315,10 +1307,6 @@ int getrlimit(struct thread *, struct __getrlimit_args *); int setrlimit(struct thread *, struct __setrlimit_args *); int getdirentries(struct thread *, struct getdirentries_args *); -int mmap(struct thread *, struct mmap_args *); -int lseek(struct thread *, struct lseek_args *); -int truncate(struct thread *, struct truncate_args *); -int ftruncate(struct thread *, struct ftruncate_args *); int __sysctl(struct thread *, struct sysctl_args *); int mlock(struct thread *, struct mlock_args *); int munlock(struct thread *, struct munlock_args *); @@ -1452,6 +1440,12 @@ int extattr_delete_link(struct thread *, struct extattr_delete_link_args *); int sigaction(struct thread *, struct sigaction_args *); int sigreturn(struct thread *, struct sigreturn_args *); +int lseek(struct thread *, struct lseek_args *); +int ftruncate(struct thread *, struct ftruncate_args *); +int mmap(struct thread *, struct mmap_args *); +int pread(struct thread *, struct pread_args *); +int pwrite(struct thread *, struct pwrite_args *); +int truncate(struct thread *, struct truncate_args *); #ifdef COMPAT_43 @@ -1627,6 +1621,45 @@ #ifdef COMPAT_FREEBSD4 +struct freebsd4_pread_args { + char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)]; + char buf_l_[PADL_(void *)]; void * buf; char buf_r_[PADR_(void *)]; + char nbyte_l_[PADL_(size_t)]; size_t nbyte; char nbyte_r_[PADR_(size_t)]; + char pad_l_[PADL_(int)]; int pad; char pad_r_[PADR_(int)]; + char offset_l_[PADL_(off_t)]; off_t offset; char offset_r_[PADR_(off_t)]; +}; +struct freebsd4_pwrite_args { + char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)]; + char buf_l_[PADL_(const void *)]; const void * buf; char buf_r_[PADR_(const void *)]; + char nbyte_l_[PADL_(size_t)]; size_t nbyte; char nbyte_r_[PADR_(size_t)]; + char pad_l_[PADL_(int)]; int pad; char pad_r_[PADR_(int)]; + char offset_l_[PADL_(off_t)]; off_t offset; char offset_r_[PADR_(off_t)]; +}; +struct freebsd4_mmap_args { + char addr_l_[PADL_(caddr_t)]; caddr_t addr; char addr_r_[PADR_(caddr_t)]; + char len_l_[PADL_(size_t)]; size_t len; char len_r_[PADR_(size_t)]; + char prot_l_[PADL_(int)]; int prot; char prot_r_[PADR_(int)]; + char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)]; + char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)]; + char pad_l_[PADL_(int)]; int pad; char pad_r_[PADR_(int)]; + char pos_l_[PADL_(off_t)]; off_t pos; char pos_r_[PADR_(off_t)]; +}; +struct freebsd4_lseek_args { + char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)]; + char pad_l_[PADL_(int)]; int pad; char pad_r_[PADR_(int)]; + char offset_l_[PADL_(off_t)]; off_t offset; char offset_r_[PADR_(off_t)]; + char whence_l_[PADL_(int)]; int whence; char whence_r_[PADR_(int)]; +}; +struct freebsd4_truncate_args { + char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)]; + char pad_l_[PADL_(int)]; int pad; char pad_r_[PADR_(int)]; + char length_l_[PADL_(off_t)]; off_t length; char length_r_[PADR_(off_t)]; +}; +struct freebsd4_ftruncate_args { + char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)]; + char pad_l_[PADL_(int)]; int pad; char pad_r_[PADR_(int)]; + char length_l_[PADL_(off_t)]; off_t length; char length_r_[PADR_(off_t)]; +}; struct freebsd4_sendfile_args { char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)]; char s_l_[PADL_(int)]; int s; char s_r_[PADR_(int)]; @@ -1644,6 +1677,12 @@ struct freebsd4_sigreturn_args { char sigcntxp_l_[PADL_(const struct ucontext4 *)]; const struct ucontext4 * sigcntxp; char sigcntxp_r_[PADR_(const struct ucontext4 *)]; }; +int freebsd4_pread(struct thread *, struct freebsd4_pread_args *); +int freebsd4_pwrite(struct thread *, struct freebsd4_pwrite_args *); +int freebsd4_mmap(struct thread *, struct freebsd4_mmap_args *); +int freebsd4_lseek(struct thread *, struct freebsd4_lseek_args *); +int freebsd4_truncate(struct thread *, struct freebsd4_truncate_args *); +int freebsd4_ftruncate(struct thread *, struct freebsd4_ftruncate_args *); int freebsd4_sendfile(struct thread *, struct freebsd4_sendfile_args *); int freebsd4_sigaction(struct thread *, struct freebsd4_sigaction_args *); int freebsd4_sigreturn(struct thread *, struct freebsd4_sigreturn_args *); Index: sys/vm/vm_mmap.c =================================================================== RCS file: /home/ncvs/src/sys/vm/vm_mmap.c,v retrieving revision 1.152 diff -u -r1.152 vm_mmap.c --- sys/vm/vm_mmap.c 22 Oct 2002 15:56:44 -0000 1.152 +++ sys/vm/vm_mmap.c 29 Oct 2002 05:03:26 -0000 @@ -188,7 +188,6 @@ int prot; int flags; int fd; - long pad; off_t pos; }; #endif @@ -450,6 +449,40 @@ return (error); } + +#ifdef COMPAT_FREEBSD4 +#ifndef _SYS_SYSPROTO_H_ +struct freebsd4_mmap_args { + void *addr; + size_t len; + int prot; + int flags; + int fd; + int pad; + off_t pos; +}; +#endif +/* + * MPSAFE + */ +int +freebsd4_mmap(td, uap) + struct thread *td; + struct freebsd4_mmap_args *uap; +{ + struct mmap_args nuap; + int error; + + nuap.addr = uap->addr; + nuap.len = uap->len; + nuap.prot = uap->prot; + nuap.flags = uap->flags; + nuap.fd = uap->fd; + nuap.pos = uap->pos; + error = mmap(td, &nuap); + return (error); +} +#endif #ifdef COMPAT_43 #ifndef _SYS_SYSPROTO_H_