Discussion:
Removal of the 6.x kernel compat code from libc
Konstantin Belousov
2015-04-17 07:59:42 UTC
Permalink
Our libc changes in sync with the kernel, but switching of libc to use
new interfaces means that upgrade of the userspace becomes the flag day.
People usually add backward-compatible shims for libc to use older
interfaces on old kernels.

There is no reason to keep the compat shims after many years of the
transition. Patch below purges the compat code for pre-r171219, which
added pad-less versions of syscalls taking off_t, and for r177911, which
handles the struct flock/oflock transition. This is 6.x/7.x compat,
we absolutely not support running HEAD libc on such old kernels.

diff --git a/lib/libc/amd64/sys/Makefile.inc b/lib/libc/amd64/sys/Makefile.inc
index 8e0d614..46ea955 100644
--- a/lib/libc/amd64/sys/Makefile.inc
+++ b/lib/libc/amd64/sys/Makefile.inc
@@ -11,6 +11,3 @@ MDASM= vfork.S brk.S cerror.S exect.S getcontext.S pipe.S ptrace.S \
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
diff --git a/lib/libc/arm/sys/Makefile.inc b/lib/libc/arm/sys/Makefile.inc
index f36ab71..60c2dc3 100644
--- a/lib/libc/arm/sys/Makefile.inc
+++ b/lib/libc/arm/sys/Makefile.inc
@@ -8,6 +8,3 @@ MDASM= Ovfork.S brk.S cerror.S pipe.S ptrace.S sbrk.S shmat.S sigreturn.S syscal
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
diff --git a/lib/libc/i386/sys/Makefile.inc b/lib/libc/i386/sys/Makefile.inc
index b56183c..ebaa462 100644
--- a/lib/libc/i386/sys/Makefile.inc
+++ b/lib/libc/i386/sys/Makefile.inc
@@ -15,9 +15,6 @@ MDASM= Ovfork.S brk.S cerror.S exect.S getcontext.S pipe.S ptrace.S \
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
diff --git a/lib/libc/include/compat.h b/lib/libc/include/compat.h
index 2b8f0de..6ab17d7 100644
--- a/lib/libc/include/compat.h
+++ b/lib/libc/include/compat.h
@@ -47,9 +47,7 @@ __sym_compat(shmctl, freebsd7_shmctl, FBSD_1.0);
#define __weak_reference(sym,alias) \
.weak alias;.equ alias,sym

-#ifndef SYSCALL_COMPAT
__weak_reference(__sys_fcntl,__fcntl_compat)
-#endif

#undef __weak_reference

diff --git a/lib/libc/include/libc_private.h b/lib/libc/include/libc_private.h
index ceaa2a3..53be867 100644
--- a/lib/libc/include/libc_private.h
+++ b/lib/libc/include/libc_private.h
@@ -276,21 +276,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 <sys/_types.h>
#include <sys/_sigset.h>

