From owner-svn-src-head@FreeBSD.ORG Sat Apr 18 21:50:19 2015 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id EE0A5D1B; Sat, 18 Apr 2015 21:50:19 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D90F97C2; Sat, 18 Apr 2015 21:50:19 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t3ILoJhg003193; Sat, 18 Apr 2015 21:50:19 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t3ILoE4O003128; Sat, 18 Apr 2015 21:50:14 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201504182150.t3ILoE4O003128@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 18 Apr 2015 21:50:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r281714 - in head: lib/libc lib/libc/amd64/sys lib/libc/arm/sys lib/libc/i386/sys lib/libc/include lib/libc/mips/sys lib/libc/powerpc/sys lib/libc/powerpc64/sys lib/libc/sparc64/sys lib... X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 18 Apr 2015 21:50:20 -0000 Author: kib Date: Sat Apr 18 21:50:13 2015 New Revision: 281714 URL: https://svnweb.freebsd.org/changeset/base/281714 Log: The lseek(2), mmap(2), truncate(2), ftruncate(2), pread(2), and pwrite(2) syscalls are wrapped to provide compatibility with pre-7.x kernels which required padding before the off_t parameter. The fcntl(2) contains compatibility code to handle kernels before the struct flock was changed during the 8.x CURRENT development. The shims were reasonable to allow easier revert to the older kernel at that time. Now, two or three major releases later, shims do not serve any purpose. Such old kernels cannot handle current libc, so revert the compatibility code. Make padded syscalls support conditional under the COMPAT6 config option. For COMPAT32, the syscalls were under COMPAT6 already. Remove WITHOUT_SYSCALL_COMPAT build option, which only purpose was to (partially) disable the removed shims. Reviewed by: jhb, imp (previous versions) Discussed with: peter Sponsored by: The FreeBSD Foundation MFC after: 1 week Deleted: head/lib/libc/sys/ftruncate.c head/lib/libc/sys/lseek.c head/lib/libc/sys/mmap.c head/lib/libc/sys/pread.c head/lib/libc/sys/pwrite.c head/lib/libc/sys/truncate.c head/tools/build/options/WITHOUT_SYSCALL_COMPAT Modified: head/lib/libc/Makefile head/lib/libc/amd64/sys/Makefile.inc head/lib/libc/arm/sys/Makefile.inc head/lib/libc/i386/sys/Makefile.inc head/lib/libc/include/compat.h head/lib/libc/include/libc_private.h head/lib/libc/mips/sys/Makefile.inc head/lib/libc/powerpc/sys/Makefile.inc head/lib/libc/powerpc64/sys/Makefile.inc head/lib/libc/sparc64/sys/Makefile.inc head/lib/libc/sys/Makefile.inc head/lib/libc/sys/fcntl.c head/lib/libc/sys/interposing_table.c head/lib/libthr/Makefile head/lib/libthr/thread/thr_syscalls.c head/share/mk/src.opts.mk head/sys/kern/sys_generic.c head/sys/kern/syscalls.master head/sys/kern/vfs_syscalls.c head/sys/vm/vm_mmap.c Modified: head/lib/libc/Makefile ============================================================================== --- head/lib/libc/Makefile Sat Apr 18 21:39:17 2015 (r281713) +++ head/lib/libc/Makefile Sat Apr 18 21:50:13 2015 (r281714) @@ -157,10 +157,6 @@ libkern.${LIBC_ARCH}:: ${KMSRCS} ${CP} ${.ALLSRC} ${DESTDIR}/sys/libkern/${LIBC_ARCH} .endif -.if ${MK_SYSCALL_COMPAT} != "no" -CFLAGS+=-DSYSCALL_COMPAT -.endif - .include .include Modified: head/lib/libc/amd64/sys/Makefile.inc ============================================================================== --- head/lib/libc/amd64/sys/Makefile.inc Sat Apr 18 21:39:17 2015 (r281713) +++ head/lib/libc/amd64/sys/Makefile.inc Sat Apr 18 21:50:13 2015 (r281714) @@ -11,6 +11,3 @@ MDASM= vfork.S brk.S cerror.S exect.S ge NOASM= break.o exit.o getlogin.o openbsd_poll.o sstk.o vfork.o yield.o PSEUDO= _getlogin.o _exit.o -.if ${MK_SYSCALL_COMPAT} != "no" -PSEUDO+= _pread.o _pwrite.o _lseek.o _mmap.o _ftruncate.o _truncate.o -.endif Modified: head/lib/libc/arm/sys/Makefile.inc ============================================================================== --- head/lib/libc/arm/sys/Makefile.inc Sat Apr 18 21:39:17 2015 (r281713) +++ head/lib/libc/arm/sys/Makefile.inc Sat Apr 18 21:50:13 2015 (r281714) @@ -8,6 +8,3 @@ MDASM= Ovfork.S brk.S cerror.S pipe.S pt NOASM= break.o exit.o getlogin.o openbsd_poll.o sstk.o vfork.o yield.o PSEUDO= _exit.o _getlogin.o -.if ${MK_SYSCALL_COMPAT} != "no" -PSEUDO+= _pread.o _pwrite.o _lseek.o _mmap.o _ftruncate.o _truncate.o -.endif Modified: head/lib/libc/i386/sys/Makefile.inc ============================================================================== --- head/lib/libc/i386/sys/Makefile.inc Sat Apr 18 21:39:17 2015 (r281713) +++ head/lib/libc/i386/sys/Makefile.inc Sat Apr 18 21:50:13 2015 (r281714) @@ -15,9 +15,6 @@ MDASM= Ovfork.S brk.S cerror.S exect.S g NOASM= break.o exit.o getlogin.o openbsd_poll.o sstk.o vfork.o yield.o PSEUDO= _getlogin.o _exit.o -.if ${MK_SYSCALL_COMPAT} != "no" -PSEUDO+= _pread.o _pwrite.o _lseek.o _mmap.o _ftruncate.o _truncate.o -.endif MAN+= i386_get_ioperm.2 i386_get_ldt.2 i386_vm86.2 MAN+= i386_set_watch.3 Modified: head/lib/libc/include/compat.h ============================================================================== --- head/lib/libc/include/compat.h Sat Apr 18 21:39:17 2015 (r281713) +++ head/lib/libc/include/compat.h Sat Apr 18 21:50:13 2015 (r281714) @@ -47,9 +47,7 @@ __sym_compat(shmctl, freebsd7_shmctl, FB #define __weak_reference(sym,alias) \ .weak alias;.equ alias,sym -#ifndef SYSCALL_COMPAT __weak_reference(__sys_fcntl,__fcntl_compat) -#endif #undef __weak_reference Modified: head/lib/libc/include/libc_private.h ============================================================================== --- head/lib/libc/include/libc_private.h Sat Apr 18 21:39:17 2015 (r281713) +++ head/lib/libc/include/libc_private.h Sat Apr 18 21:50:13 2015 (r281714) @@ -278,21 +278,12 @@ extern void (*__cleanup)(void) __hidden; /* * Get kern.osreldate to detect ABI revisions. Explicitly - * ignores value of $OSVERSION and caches result. Prototypes - * for the wrapped "new" pad-less syscalls are here for now. + * ignores value of $OSVERSION and caches result. */ int __getosreldate(void); #include #include -/* With pad */ -__off_t __sys_freebsd6_lseek(int, int, __off_t, int); -int __sys_freebsd6_ftruncate(int, int, __off_t); -int __sys_freebsd6_truncate(const char *, int, __off_t); -__ssize_t __sys_freebsd6_pread(int, void *, __size_t, int, __off_t); -__ssize_t __sys_freebsd6_pwrite(int, const void *, __size_t, int, __off_t); -void * __sys_freebsd6_mmap(void *, __size_t, int, int, int, int, __off_t); - struct aiocb; struct fd_set; struct iovec; Modified: head/lib/libc/mips/sys/Makefile.inc ============================================================================== --- head/lib/libc/mips/sys/Makefile.inc Sat Apr 18 21:39:17 2015 (r281713) +++ head/lib/libc/mips/sys/Makefile.inc Sat Apr 18 21:50:13 2015 (r281714) @@ -6,10 +6,6 @@ MDASM= Ovfork.S brk.S cerror.S exect.S fork.S pipe.S ptrace.S sbrk.S syscall.S # Don't generate default code for these syscalls: -NOASM= break.o exit.o ftruncate.o getlogin.o lseek.o mmap.o \ - openbsd_poll.o pread.o pwrite.o sstk.o truncate.o vfork.o yield.o +NOASM= break.o exit.o getlogin.o openbsd_poll.o sstk.o vfork.o yield.o PSEUDO= _exit.o _getlogin.o -.if ${MK_SYSCALL_COMPAT} != "no" -PSEUDO+= _pread.o _pwrite.o _lseek.o _mmap.o _ftruncate.o _truncate.o -.endif Modified: head/lib/libc/powerpc/sys/Makefile.inc ============================================================================== --- head/lib/libc/powerpc/sys/Makefile.inc Sat Apr 18 21:39:17 2015 (r281713) +++ head/lib/libc/powerpc/sys/Makefile.inc Sat Apr 18 21:50:13 2015 (r281714) @@ -6,6 +6,3 @@ MDASM+= brk.S cerror.S exect.S pipe.S pt NOASM= break.o exit.o getlogin.o openbsd_poll.o sstk.o yield.o PSEUDO= _getlogin.o _exit.o -.if ${MK_SYSCALL_COMPAT} != "no" -PSEUDO+= _pread.o _pwrite.o _lseek.o _mmap.o _ftruncate.o _truncate.o -.endif Modified: head/lib/libc/powerpc64/sys/Makefile.inc ============================================================================== --- head/lib/libc/powerpc64/sys/Makefile.inc Sat Apr 18 21:39:17 2015 (r281713) +++ head/lib/libc/powerpc64/sys/Makefile.inc Sat Apr 18 21:50:13 2015 (r281714) @@ -6,6 +6,3 @@ MDASM+= brk.S cerror.S exect.S pipe.S pt NOASM= break.o exit.o getlogin.o openbsd_poll.o sstk.o yield.o PSEUDO= _getlogin.o _exit.o -.if ${MK_SYSCALL_COMPAT} != "no" -PSEUDO+= _pread.o _pwrite.o _lseek.o _mmap.o _ftruncate.o _truncate.o -.endif Modified: head/lib/libc/sparc64/sys/Makefile.inc ============================================================================== --- head/lib/libc/sparc64/sys/Makefile.inc Sat Apr 18 21:39:17 2015 (r281713) +++ head/lib/libc/sparc64/sys/Makefile.inc Sat Apr 18 21:50:13 2015 (r281714) @@ -18,6 +18,3 @@ MDASM+= brk.S cerror.S exect.S pipe.S pt NOASM= break.o exit.o getlogin.o openbsd_poll.o sstk.o yield.o PSEUDO= _getlogin.o _exit.o -.if ${MK_SYSCALL_COMPAT} != "no" -PSEUDO+= _pread.o _pwrite.o _lseek.o _mmap.o _ftruncate.o _truncate.o -.endif Modified: head/lib/libc/sys/Makefile.inc ============================================================================== --- head/lib/libc/sys/Makefile.inc Sat Apr 18 21:39:17 2015 (r281713) +++ head/lib/libc/sys/Makefile.inc Sat Apr 18 21:50:13 2015 (r281714) @@ -26,18 +26,6 @@ SRCS+= \ __error.c \ interposing_table.c -.if ${MK_SYSCALL_COMPAT} != "no" -SYSCALL_COMPAT_SRCS= \ - ftruncate.c \ - lseek.c \ - mmap.c \ - pread.c \ - pwrite.c \ - truncate.c -SRCS+= ${SYSCALL_COMPAT_SRCS} -NOASM+= ${SYSCALL_COMPAT_SRCS:S/.c/.o/} -.endif - SRCS+= futimens.c utimensat.c NOASM+= futimens.o utimensat.o PSEUDO+= _futimens.o _utimensat.o Modified: head/lib/libc/sys/fcntl.c ============================================================================== --- head/lib/libc/sys/fcntl.c Sat Apr 18 21:39:17 2015 (r281713) +++ head/lib/libc/sys/fcntl.c Sat Apr 18 21:50:13 2015 (r281714) @@ -3,6 +3,12 @@ * Authors: Doug Rabson * Developed with Red Inc: Alfred Perlstein * + * Copyright (c) 2014-2015 The FreeBSD Foundation. + * All rights reserved. + * + * Portions of this software were developed by Konstantin Belousov + * under sponsorship from the FreeBSD Foundation. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -48,59 +54,3 @@ fcntl(int fd, int cmd, ...) return (((int (*)(int, int, ...)) __libc_interposing[INTERPOS_fcntl])(fd, cmd, arg)); } - -#ifdef SYSCALL_COMPAT -__weak_reference(__fcntl_compat, __fcntl); - -int -__fcntl_compat(int fd, int cmd, ...) -{ - va_list args; - long arg; - struct __oflock ofl; - struct flock *flp; - int res; - - va_start(args, cmd); - arg = va_arg(args, long); - va_end(args); - - if (__getosreldate() >= 800028) { - return (__sys_fcntl(fd, cmd, arg)); - } else { - if (cmd == F_GETLK || cmd == F_SETLK || cmd == F_SETLKW) { - /* - * Convert new-style struct flock (which - * includes l_sysid) to old-style. - */ - flp = (struct flock *) (uintptr_t) arg; - ofl.l_start = flp->l_start; - ofl.l_len = flp->l_len; - ofl.l_pid = flp->l_pid; - ofl.l_type = flp->l_type; - ofl.l_whence = flp->l_whence; - - switch (cmd) { - case F_GETLK: - res = __sys_fcntl(fd, F_OGETLK, &ofl); - if (res >= 0) { - flp->l_start = ofl.l_start; - flp->l_len = ofl.l_len; - flp->l_pid = ofl.l_pid; - flp->l_type = ofl.l_type; - flp->l_whence = ofl.l_whence; - flp->l_sysid = 0; - } - return (res); - - case F_SETLK: - return (__sys_fcntl(fd, F_OSETLK, &ofl)); - - case F_SETLKW: - return (__sys_fcntl(fd, F_OSETLKW, &ofl)); - } - } - return (__sys_fcntl(fd, cmd, arg)); - } -} -#endif Modified: head/lib/libc/sys/interposing_table.c ============================================================================== --- head/lib/libc/sys/interposing_table.c Sat Apr 18 21:39:17 2015 (r281713) +++ head/lib/libc/sys/interposing_table.c Sat Apr 18 21:50:13 2015 (r281714) @@ -44,7 +44,7 @@ interpos_func_t __libc_interposing[INTER SLOT(aio_suspend, __sys_aio_suspend), SLOT(close, __sys_close), SLOT(connect, __sys_connect), - SLOT(fcntl, __fcntl_compat), + SLOT(fcntl, __sys_fcntl), SLOT(fsync, __sys_fsync), SLOT(fork, __sys_fork), SLOT(msync, __sys_msync), Modified: head/lib/libthr/Makefile ============================================================================== --- head/lib/libthr/Makefile Sat Apr 18 21:39:17 2015 (r281713) +++ head/lib/libthr/Makefile Sat Apr 18 21:50:13 2015 (r281714) @@ -61,10 +61,6 @@ SYMLINKS+=lib${LIB}.so ${LIBDIR}/libpthr SYMLINKS+=lib${LIB}_p.a ${LIBDIR}/libpthread_p.a .endif -.if ${MK_SYSCALL_COMPAT} != "no" -CFLAGS+=-DSYSCALL_COMPAT -.endif - .include .include Modified: head/lib/libthr/thread/thr_syscalls.c ============================================================================== --- head/lib/libthr/thread/thr_syscalls.c Sat Apr 18 21:39:17 2015 (r281713) +++ head/lib/libthr/thread/thr_syscalls.c Sat Apr 18 21:50:13 2015 (r281714) @@ -95,10 +95,6 @@ __FBSDID("$FreeBSD$"); #include "libc_private.h" #include "thr_private.h" -#ifdef SYSCALL_COMPAT -extern int __fcntl_compat(int, int, ...); -#endif - static int __thr_accept(int s, struct sockaddr *addr, socklen_t *addrlen) { @@ -203,18 +199,10 @@ __thr_fcntl(int fd, int cmd, ...) va_start(ap, cmd); if (cmd == F_OSETLKW || cmd == F_SETLKW) { _thr_cancel_enter(curthread); -#ifdef SYSCALL_COMPAT - ret = __fcntl_compat(fd, cmd, va_arg(ap, void *)); -#else ret = __sys_fcntl(fd, cmd, va_arg(ap, void *)); -#endif _thr_cancel_leave(curthread, ret == -1); } else { -#ifdef SYSCALL_COMPAT - ret = __fcntl_compat(fd, cmd, va_arg(ap, void *)); -#else ret = __sys_fcntl(fd, cmd, va_arg(ap, void *)); -#endif } va_end(ap); Modified: head/share/mk/src.opts.mk ============================================================================== --- head/share/mk/src.opts.mk Sat Apr 18 21:39:17 2015 (r281713) +++ head/share/mk/src.opts.mk Sat Apr 18 21:50:13 2015 (r281714) @@ -154,7 +154,6 @@ __DEFAULT_YES_OPTIONS = \ SOURCELESS_HOST \ SOURCELESS_UCODE \ SVNLITE \ - SYSCALL_COMPAT \ SYSCONS \ SYSINSTALL \ TALK \ @@ -235,8 +234,6 @@ __DEFAULT_NO_OPTIONS+=CLANG CLANG_BOOTST .endif .if ${__T} == "aarch64" BROKEN_OPTIONS+=BINUTILS BINUTILS_BOOTSTRAP GDB -# There was no support for arm64 prior to FreeBSD 11 -BROKEN_OPTIONS+=SYSCALL_COMPAT .endif .include Modified: head/sys/kern/sys_generic.c ============================================================================== --- head/sys/kern/sys_generic.c Sat Apr 18 21:39:17 2015 (r281713) +++ head/sys/kern/sys_generic.c Sat Apr 18 21:50:13 2015 (r281714) @@ -219,6 +219,7 @@ sys_pread(td, uap) return(error); } +#if defined(COMPAT_FREEBSD6) int freebsd6_pread(td, uap) struct thread *td; @@ -232,6 +233,7 @@ freebsd6_pread(td, uap) oargs.offset = uap->offset; return (sys_pread(td, &oargs)); } +#endif /* * Scatter read system call. @@ -430,6 +432,7 @@ sys_pwrite(td, uap) return(error); } +#if defined(COMPAT_FREEBSD6) int freebsd6_pwrite(td, uap) struct thread *td; @@ -443,6 +446,7 @@ freebsd6_pwrite(td, uap) oargs.offset = uap->offset; return (sys_pwrite(td, &oargs)); } +#endif /* * Gather write system call. Modified: head/sys/kern/syscalls.master ============================================================================== --- head/sys/kern/syscalls.master Sat Apr 18 21:39:17 2015 (r281713) +++ head/sys/kern/syscalls.master Sat Apr 18 21:50:13 2015 (r281714) @@ -342,9 +342,9 @@ int a4); } ; XXX should be { int shmsys(int which, ...); } 172 AUE_NULL UNIMPL nosys -173 AUE_PREAD STD { ssize_t freebsd6_pread(int fd, void *buf, \ +173 AUE_PREAD COMPAT6 { ssize_t pread(int fd, void *buf, \ size_t nbyte, int pad, off_t offset); } -174 AUE_PWRITE STD { ssize_t freebsd6_pwrite(int fd, \ +174 AUE_PWRITE COMPAT6 { ssize_t pwrite(int fd, \ const void *buf, \ size_t nbyte, int pad, off_t offset); } 175 AUE_NULL STD { int setfib(int fibnum); } @@ -376,16 +376,16 @@ __setrlimit_args int 196 AUE_GETDIRENTRIES STD { int getdirentries(int fd, char *buf, \ u_int count, long *basep); } -197 AUE_MMAP STD { caddr_t freebsd6_mmap(caddr_t addr, \ +197 AUE_MMAP COMPAT6 { caddr_t mmap(caddr_t addr, \ size_t len, int prot, int flags, int fd, \ int pad, off_t pos); } 198 AUE_NULL NOPROTO { int nosys(void); } __syscall \ __syscall_args int -199 AUE_LSEEK STD { off_t freebsd6_lseek(int fd, int pad, \ +199 AUE_LSEEK COMPAT6 { off_t lseek(int fd, int pad, \ off_t offset, int whence); } -200 AUE_TRUNCATE STD { int freebsd6_truncate(char *path, int pad, \ +200 AUE_TRUNCATE COMPAT6 { int truncate(char *path, int pad, \ off_t length); } -201 AUE_FTRUNCATE STD { int freebsd6_ftruncate(int fd, int pad, \ +201 AUE_FTRUNCATE COMPAT6 { int ftruncate(int fd, int pad, \ off_t length); } 202 AUE_SYSCTL STD { int __sysctl(int *name, u_int namelen, \ void *old, size_t *oldlenp, void *new, \ Modified: head/sys/kern/vfs_syscalls.c ============================================================================== --- head/sys/kern/vfs_syscalls.c Sat Apr 18 21:39:17 2015 (r281713) +++ head/sys/kern/vfs_syscalls.c Sat Apr 18 21:50:13 2015 (r281714) @@ -1933,6 +1933,7 @@ olseek(td, uap) } #endif /* COMPAT_43 */ +#if defined(COMPAT_FREEBSD6) /* Version with the 'pad' argument */ int freebsd6_lseek(td, uap) @@ -1946,6 +1947,7 @@ freebsd6_lseek(td, uap) ouap.whence = uap->whence; return (sys_lseek(td, &ouap)); } +#endif /* * Check access permissions using passed credentials. @@ -3423,6 +3425,7 @@ otruncate(td, uap) } #endif /* COMPAT_43 */ +#if defined(COMPAT_FREEBSD6) /* Versions with the pad argument */ int freebsd6_truncate(struct thread *td, struct freebsd6_truncate_args *uap) @@ -3443,6 +3446,7 @@ freebsd6_ftruncate(struct thread *td, st ouap.length = uap->length; return (sys_ftruncate(td, &ouap)); } +#endif /* * Sync an open file. Modified: head/sys/vm/vm_mmap.c ============================================================================== --- head/sys/vm/vm_mmap.c Sat Apr 18 21:39:17 2015 (r281713) +++ head/sys/vm/vm_mmap.c Sat Apr 18 21:50:13 2015 (r281714) @@ -462,6 +462,7 @@ done: return (error); } +#if defined(COMPAT_FREEBSD6) int freebsd6_mmap(struct thread *td, struct freebsd6_mmap_args *uap) { @@ -475,6 +476,7 @@ freebsd6_mmap(struct thread *td, struct oargs.pos = uap->pos; return (sys_mmap(td, &oargs)); } +#endif #ifdef COMPAT_43 #ifndef _SYS_SYSPROTO_H_