-/* 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;
diff --git a/lib/libc/powerpc/sys/Makefile.inc b/lib/libc/powerpc/sys/Makefile.inc
index ad98ba1..98ec888 100644
--- a/lib/libc/powerpc/sys/Makefile.inc
+++ b/lib/libc/powerpc/sys/Makefile.inc
@@ -6,6 +6,3 @@ MDASM+= brk.S cerror.S exect.S pipe.S ptrace.S sbrk.S setlogin.S
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
diff --git a/lib/libc/powerpc64/sys/Makefile.inc b/lib/libc/powerpc64/sys/Makefile.inc
index ad98ba1..98ec888 100644
--- a/lib/libc/powerpc64/sys/Makefile.inc
+++ b/lib/libc/powerpc64/sys/Makefile.inc
@@ -6,6 +6,3 @@ MDASM+= brk.S cerror.S exect.S pipe.S ptrace.S sbrk.S setlogin.S
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
diff --git a/lib/libc/sparc64/sys/Makefile.inc b/lib/libc/sparc64/sys/Makefile.inc
index 726c0c9..a62aac2 100644
--- a/lib/libc/sparc64/sys/Makefile.inc
+++ b/lib/libc/sparc64/sys/Makefile.inc
@@ -18,6 +18,3 @@ MDASM+= brk.S cerror.S exect.S pipe.S ptrace.S sbrk.S setlogin.S sigaction1.S
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
diff --git a/lib/libc/sys/Makefile.inc b/lib/libc/sys/Makefile.inc
index 7745b2a..b63aa89 100644
--- a/lib/libc/sys/Makefile.inc
+++ b/lib/libc/sys/Makefile.inc
@@ -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
diff --git a/lib/libc/sys/fcntl.c b/lib/libc/sys/fcntl.c
index 7af617e..dfc722a 100644
--- a/lib/libc/sys/fcntl.c
+++ b/lib/libc/sys/fcntl.c
@@ -3,6 +3,12 @@
* Authors: Doug Rabson <***@rabson.org>
* Developed with Red Inc: Alfred Perlstein <***@freebsd.org>
*
+ * 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
diff --git a/lib/libc/sys/ftruncate.c b/lib/libc/sys/ftruncate.c
deleted file mode 100644
index 78b5a36..0000000
--- a/lib/libc/sys/ftruncate.c
+++ /dev/null
@@ -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.
- * 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 <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/types.h>
-#include <sys/syscall.h>
-#include <unistd.h>
-#include "libc_private.h"
-
-/*
- * 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;
-{
-
- if (__getosreldate() >= 700051)
- return(__sys_ftruncate(fd, length));
- else
- return(__sys_freebsd6_ftruncate(fd, 0, length));
-}
diff --git a/lib/libc/sys/interposing_table.c b/lib/libc/sys/interposing_table.c
index 4290bc6..0ffc426 100644
--- a/lib/libc/sys/interposing_table.c
+++ b/lib/libc/sys/interposing_table.c
@@ -44,7 +44,7 @@ interpos_func_t __libc_interposing[INTERPOS_MAX] = {
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),
diff --git a/lib/libc/sys/lseek.c b/lib/libc/sys/lseek.c
deleted file mode 100644
index a086be1..0000000
--- a/lib/libc/sys/lseek.c
+++ /dev/null
@@ -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.
- * 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 <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/types.h>
-#include <sys/syscall.h>
-#include <unistd.h>
-#include "libc_private.h"
-
-/*
- * 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;
-{
-
- if (__getosreldate() >= 700051)
- return(__sys_lseek(fd, offset, whence));
- else
- return(__sys_freebsd6_lseek(fd, 0, offset, whence));
-}
diff --git a/lib/libc/sys/mmap.c b/lib/libc/sys/mmap.c
deleted file mode 100644
index 0fa03ba..0000000
--- a/lib/libc/sys/mmap.c
+++ /dev/null
@@ -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.
- * 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 <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/types.h>
-#include <sys/mman.h>
-#include <sys/syscall.h>
-#include <unistd.h>
-#include "libc_private.h"
-
-/*
- * This function provides 64-bit offset padding that
- * is not supplied by GCC 1.X but is supplied by GCC 2.X.
- */
-void *
-mmap(void *addr, size_t len, int prot, int flags, int fd, off_t offset)
-{
-
- if (__getosreldate() >= 700051) {
- return (__sys_mmap(addr, len, prot, flags, fd, offset));
- } else {
- return (__sys_freebsd6_mmap(addr, len, prot, flags, fd, 0,
- offset));
- }
-}
diff --git a/lib/libc/sys/pread.c b/lib/libc/sys/pread.c
deleted file mode 100644
index 7566566..0000000
--- a/lib/libc/sys/pread.c
+++ /dev/null
@@ -1,57 +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.
- * 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 <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/types.h>
-#include <sys/syscall.h>
-#include <unistd.h>
-#include "libc_private.h"
-
-/*
- * 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;
-{
-
- if (__getosreldate() >= 700051)
- return (__sys_pread(fd, buf, nbyte, offset));
- else
- return (__sys_freebsd6_pread(fd, buf, nbyte, 0, offset));
-}
diff --git a/lib/libc/sys/pwrite.c b/lib/libc/sys/pwrite.c
deleted file mode 100644
index d17ed29..0000000
--- a/lib/libc/sys/pwrite.c
+++ /dev/null
@@ -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.
- * 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 <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/types.h>
-#include <sys/syscall.h>
-#include <unistd.h>
-#include "libc_private.h"
-
-/*
- * 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;
-{
- if (__getosreldate() >= 700051)
- return (__sys_pwrite(fd, buf, nbyte, offset));
- else
- return (__sys_freebsd6_pwrite(fd, buf, nbyte, 0, offset));
-}
diff --git a/lib/libc/sys/truncate.c b/lib/libc/sys/truncate.c
deleted file mode 100644
index 375c9d9..0000000
--- a/lib/libc/sys/truncate.c
+++ /dev/null
@@ -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.
- * 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 <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/types.h>
-#include <sys/syscall.h>
-#include <unistd.h>
-#include "libc_private.h"
-
-/*
- * 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;
-{
-
- if (__getosreldate() >= 700051)
- return(__sys_truncate(path, length));
- else
- return(__sys_freebsd6_truncate(path, 0, length));
-}
diff --git a/lib/libthr/thread/thr_syscalls.c b/lib/libthr/thread/thr_syscalls.c
index e71bf4a..a3c6151 100644
--- a/lib/libthr/thread/thr_syscalls.c
+++ b/lib/libthr/thread/thr_syscalls.c
@@ -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);

diff --git a/sys/kern/sys_generic.c b/sys/kern/sys_generic.c
index 8fc1db9..213801a 100644
--- a/sys/kern/sys_generic.c
+++ b/sys/kern/sys_generic.c
@@ -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.
diff --git a/sys/kern/syscalls.master b/sys/kern/syscalls.master
index 09d38d4..9873868 100644
--- a/sys/kern/syscalls.master
+++ b/sys/kern/syscalls.master
@@ -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, \
diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c
index 8c8ca31..c5c479d 100644
--- a/sys/kern/vfs_syscalls.c
+++ b/sys/kern/vfs_syscalls.c
@@ -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, struct freebsd6_ftruncate_args *uap)
ouap.length = uap->length;
return (sys_ftruncate(td, &ouap));
}
+#endif

/*
* Sync an open file.
diff --git a/sys/vm/vm_mmap.c b/sys/vm/vm_mmap.c
index a9ff248..02634d6 100644
--- a/sys/vm/vm_mmap.c
+++ b/sys/vm/vm_mmap.c
@@ -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 freebsd6_mmap_args *uap)
oargs.pos = uap->pos;
return (sys_mmap(td, &oargs));
}
+#endif

#ifdef COMPAT_43
#ifndef _SYS_SYSPROTO_H_
Oliver Pinter
2015-04-17 11:39:04 UTC
Permalink
On Fri, Apr 17, 2015 at 9:59 AM, Konstantin Belousov
Post by Konstantin Belousov
Our libc changes in sync with the kernel, but switching of libc to use
new interfaces means that upgrade of the userspace becomes the flag day.
People usually add backward-compatible shims for libc to use older
interfaces on old kernels.
There is no reason to keep the compat shims after many years of the
transition. Patch below purges the compat code for pre-r171219, which
added pad-less versions of syscalls taking off_t, and for r177911, which
handles the struct flock/oflock transition. This is 6.x/7.x compat,
we absolutely not support running HEAD libc on such old kernels.
diff --git a/lib/libc/amd64/sys/Makefile.inc b/lib/libc/amd64/sys/Makefile.inc
index 8e0d614..46ea955 100644
--- a/lib/libc/amd64/sys/Makefile.inc
+++ b/lib/libc/amd64/sys/Makefile.inc
@@ -11,6 +11,3 @@ MDASM= vfork.S brk.S cerror.S exect.S getcontext.S pipe.S ptrace.S \
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
diff --git a/lib/libc/arm/sys/Makefile.inc b/lib/libc/arm/sys/Makefile.inc
index f36ab71..60c2dc3 100644
--- a/lib/libc/arm/sys/Makefile.inc
+++ b/lib/libc/arm/sys/Makefile.inc
@@ -8,6 +8,3 @@ MDASM= Ovfork.S brk.S cerror.S pipe.S ptrace.S sbrk.S shmat.S sigreturn.S syscal
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
diff --git a/lib/libc/i386/sys/Makefile.inc b/lib/libc/i386/sys/Makefile.inc
index b56183c..ebaa462 100644
--- a/lib/libc/i386/sys/Makefile.inc
+++ b/lib/libc/i386/sys/Makefile.inc
@@ -15,9 +15,6 @@ MDASM= Ovfork.S brk.S cerror.S exect.S getcontext.S pipe.S ptrace.S \
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
diff --git a/lib/libc/include/compat.h b/lib/libc/include/compat.h
index 2b8f0de..6ab17d7 100644
--- a/lib/libc/include/compat.h
+++ b/lib/libc/include/compat.h
@@ -47,9 +47,7 @@ __sym_compat(shmctl, freebsd7_shmctl, FBSD_1.0);
#define __weak_reference(sym,alias) \
.weak alias;.equ alias,sym
-#ifndef SYSCALL_COMPAT
__weak_reference(__sys_fcntl,__fcntl_compat)
-#endif
#undef __weak_reference
diff --git a/lib/libc/include/libc_private.h b/lib/libc/include/libc_private.h
index ceaa2a3..53be867 100644
--- a/lib/libc/include/libc_private.h
+++ b/lib/libc/include/libc_private.h
@@ -276,21 +276,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 <sys/_types.h>
#include <sys/_sigset.h>
-/* 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;
diff --git a/lib/libc/powerpc/sys/Makefile.inc b/lib/libc/powerpc/sys/Makefile.inc
index ad98ba1..98ec888 100644
--- a/lib/libc/powerpc/sys/Makefile.inc
+++ b/lib/libc/powerpc/sys/Makefile.inc
@@ -6,6 +6,3 @@ MDASM+= brk.S cerror.S exect.S pipe.S ptrace.S sbrk.S setlogin.S
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
diff --git a/lib/libc/powerpc64/sys/Makefile.inc b/lib/libc/powerpc64/sys/Makefile.inc
index ad98ba1..98ec888 100644
--- a/lib/libc/powerpc64/sys/Makefile.inc
+++ b/lib/libc/powerpc64/sys/Makefile.inc
@@ -6,6 +6,3 @@ MDASM+= brk.S cerror.S exect.S pipe.S ptrace.S sbrk.S setlogin.S
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
diff --git a/lib/libc/sparc64/sys/Makefile.inc b/lib/libc/sparc64/sys/Makefile.inc
index 726c0c9..a62aac2 100644
--- a/lib/libc/sparc64/sys/Makefile.inc
+++ b/lib/libc/sparc64/sys/Makefile.inc
@@ -18,6 +18,3 @@ MDASM+= brk.S cerror.S exect.S pipe.S ptrace.S sbrk.S setlogin.S sigaction1.S
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
diff --git a/lib/libc/sys/Makefile.inc b/lib/libc/sys/Makefile.inc
index 7745b2a..b63aa89 100644
--- a/lib/libc/sys/Makefile.inc
+++ b/lib/libc/sys/Makefile.inc
@@ -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
diff --git a/lib/libc/sys/fcntl.c b/lib/libc/sys/fcntl.c
index 7af617e..dfc722a 100644
--- a/lib/libc/sys/fcntl.c
+++ b/lib/libc/sys/fcntl.c
@@ -3,6 +3,12 @@
*
+ * 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
@@ -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) {
- 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);
-
- return (__sys_fcntl(fd, F_OSETLK, &ofl));
-
- return (__sys_fcntl(fd, F_OSETLKW, &ofl));
- }
- }
- return (__sys_fcntl(fd, cmd, arg));
- }
-}
-#endif
diff --git a/lib/libc/sys/ftruncate.c b/lib/libc/sys/ftruncate.c
deleted file mode 100644
index 78b5a36..0000000
--- a/lib/libc/sys/ftruncate.c
+++ /dev/null
@@ -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
- * 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 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)
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/types.h>
-#include <sys/syscall.h>
-#include <unistd.h>
-#include "libc_private.h"
-
-/*
- * 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;
-{
-
- if (__getosreldate() >= 700051)
- return(__sys_ftruncate(fd, length));
- else
- return(__sys_freebsd6_ftruncate(fd, 0, length));
-}
diff --git a/lib/libc/sys/interposing_table.c b/lib/libc/sys/interposing_table.c
index 4290bc6..0ffc426 100644
--- a/lib/libc/sys/interposing_table.c
+++ b/lib/libc/sys/interposing_table.c
@@ -44,7 +44,7 @@ interpos_func_t __libc_interposing[INTERPOS_MAX] = {
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),
diff --git a/lib/libc/sys/lseek.c b/lib/libc/sys/lseek.c
deleted file mode 100644
index a086be1..0000000
--- a/lib/libc/sys/lseek.c
+++ /dev/null
@@ -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
- * 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 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)
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/types.h>
-#include <sys/syscall.h>
-#include <unistd.h>
-#include "libc_private.h"
-
-/*
- * 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;
-{
-
- if (__getosreldate() >= 700051)
- return(__sys_lseek(fd, offset, whence));
- else
- return(__sys_freebsd6_lseek(fd, 0, offset, whence));
-}
diff --git a/lib/libc/sys/mmap.c b/lib/libc/sys/mmap.c
deleted file mode 100644
index 0fa03ba..0000000
--- a/lib/libc/sys/mmap.c
+++ /dev/null
@@ -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
- * 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 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)
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/types.h>
-#include <sys/mman.h>
-#include <sys/syscall.h>
-#include <unistd.h>
-#include "libc_private.h"
-
-/*
- * This function provides 64-bit offset padding that
- * is not supplied by GCC 1.X but is supplied by GCC 2.X.
- */
-void *
-mmap(void *addr, size_t len, int prot, int flags, int fd, off_t offset)
-{
-
- if (__getosreldate() >= 700051) {
- return (__sys_mmap(addr, len, prot, flags, fd, offset));
- } else {
- return (__sys_freebsd6_mmap(addr, len, prot, flags, fd, 0,
- offset));
- }
-}
diff --git a/lib/libc/sys/pread.c b/lib/libc/sys/pread.c
deleted file mode 100644
index 7566566..0000000
--- a/lib/libc/sys/pread.c
+++ /dev/null
@@ -1,57 +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
- * 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 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)
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/types.h>
-#include <sys/syscall.h>
-#include <unistd.h>
-#include "libc_private.h"
-
-/*
- * 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;
-{
-
- if (__getosreldate() >= 700051)
- return (__sys_pread(fd, buf, nbyte, offset));
- else
- return (__sys_freebsd6_pread(fd, buf, nbyte, 0, offset));
-}
diff --git a/lib/libc/sys/pwrite.c b/lib/libc/sys/pwrite.c
deleted file mode 100644
index d17ed29..0000000
--- a/lib/libc/sys/pwrite.c
+++ /dev/null
@@ -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
- * 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 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)
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/types.h>
-#include <sys/syscall.h>
-#include <unistd.h>
-#include "libc_private.h"
-
-/*
- * 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;
-{
- if (__getosreldate() >= 700051)
- return (__sys_pwrite(fd, buf, nbyte, offset));
- else
- return (__sys_freebsd6_pwrite(fd, buf, nbyte, 0, offset));
-}
diff --git a/lib/libc/sys/truncate.c b/lib/libc/sys/truncate.c
deleted file mode 100644
index 375c9d9..0000000
--- a/lib/libc/sys/truncate.c
+++ /dev/null
@@ -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
- * 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 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)
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/types.h>
-#include <sys/syscall.h>
-#include <unistd.h>
-#include "libc_private.h"
-
-/*
- * 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;
-{
-
- if (__getosreldate() >= 700051)
- return(__sys_truncate(path, length));
- else
- return(__sys_freebsd6_truncate(path, 0, length));
-}
diff --git a/lib/libthr/thread/thr_syscalls.c b/lib/libthr/thread/thr_syscalls.c
index e71bf4a..a3c6151 100644
--- a/lib/libthr/thread/thr_syscalls.c
+++ b/lib/libthr/thread/thr_syscalls.c
@@ -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);
diff --git a/sys/kern/sys_generic.c b/sys/kern/sys_generic.c
index 8fc1db9..213801a 100644
--- a/sys/kern/sys_generic.c
+++ b/sys/kern/sys_generic.c
@@ -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.
diff --git a/sys/kern/syscalls.master b/sys/kern/syscalls.master
index 09d38d4..9873868 100644
--- a/sys/kern/syscalls.master
+++ b/sys/kern/syscalls.master
@@ -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, \
diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c
index 8c8ca31..c5c479d 100644
--- a/sys/kern/vfs_syscalls.c
+++ b/sys/kern/vfs_syscalls.c
@@ -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, struct freebsd6_ftruncate_args *uap)
ouap.length = uap->length;
return (sys_ftruncate(td, &ouap));
}
+#endif
/*
* Sync an open file.
diff --git a/sys/vm/vm_mmap.c b/sys/vm/vm_mmap.c
index a9ff248..02634d6 100644
--- a/sys/vm/vm_mmap.c
+++ b/sys/vm/vm_mmap.c
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 freebsd6_mmap_args *uap)
oargs.pos = uap->pos;
return (sys_mmap(td, &oargs));
}
+#endif
#ifdef COMPAT_43
#ifndef _SYS_SYSPROTO_H_
Is there any chanche to get ride of the very old (FreeBSD 2.x) compat
hacks like these:
https://github.com/freebsd/freebsd/blob/master/lib/libc/gen/setproctitle.c#L40 ?

I like the idea, to purge out the old stuffs/hacks from the FreeBSD.
Post by Konstantin Belousov
_______________________________________________
http://lists.freebsd.org/mailman/listinfo/freebsd-arch
Konstantin Belousov
2015-04-17 12:10:34 UTC
Permalink
Post by Oliver Pinter
Is there any chanche to get ride of the very old (FreeBSD 2.x) compat
https://github.com/freebsd/freebsd/blob/master/lib/libc/gen/setproctitle.c#L40 ?
I will clean up setproctitle.c after the posted pieces of libc changes are
committed.

Apparently, there is no other direct uses of getosreldate() in libc,
besides ones from the patch posted and futimens()/utimensat(). The later
must stay for quite a time.
Post by Oliver Pinter
I like the idea, to purge out the old stuffs/hacks from the FreeBSD.
Stefan Esser
2015-04-17 13:07:43 UTC
Permalink
Post by Konstantin Belousov
Post by Oliver Pinter
Is there any chanche to get ride of the very old (FreeBSD 2.x) compat
https://github.com/freebsd/freebsd/blob/master/lib/libc/gen/setproctitle.c#L40 ?
I will clean up setproctitle.c after the posted pieces of libc changes are
committed.
Apparently, there is no other direct uses of getosreldate() in libc,
besides ones from the patch posted and futimens()/utimensat(). The later
must stay for quite a time.
Post by Oliver Pinter
I like the idea, to purge out the old stuffs/hacks from the FreeBSD.
Could we get rid of check_utility_compat(3) on that occasion?

It is only used (AFAIK) to select FreeBSD-4 compatible behaviour of
expr(1), which can also be selected with option "-e" and env variable
COMPAT_EXPR.

I doubt that anybody relies on non-POSIX behaviour that has been
deprecated for some 15 years ...

We'll need to preserve a stub function for check_utility_compat(3),
I'm afraid, but I think we can remove the environment variable and
the actual checking for a sym-link named "/etc/compat-FreeBSD-4-util"
at startup of expr. (I bet, nobody even knew that the behaviour of
expr could be changed with above sym-link ...)

If there is consensus, I could prepare a patch to remove the check
and to update the man-page for expr (just for -CURRENT, no MFC).

Regards, STefan
John Baldwin
2015-04-17 13:28:24 UTC
Permalink
Post by Stefan Esser
Could we get rid of check_utility_compat(3) on that occasion?
It is only used (AFAIK) to select FreeBSD-4 compatible behaviour of
expr(1), which can also be selected with option "-e" and env variable
COMPAT_EXPR.
I doubt that anybody relies on non-POSIX behaviour that has been
deprecated for some 15 years ...
We'll need to preserve a stub function for check_utility_compat(3),
I'm afraid, but I think we can remove the environment variable and
the actual checking for a sym-link named "/etc/compat-FreeBSD-4-util"
at startup of expr. (I bet, nobody even knew that the behaviour of
expr could be changed with above sym-link ...)
If there is consensus, I could prepare a patch to remove the check
and to update the man-page for expr (just for -CURRENT, no MFC).
I would not be surprised if Y!BSD depends on this and uses it in 11 FWIW. :)
--
John Baldwin
Peter Wemm
2015-04-17 17:10:13 UTC
Permalink
Post by John Baldwin
Post by Stefan Esser
Could we get rid of check_utility_compat(3) on that occasion?
It is only used (AFAIK) to select FreeBSD-4 compatible behaviour of
expr(1), which can also be selected with option "-e" and env variable
COMPAT_EXPR.
I doubt that anybody relies on non-POSIX behaviour that has been
deprecated for some 15 years ...
We'll need to preserve a stub function for check_utility_compat(3),
I'm afraid, but I think we can remove the environment variable and
the actual checking for a sym-link named "/etc/compat-FreeBSD-4-util"
at startup of expr. (I bet, nobody even knew that the behaviour of
expr could be changed with above sym-link ...)
If there is consensus, I could prepare a patch to remove the check
and to update the man-page for expr (just for -CURRENT, no MFC).
I would not be surprised if Y!BSD depends on this and uses it in 11 FWIW. :)
I'm sorry to say, but yes. We do actually us this on 10.x and 11.x at work,
although it's worse than you can imagine. I just did a quick diff and I see:

==== //depot/vendor/FreeBSD/stable/10/bin/expr/expr.y#2 (text+ko) -
//depot/yahoo/ybsd_10/src/bin/expr/expr.y#3 (text+ko) ==== content
@@ -270,6 +270,8 @@
int c;

setlocale(LC_ALL, "");
+ if (getenv("NO_EXPR_COMPAT") == NULL)
+ setenv("EXPR_COMPAT", "1", 1);
if (getenv("EXPR_COMPAT") != NULL
|| check_utility_compat("expr")) {
av = argv + 1;

I'm not going to do an annotate to see who did that.. However, we can
maintain patches locally if needed.

I'm not even sure *why* its there. I might have removed the code that
depended on it. Let me do some research. With a bit of luck, it might be
academic for us now.
--
Peter Wemm - ***@wemm.org; ***@FreeBSD.org; ***@yahoo-inc.com; KI6FJV
UTF-8: for when a ' or ... just won\342\200\231t do\342\200\246
Warner Losh
2015-04-17 17:25:32 UTC
Permalink
Post by Peter Wemm
Post by John Baldwin
Post by Stefan Esser
Could we get rid of check_utility_compat(3) on that occasion?
It is only used (AFAIK) to select FreeBSD-4 compatible behaviour of
expr(1), which can also be selected with option "-e" and env variable
COMPAT_EXPR.
I doubt that anybody relies on non-POSIX behaviour that has been
deprecated for some 15 years ...
We'll need to preserve a stub function for check_utility_compat(3),
I'm afraid, but I think we can remove the environment variable and
the actual checking for a sym-link named "/etc/compat-FreeBSD-4-util"
at startup of expr. (I bet, nobody even knew that the behaviour of
expr could be changed with above sym-link ...)
If there is consensus, I could prepare a patch to remove the check
and to update the man-page for expr (just for -CURRENT, no MFC).
I would not be surprised if Y!BSD depends on this and uses it in 11 FWIW. :)
I'm sorry to say, but yes. We do actually us this on 10.x and 11.x at work,
==== //depot/vendor/FreeBSD/stable/10/bin/expr/expr.y#2 (text+ko) -
//depot/yahoo/ybsd_10/src/bin/expr/expr.y#3 (text+ko) ==== content
@@ -270,6 +270,8 @@
int c;
setlocale(LC_ALL, "");
+ if (getenv("NO_EXPR_COMPAT") == NULL)
+ setenv("EXPR_COMPAT", "1", 1);
if (getenv("EXPR_COMPAT") != NULL
|| check_utility_compat("expr")) {
av = argv + 1;
I'm not going to do an annotate to see who did that.. However, we can
maintain patches locally if needed.
I'm not even sure *why* its there. I might have removed the code that
depended on it. Let me do some research. With a bit of luck, it might be
academic for us now.
For some reason, I’m happier you said you were using the expr hack rather
than running new libc on ancient kernels
 Both fill me with horror, but I guess
the expr one is less horrific somehow...

Warner
Mark Linimon
2015-04-19 18:56:10 UTC
Permalink
Post by Stefan Esser
I doubt that anybody relies on non-POSIX behaviour that has been
deprecated for some 15 years ...
Any sin that's ever been committed is probably still referenced by some
damned port or other :-)

That's still no reason to keep them, of course; I'm just pointing out
that you're taunting Murphy.

mcl
olli hauer
2015-04-21 06:05:08 UTC
Permalink
Post by Mark Linimon
Post by Stefan Esser
I doubt that anybody relies on non-POSIX behaviour that has been
deprecated for some 15 years ...
Any sin that's ever been committed is probably still referenced by some
damned port or other :-)
That's still no reason to keep them, of course; I'm just pointing out
that you're taunting Murphy.
mcl
_______________________________________________
http://lists.freebsd.org/mailman/listinfo/freebsd-arch
To unsubscribe, send any mail to
One potential issue are the official vmware tools, thry still require. compat6 ...
Warner Losh
2015-04-21 06:07:47 UTC
Permalink
Post by Mark Linimon
Post by Stefan Esser
I doubt that anybody relies on non-POSIX behaviour that has been
deprecated for some 15 years ...
Any sin that's ever been committed is probably still referenced by some
damned port or other :-)
That's still no reason to keep them, of course; I'm just pointing out
that you're taunting Murphy.
mcl
_______________________________________________
http://lists.freebsd.org/mailman/listinfo/freebsd-arch
To unsubscribe, send any mail to
One potential issue are the official vmware tools, thry still require. compat6 

This is the libc side (running FreeBSD 11 binaries on a FreeBSD 6 kernel),
not the kernel side, which is what vmware tools need


Warner
olli hauer
2015-04-21 06:21:27 UTC
Permalink
On April 19, 2015 8:56:10 PM CEST, Mark Linimon
Post by Mark Linimon
Post by Stefan Esser
I doubt that anybody relies on non-POSIX behaviour that has been
deprecated for some 15 years ...
Any sin that's ever been committed is probably still referenced by some
damned port or other :-)
That's still no reason to keep them, of course; I'm just pointing
out
Post by Mark Linimon
that you're taunting Murphy.
mcl
_______________________________________________
http://lists.freebsd.org/mailman/listinfo/freebsd-arch
To unsubscribe, send any mail to
One potential issue are the official vmware tools, thry still
require. compat6 …
This is the libc side (running FreeBSD 11 binaries on a FreeBSD 6 kernel),
not the kernel side, which is what vmware tools need…
Warner
Ah,OK
Thanks for clarification!

Konstantin Belousov
2015-04-19 08:52:48 UTC
Permalink
Post by Oliver Pinter
Is there any chanche to get ride of the very old (FreeBSD 2.x) compat
https://github.com/freebsd/freebsd/blob/master/lib/libc/gen/setproctitle.c#L40 ?
Below is the promised cleanup of the libc/gen/setproctitle.c.

I see a value in keeping the track of the historical interfaces. I
considered moving the explanation about old_ps_strings to sys/exec.h,
where the current ps_strings is defined and explained, but this would
make the safety checks in the setproctitle() code uncomprehensive.

diff --git a/lib/libc/gen/setproctitle.c b/lib/libc/gen/setproctitle.c
index cd705fb..9dff328 100644
--- a/lib/libc/gen/setproctitle.c
+++ b/lib/libc/gen/setproctitle.c
@@ -42,9 +42,10 @@ __FBSDID("$FreeBSD$");
* 1: old_ps_strings at the very top of the stack.
* 2: old_ps_strings at SPARE_USRSPACE below the top of the stack.
* 3: ps_strings at the very top of the stack.
- * This attempts to support a kernel built in the #2 and #3 era.
- */
-
+ * We only support a kernel providing #3 style ps_strings.
+ *
+ * For historical purposes, a definition of the old ps_strings structure
+ * and location is preserved below:
struct old_ps_strings {
char *old_ps_argvstr;
int old_ps_nargvstr;
@@ -53,6 +54,7 @@ struct old_ps_strings {
};
#define OLD_PS_STRINGS ((struct old_ps_strings *) \
(USRSTACK - SPARE_USRSPACE - sizeof(struct old_ps_strings)))
+ */

#include <stdarg.h>

@@ -136,41 +138,38 @@ setproctitle(const char *fmt, ...)
ps_strings = (struct ps_strings *)ul_ps_strings;
}

- /* PS_STRINGS points to zeroed memory on a style #2 kernel */
- if (ps_strings->ps_argvstr) {
- /* style #3 */
- if (oargc == -1) {
- /* Record our original args */
- oargc = ps_strings->ps_nargvstr;
- oargv = ps_strings->ps_argvstr;
- for (i = len = 0; i < oargc; i++) {
- /*
- * The program may have scribbled into its
- * argv array, e.g., to remove some arguments.
- * If that has happened, break out before
- * trying to call strlen on a NULL pointer.
- */
- if (oargv[i] == NULL) {
- oargc = i;
- break;
- }
- snprintf(obuf + len, SPT_BUFSIZE - len, "%s%s",
- len ? " " : "", oargv[i]);
- if (len)
- len++;
- len += strlen(oargv[i]);
- if (len >= SPT_BUFSIZE)
- break;
+ /*
+ * PS_STRINGS points to zeroed memory on a style #2 kernel.
+ * Should not happen.
+ */
+ if (ps_strings->ps_argvstr == NULL)
+ return;
+
+ /* style #3 */
+ if (oargc == -1) {
+ /* Record our original args */
+ oargc = ps_strings->ps_nargvstr;
+ oargv = ps_strings->ps_argvstr;
+ for (i = len = 0; i < oargc; i++) {
+ /*
+ * The program may have scribbled into its
+ * argv array, e.g., to remove some arguments.
+ * If that has happened, break out before
+ * trying to call strlen on a NULL pointer.
+ */
+ if (oargv[i] == NULL) {
+ oargc = i;
+ break;
}
+ snprintf(obuf + len, SPT_BUFSIZE - len, "%s%s",
+ len != 0 ? " " : "", oargv[i]);
+ if (len != 0)
+ len++;
+ len += strlen(oargv[i]);
+ if (len >= SPT_BUFSIZE)
+ break;
}
- ps_strings->ps_nargvstr = nargc;
- ps_strings->ps_argvstr = nargvp;
- } else {
- /* style #2 - we can only restore our first arg :-( */
- if (*obuf == '\0')
- strncpy(obuf, OLD_PS_STRINGS->old_ps_argvstr,
- SPT_BUFSIZE - 1);
- OLD_PS_STRINGS->old_ps_nargvstr = 1;
- OLD_PS_STRINGS->old_ps_argvstr = nargvp[0];
}
+ ps_strings->ps_nargvstr = nargc;
+ ps_strings->ps_argvstr = nargvp;
}
Oliver Pinter
2015-04-19 19:59:46 UTC
Permalink
On Sun, Apr 19, 2015 at 10:52 AM, Konstantin Belousov
Post by Konstantin Belousov
Post by Oliver Pinter
Is there any chanche to get ride of the very old (FreeBSD 2.x) compat
https://github.com/freebsd/freebsd/blob/master/lib/libc/gen/setproctitle.c#L40 ?
Below is the promised cleanup of the libc/gen/setproctitle.c.
Seems fine to me, and I started a jenkins build with this patch:
http://jenkins.hardenedbsd.org:8180/jenkins/job/HardenedBSD-unstable-amd64/changes
Post by Konstantin Belousov
I see a value in keeping the track of the historical interfaces. I
considered moving the explanation about old_ps_strings to sys/exec.h,
where the current ps_strings is defined and explained, but this would
make the safety checks in the setproctitle() code uncomprehensive.
Fine.
Post by Konstantin Belousov
diff --git a/lib/libc/gen/setproctitle.c b/lib/libc/gen/setproctitle.c
index cd705fb..9dff328 100644
--- a/lib/libc/gen/setproctitle.c
+++ b/lib/libc/gen/setproctitle.c
@@ -42,9 +42,10 @@ __FBSDID("$FreeBSD$");
* 1: old_ps_strings at the very top of the stack.
* 2: old_ps_strings at SPARE_USRSPACE below the top of the stack.
* 3: ps_strings at the very top of the stack.
- * This attempts to support a kernel built in the #2 and #3 era.
- */
-
+ * We only support a kernel providing #3 style ps_strings.
+ *
+ * For historical purposes, a definition of the old ps_strings structure
struct old_ps_strings {
char *old_ps_argvstr;
int old_ps_nargvstr;
@@ -53,6 +54,7 @@ struct old_ps_strings {
};
#define OLD_PS_STRINGS ((struct old_ps_strings *) \
(USRSTACK - SPARE_USRSPACE - sizeof(struct old_ps_strings)))
+ */
#include <stdarg.h>
@@ -136,41 +138,38 @@ setproctitle(const char *fmt, ...)
ps_strings = (struct ps_strings *)ul_ps_strings;
}
- /* PS_STRINGS points to zeroed memory on a style #2 kernel */
- if (ps_strings->ps_argvstr) {
- /* style #3 */
- if (oargc == -1) {
- /* Record our original args */
- oargc = ps_strings->ps_nargvstr;
- oargv = ps_strings->ps_argvstr;
- for (i = len = 0; i < oargc; i++) {
- /*
- * The program may have scribbled into its
- * argv array, e.g., to remove some arguments.
- * If that has happened, break out before
- * trying to call strlen on a NULL pointer.
- */
- if (oargv[i] == NULL) {
- oargc = i;
- break;
- }
- snprintf(obuf + len, SPT_BUFSIZE - len, "%s%s",
- len ? " " : "", oargv[i]);
- if (len)
- len++;
- len += strlen(oargv[i]);
- if (len >= SPT_BUFSIZE)
- break;
+ /*
+ * PS_STRINGS points to zeroed memory on a style #2 kernel.
+ * Should not happen.
+ */
+ if (ps_strings->ps_argvstr == NULL)
+ return;
+
+ /* style #3 */
+ if (oargc == -1) {
+ /* Record our original args */
+ oargc = ps_strings->ps_nargvstr;
+ oargv = ps_strings->ps_argvstr;
+ for (i = len = 0; i < oargc; i++) {
+ /*
+ * The program may have scribbled into its
+ * argv array, e.g., to remove some arguments.
+ * If that has happened, break out before
+ * trying to call strlen on a NULL pointer.
+ */
+ if (oargv[i] == NULL) {
+ oargc = i;
+ break;
}
+ snprintf(obuf + len, SPT_BUFSIZE - len, "%s%s",
+ len != 0 ? " " : "", oargv[i]);
+ if (len != 0)
+ len++;
+ len += strlen(oargv[i]);
+ if (len >= SPT_BUFSIZE)
+ break;
}
- ps_strings->ps_nargvstr = nargc;
- ps_strings->ps_argvstr = nargvp;
- } else {
- /* style #2 - we can only restore our first arg :-( */
- if (*obuf == '\0')
- strncpy(obuf, OLD_PS_STRINGS->old_ps_argvstr,
- SPT_BUFSIZE - 1);
- OLD_PS_STRINGS->old_ps_nargvstr = 1;
- OLD_PS_STRINGS->old_ps_argvstr = nargvp[0];
}
+ ps_strings->ps_nargvstr = nargc;
+ ps_strings->ps_argvstr = nargvp;
}
Slawa Olhovchenkov
2015-04-17 12:08:43 UTC
Permalink
Post by Konstantin Belousov
Our libc changes in sync with the kernel, but switching of libc to use
new interfaces means that upgrade of the userspace becomes the flag day.
People usually add backward-compatible shims for libc to use older
interfaces on old kernels.
There is no reason to keep the compat shims after many years of the
transition. Patch below purges the compat code for pre-r171219, which
added pad-less versions of syscalls taking off_t, and for r177911, which
handles the struct flock/oflock transition. This is 6.x/7.x compat,
we absolutely not support running HEAD libc on such old kernels.
In general, what purpose for leaving conditional compilation for
different versions in kernel/base sources?
subversion repo already store different version in correlation.
John Baldwin
2015-04-17 13:29:38 UTC
Permalink
Post by Konstantin Belousov
Our libc changes in sync with the kernel, but switching of libc to use
new interfaces means that upgrade of the userspace becomes the flag day.
People usually add backward-compatible shims for libc to use older
interfaces on old kernels.
There is no reason to keep the compat shims after many years of the
transition. Patch below purges the compat code for pre-r171219, which
added pad-less versions of syscalls taking off_t, and for r177911, which
handles the struct flock/oflock transition. This is 6.x/7.x compat,
we absolutely not support running HEAD libc on such old kernels.
I think this is fine.
--
John Baldwin
Warner Losh
2015-04-17 13:54:01 UTC
Permalink
Post by John Baldwin
Post by Konstantin Belousov
Our libc changes in sync with the kernel, but switching of libc to use
new interfaces means that upgrade of the userspace becomes the flag day.
People usually add backward-compatible shims for libc to use older
interfaces on old kernels.
There is no reason to keep the compat shims after many years of the
transition. Patch below purges the compat code for pre-r171219, which
added pad-less versions of syscalls taking off_t, and for r177911, which
handles the struct flock/oflock transition. This is 6.x/7.x compat,
we absolutely not support running HEAD libc on such old kernels.
I think this is fine.
I do too.

Please look at removing MK_COMPAT_SYSCALLS from the build too, since
it was the only knob that controlled these. I don’t see that in your patch
(though it would be easier for me to comment on in phabricator).

Also, in lib/libc/sys/fcnt.c:

+ * Copyright (c) 2014, 2015 The FreeBSD Foundation.

Should be 2014-2015

Warner
Konstantin Belousov
2015-04-17 14:11:50 UTC
Permalink
Post by Warner Losh
Post by John Baldwin
Post by Konstantin Belousov
Our libc changes in sync with the kernel, but switching of libc to use
new interfaces means that upgrade of the userspace becomes the flag day.
People usually add backward-compatible shims for libc to use older
interfaces on old kernels.
There is no reason to keep the compat shims after many years of the
transition. Patch below purges the compat code for pre-r171219, which
added pad-less versions of syscalls taking off_t, and for r177911, which
handles the struct flock/oflock transition. This is 6.x/7.x compat,
we absolutely not support running HEAD libc on such old kernels.
I think this is fine.
I do too.
Please look at removing MK_COMPAT_SYSCALLS from the build too, since
it was the only knob that controlled these. I don???t see that in your patch
(though it would be easier for me to comment on in phabricator).
Hm, I thought that this option was 'break the ABI' request, to drop
non-default-versioned symbols. Apparently it is not, I remove the
MK_COMPAT_SYSCALLS. Updated patch is at the end of the message.
Post by Warner Losh
+ * Copyright (c) 2014, 2015 The FreeBSD Foundation.
Should be 2014-2015
This is fixed, thanks.

diff --git a/lib/libc/Makefile b/lib/libc/Makefile
index 398dc54..8e0db62 100644
--- a/lib/libc/Makefile
+++ b/lib/libc/Makefile
@@ -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 <bsd.arch.inc.mk>

.include <bsd.lib.mk>
diff --git a/lib/libc/amd64/sys/Makefile.inc b/lib/libc/amd64/sys/Makefile.inc
index 8e0d614..46ea955 100644
--- a/lib/libc/amd64/sys/Makefile.inc
+++ b/lib/libc/amd64/sys/Makefile.inc
@@ -11,6 +11,3 @@ MDASM= vfork.S brk.S cerror.S exect.S getcontext.S pipe.S ptrace.S \
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
diff --git a/lib/libc/arm/sys/Makefile.inc b/lib/libc/arm/sys/Makefile.inc
index f36ab71..60c2dc3 100644
--- a/lib/libc/arm/sys/Makefile.inc
+++ b/lib/libc/arm/sys/Makefile.inc
@@ -8,6 +8,3 @@ MDASM= Ovfork.S brk.S cerror.S pipe.S ptrace.S sbrk.S shmat.S sigreturn.S syscal
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
diff --git a/lib/libc/i386/sys/Makefile.inc b/lib/libc/i386/sys/Makefile.inc
index b56183c..ebaa462 100644
--- a/lib/libc/i386/sys/Makefile.inc
+++ b/lib/libc/i386/sys/Makefile.inc
@@ -15,9 +15,6 @@ MDASM= Ovfork.S brk.S cerror.S exect.S getcontext.S pipe.S ptrace.S \
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
diff --git a/lib/libc/include/compat.h b/lib/libc/include/compat.h
index 2b8f0de..6ab17d7 100644
--- a/lib/libc/include/compat.h
+++ b/lib/libc/include/compat.h
@@ -47,9 +47,7 @@ __sym_compat(shmctl, freebsd7_shmctl, FBSD_1.0);
#define __weak_reference(sym,alias) \
.weak alias;.equ alias,sym

-#ifndef SYSCALL_COMPAT
__weak_reference(__sys_fcntl,__fcntl_compat)
-#endif

#undef __weak_reference

diff --git a/lib/libc/include/libc_private.h b/lib/libc/include/libc_private.h
index ceaa2a3..53be867 100644
--- a/lib/libc/include/libc_private.h
+++ b/lib/libc/include/libc_private.h
@@ -276,21 +276,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 <sys/_types.h>
#include <sys/_sigset.h>

-/* 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;
diff --git a/lib/libc/mips/sys/Makefile.inc b/lib/libc/mips/sys/Makefile.inc
index a0452c6..a06f664 100644
--- a/lib/libc/mips/sys/Makefile.inc
+++ b/lib/libc/mips/sys/Makefile.inc
@@ -10,6 +10,3 @@ 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

PSEUDO= _exit.o _getlogin.o
-.if ${MK_SYSCALL_COMPAT} != "no"
-PSEUDO+= _pread.o _pwrite.o _lseek.o _mmap.o _ftruncate.o _truncate.o
-.endif
diff --git a/lib/libc/powerpc/sys/Makefile.inc b/lib/libc/powerpc/sys/Makefile.inc
index ad98ba1..98ec888 100644
--- a/lib/libc/powerpc/sys/Makefile.inc
+++ b/lib/libc/powerpc/sys/Makefile.inc
@@ -6,6 +6,3 @@ MDASM+= brk.S cerror.S exect.S pipe.S ptrace.S sbrk.S setlogin.S
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
diff --git a/lib/libc/powerpc64/sys/Makefile.inc b/lib/libc/powerpc64/sys/Makefile.inc
index ad98ba1..98ec888 100644
--- a/lib/libc/powerpc64/sys/Makefile.inc
+++ b/lib/libc/powerpc64/sys/Makefile.inc
@@ -6,6 +6,3 @@ MDASM+= brk.S cerror.S exect.S pipe.S ptrace.S sbrk.S setlogin.S
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
diff --git a/lib/libc/sparc64/sys/Makefile.inc b/lib/libc/sparc64/sys/Makefile.inc
index 726c0c9..a62aac2 100644
--- a/lib/libc/sparc64/sys/Makefile.inc
+++ b/lib/libc/sparc64/sys/Makefile.inc
@@ -18,6 +18,3 @@ MDASM+= brk.S cerror.S exect.S pipe.S ptrace.S sbrk.S setlogin.S sigaction1.S
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
diff --git a/lib/libc/sys/Makefile.inc b/lib/libc/sys/Makefile.inc
index 7745b2a..b63aa89 100644
--- a/lib/libc/sys/Makefile.inc
+++ b/lib/libc/sys/Makefile.inc
@@ -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
diff --git a/lib/libc/sys/fcntl.c b/lib/libc/sys/fcntl.c
index 7af617e..e85574a 100644
--- a/lib/libc/sys/fcntl.c
+++ b/lib/libc/sys/fcntl.c
@@ -3,6 +3,12 @@
* Authors: Doug Rabson <***@rabson.org>
* Developed with Red Inc: Alfred Perlstein <***@freebsd.org>
*
+ * 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
diff --git a/lib/libc/sys/ftruncate.c b/lib/libc/sys/ftruncate.c
deleted file mode 100644
index 78b5a36..0000000
--- a/lib/libc/sys/ftruncate.c
+++ /dev/null
@@ -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.
- * 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 <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/types.h>
-#include <sys/syscall.h>
-#include <unistd.h>
-#include "libc_private.h"
-
-/*
- * 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;
-{
-
- if (__getosreldate() >= 700051)
- return(__sys_ftruncate(fd, length));
- else
- return(__sys_freebsd6_ftruncate(fd, 0, length));
-}
diff --git a/lib/libc/sys/interposing_table.c b/lib/libc/sys/interposing_table.c
index 4290bc6..0ffc426 100644
--- a/lib/libc/sys/interposing_table.c
+++ b/lib/libc/sys/interposing_table.c
@@ -44,7 +44,7 @@ interpos_func_t __libc_interposing[INTERPOS_MAX] = {
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),
diff --git a/lib/libc/sys/lseek.c b/lib/libc/sys/lseek.c
deleted file mode 100644
index a086be1..0000000
--- a/lib/libc/sys/lseek.c
+++ /dev/null
@@ -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.
- * 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 <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/types.h>
-#include <sys/syscall.h>
-#include <unistd.h>
-#include "libc_private.h"
-
-/*
- * 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;
-{
-
- if (__getosreldate() >= 700051)
- return(__sys_lseek(fd, offset, whence));
- else
- return(__sys_freebsd6_lseek(fd, 0, offset, whence));
-}
diff --git a/lib/libc/sys/mmap.c b/lib/libc/sys/mmap.c
deleted file mode 100644
index 0fa03ba..0000000
--- a/lib/libc/sys/mmap.c
+++ /dev/null
@@ -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.
- * 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 <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/types.h>
-#include <sys/mman.h>
-#include <sys/syscall.h>
-#include <unistd.h>
-#include "libc_private.h"
-
-/*
- * This function provides 64-bit offset padding that
- * is not supplied by GCC 1.X but is supplied by GCC 2.X.
- */
-void *
-mmap(void *addr, size_t len, int prot, int flags, int fd, off_t offset)
-{
-
- if (__getosreldate() >= 700051) {
- return (__sys_mmap(addr, len, prot, flags, fd, offset));
- } else {
- return (__sys_freebsd6_mmap(addr, len, prot, flags, fd, 0,
- offset));
- }
-}
diff --git a/lib/libc/sys/pread.c b/lib/libc/sys/pread.c
deleted file mode 100644
index 7566566..0000000
--- a/lib/libc/sys/pread.c
+++ /dev/null
@@ -1,57 +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.
- * 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 <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/types.h>
-#include <sys/syscall.h>
-#include <unistd.h>
-#include "libc_private.h"
-
-/*
- * 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;
-{
-
- if (__getosreldate() >= 700051)
- return (__sys_pread(fd, buf, nbyte, offset));
- else
- return (__sys_freebsd6_pread(fd, buf, nbyte, 0, offset));
-}
diff --git a/lib/libc/sys/pwrite.c b/lib/libc/sys/pwrite.c
deleted file mode 100644
index d17ed29..0000000
--- a/lib/libc/sys/pwrite.c
+++ /dev/null
@@ -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.
- * 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 <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/types.h>
-#include <sys/syscall.h>
-#include <unistd.h>
-#include "libc_private.h"
-
-/*
- * 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;
-{
- if (__getosreldate() >= 700051)
- return (__sys_pwrite(fd, buf, nbyte, offset));
- else
- return (__sys_freebsd6_pwrite(fd, buf, nbyte, 0, offset));
-}
diff --git a/lib/libc/sys/truncate.c b/lib/libc/sys/truncate.c
deleted file mode 100644
index 375c9d9..0000000
--- a/lib/libc/sys/truncate.c
+++ /dev/null
@@ -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.
- * 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 <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/types.h>
-#include <sys/syscall.h>
-#include <unistd.h>
-#include "libc_private.h"
-
-/*
- * 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;
-{
-
- if (__getosreldate() >= 700051)
- return(__sys_truncate(path, length));
- else
- return(__sys_freebsd6_truncate(path, 0, length));
-}
diff --git a/lib/libthr/Makefile b/lib/libthr/Makefile
index 1acb17f..0770d06 100644
--- a/lib/libthr/Makefile
+++ b/lib/libthr/Makefile
@@ -61,10 +61,6 @@ SYMLINKS+=lib${LIB}.so ${LIBDIR}/libpthread.so
SYMLINKS+=lib${LIB}_p.a ${LIBDIR}/libpthread_p.a
.endif

-.if ${MK_SYSCALL_COMPAT} != "no"
-CFLAGS+=-DSYSCALL_COMPAT
-.endif
-
.include <bsd.arch.inc.mk>

.include <bsd.lib.mk>
diff --git a/lib/libthr/thread/thr_syscalls.c b/lib/libthr/thread/thr_syscalls.c
index e71bf4a..a3c6151 100644
--- a/lib/libthr/thread/thr_syscalls.c
+++ b/lib/libthr/thread/thr_syscalls.c
@@ -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);

diff --git a/share/mk/src.opts.mk b/share/mk/src.opts.mk
index 6bcff64..f98e19f 100644
--- a/share/mk/src.opts.mk
+++ b/share/mk/src.opts.mk
@@ -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_BOOTSTRAP CLANG_FULL CLANG_IS_CC
.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 <bsd.mkopt.mk>
diff --git a/sys/kern/sys_generic.c b/sys/kern/sys_generic.c
index 8fc1db9..213801a 100644
--- a/sys/kern/sys_generic.c
+++ b/sys/kern/sys_generic.c
@@ -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.
diff --git a/sys/kern/syscalls.master b/sys/kern/syscalls.master
index 09d38d4..9873868 100644
--- a/sys/kern/syscalls.master
+++ b/sys/kern/syscalls.master
@@ -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, \
diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c
index 8c8ca31..c5c479d 100644
--- a/sys/kern/vfs_syscalls.c
+++ b/sys/kern/vfs_syscalls.c
@@ -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, struct freebsd6_ftruncate_args *uap)
ouap.length = uap->length;
return (sys_ftruncate(td, &ouap));
}
+#endif

/*
* Sync an open file.
diff --git a/sys/vm/vm_mmap.c b/sys/vm/vm_mmap.c
index a9ff248..02634d6 100644
--- a/sys/vm/vm_mmap.c
+++ b/sys/vm/vm_mmap.c
@@ -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 freebsd6_mmap_args *uap)
oargs.pos = uap->pos;
return (sys_mmap(td, &oargs));
}
+#endif

#ifdef COMPAT_43
#ifndef _SYS_SYSPROTO_H_
Loading...