From nobody Tue Oct 31 21:27:40 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4SKjsS50Ykz4xwFP; Tue, 31 Oct 2023 21:27:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4SKjsS4j2bz4Wx6; Tue, 31 Oct 2023 21:27:40 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1698787660; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Q0NTVQtBOkkXUpd8bjZjHfkvFnjW+kPV2KRsxR9TCkI=; b=xbrFn1CrSABCXYCts0u+rncoWptKp9AwrQfxfamZtyU8QsYPPV96pQEK8mZuPgLx3H10KA Mt+MRYi9tQHyX1IxZBut/buvYQ4kZa+fYWjmJBGgBGWHDjplJ9oDtlvb+vpG5KIt5ePdw6 N0g5/3GD+6Ozh0F/iZGmv3Fn5g1+Yxva6G/wEXA2LT1I18UOOnRtDzAuxxn8hYWcAjk+KX cn/qGLG0oiXHFTUfFz80QV7yP2U63lOtlXDx3TqDtv9lY0tydEMuIyljf122W6GXn3EGZk LXBUmM53aa6dxdmN1xzrpoHq/2bAJ2JqZ1whXeq9N2psiRZfb3rHMFZVQDCJJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1698787660; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Q0NTVQtBOkkXUpd8bjZjHfkvFnjW+kPV2KRsxR9TCkI=; b=SJ8IdxNDJYd+O+olLSnYUrag3lwlU2A1uJywhXUOs+aURBOb+XibWDyVr5PlosKUrNW4UU aQSoB0RhqlZ7HPcl1tYXFhOhB8JRcyD8FyR8cJMSyBb0J3OcSPjfyOpJHRX2qqFklAB6Bv 0SuHD2/8HLVtsdA4SFnWHPVEXQGGJCb2riqv9zBueqgNqaP1VHl7Blows6d6Tycp+7Frgn vXdRRxNE/680caWV1QNGTAdH+V+RoIkSAFVtFkjb5YC9dzkQ+VTtRbpTv7zunxX8vFsI8N zIr3EHPoVGZY6UkHN4F7Fm7WwV8naH5Z2pBiUpv/miSoL4BgjcVPYZ2gl2kLUg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1698787660; a=rsa-sha256; cv=none; b=Kdf+lj1fwJBWe8h/kxEnrX5t+fIqpmd/MdulFeO6O0TyiM8oEF/mLgWxAO+fariKSotYVE LbTZ2pOzCBBhMJsaB9MLgp36f7zCbjqtKfnKEXP5DwFV51ez8YOS8a6Y6U4gRVey38MotH R7n1wMwPybWtNzt5EREdiyybT8uLd+ZV1dIQTt0VN3waBL1EeVlmtm4G3VmzTx0IQsKMg0 rEah7jtsQGcR46J2wqPJNnlgAlt3rnsMiicNAbbgKOPspbmnB0WImQm/0+caZDG+2rbWp4 7lkZ/C/+Sgg/EQ4ATyLunGQpvkchGzZe0WXCtqMxNcUnoUwoIzg0z/W71GKInQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4SKjsS3lmMz4Ws; Tue, 31 Oct 2023 21:27:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 39VLReKH081358; Tue, 31 Oct 2023 21:27:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 39VLReES081354; Tue, 31 Oct 2023 21:27:40 GMT (envelope-from git) Date: Tue, 31 Oct 2023 21:27:40 GMT Message-Id: <202310312127.39VLReES081354@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 0527c9bdc718 - main - ino64: Remove 'forward compat' code for this List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0527c9bdc7187a0b92511f021dcdbbac84f1c579 Auto-Submitted: auto-generated The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=0527c9bdc7187a0b92511f021dcdbbac84f1c579 commit 0527c9bdc7187a0b92511f021dcdbbac84f1c579 Author: Warner Losh AuthorDate: 2023-10-31 20:55:58 +0000 Commit: Warner Losh CommitDate: 2023-10-31 21:26:44 +0000 ino64: Remove 'forward compat' code for this Forward compatibility code was added for running newer ino64 binaries on older kernels as a transition aide. Now that ino64 has been in the tree 6 years, this code is no longer useful and should have been removed long ago. Remove it now. Should be no user-visible changes at this point as all the 'upgrade' scenarios it was intended for are long since past. Also need to remove this stuff from rtld since the _foo versions no longer exist. Sponsored by: Netflix Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D42382 --- UPDATING | 12 ++++ lib/libc/sys/Makefile.inc | 8 --- lib/libc/sys/compat-ino64.h | 99 --------------------------- lib/libc/sys/fstat.c | 51 -------------- lib/libc/sys/fstatat.c | 47 ------------- lib/libc/sys/fstatfs.c | 51 -------------- lib/libc/sys/getdents.c | 7 +- lib/libc/sys/getdirentries.c | 114 -------------------------------- lib/libc/sys/getfsstat.c | 62 ----------------- lib/libc/sys/lstat.c | 13 +--- lib/libc/sys/stat.c | 13 +--- lib/libc/sys/statfs.c | 47 ------------- libexec/rtld-elf/rtld-libc/Makefile.inc | 4 +- 13 files changed, 21 insertions(+), 507 deletions(-) diff --git a/UPDATING b/UPDATING index 722d7d66acbe..1ee0731742b3 100644 --- a/UPDATING +++ b/UPDATING @@ -27,6 +27,10 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 15.x IS SLOW: world, or to merely disable the most expensive debugging functionality at runtime, run "ln -s 'abort:false,junk:false' /etc/malloc.conf".) +20231027: + Forward compatibility (running the new code on old kernels) for the + "ino64" project have been removed. The need for it has passed long ago. + 20231018: Commit 57ce37f9dcd0 changed the internal KAPI between the nfscommon and nfscl modules. Both must be rebuilt from sources. @@ -1573,6 +1577,14 @@ https://lists.freebsd.org/archives/freebsd-current/2021-June/000153.html Switch back to the BSDL dtc (Device Tree Compiler). Set WITH_GPL_DTC if you require the GPL compiler. +20170619: + Forward compatibility for the "ino64" project have been committed. This + will allow most new binaries to run on older kernels in a limited + fashion. This prevents many of the common foot-shooting actions in the + upgrade as well as the limited ability to roll back the kernel across + the ino64 upgrade. Complicated use cases may not work properly, though + enough simpler ones work to allow recovery in most situations. + 20170618: The internal ABI used for communication between the NFS kernel modules was changed by r320085, so __FreeBSD_version was bumped to diff --git a/lib/libc/sys/Makefile.inc b/lib/libc/sys/Makefile.inc index f52487a3fef2..e9a9f8f5935c 100644 --- a/lib/libc/sys/Makefile.inc +++ b/lib/libc/sys/Makefile.inc @@ -38,14 +38,6 @@ SRCS+= getdents.c lstat.c mknod.c stat.c NOASM+= sched_getcpu.o PSEUDO+= _sched_getcpu.o -SRCS+= fstat.c fstatat.c fstatfs.c getfsstat.c statfs.c -NOASM+= fstat.o fstatat.o fstatfs.o getfsstat.o statfs.o -PSEUDO+= _fstat.o _fstatat.o _fstatfs.o _getfsstat.o _statfs.o - -SRCS+= getdirentries.c -NOASM+= getdirentries.o -PSEUDO+= _getdirentries.o - SRCS+= brk.c SRCS+= closefrom.c SRCS+= pipe.c diff --git a/lib/libc/sys/compat-ino64.h b/lib/libc/sys/compat-ino64.h deleted file mode 100644 index ded3c6c64124..000000000000 --- a/lib/libc/sys/compat-ino64.h +++ /dev/null @@ -1,99 +0,0 @@ -/*- - * Copyright (c) 2017 M. Warner Losh - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/* - * Forward compatibility shim to convert old stat buffer to - * new so we can call the old system call, but return data in - * the new system call's format. - */ -#define _WANT_FREEBSD11_STATFS -#include -#include - -#define _WANT_FREEBSD11_STAT -#include - -#include - -#define INO64_FIRST 1200031 - -static __inline void -__stat11_to_stat(const struct freebsd11_stat *sb11, struct stat *sb) -{ - - sb->st_dev = sb11->st_dev; - sb->st_ino = sb11->st_ino; - sb->st_nlink = sb11->st_nlink; - sb->st_mode = sb11->st_mode; - sb->st_uid = sb11->st_uid; - sb->st_gid = sb11->st_gid; - sb->st_rdev = sb11->st_rdev; - sb->st_atim = sb11->st_atim; - sb->st_mtim = sb11->st_mtim; - sb->st_ctim = sb11->st_ctim; -#ifdef __STAT_TIME_T_EXT - sb->st_atim_ext = 0; - sb->st_mtim_ext = 0; - sb->st_ctim_ext = 0; - sb->st_btim_ext = 0; -#endif - sb->st_birthtim = sb11->st_birthtim; - sb->st_size = sb11->st_size; - sb->st_blocks = sb11->st_blocks; - sb->st_blksize = sb11->st_blksize; - sb->st_flags = sb11->st_flags; - sb->st_gen = sb11->st_gen; - sb->st_padding0 = 0; - sb->st_padding1 = 0; - memset(sb->st_spare, 0, sizeof(sb->st_spare)); -} - -static __inline void -__statfs11_to_statfs(const struct freebsd11_statfs *sf11, struct statfs *sf) -{ - - sf->f_version = STATFS_VERSION; - sf->f_type = sf11->f_type; - sf->f_flags = sf11->f_flags; - sf->f_bsize = sf11->f_bsize; - sf->f_iosize = sf11->f_iosize; - sf->f_blocks = sf11->f_blocks; - sf->f_bfree = sf11->f_bfree; - sf->f_bavail = sf11->f_bavail; - sf->f_files = sf11->f_files; - sf->f_ffree = sf11->f_ffree; - sf->f_syncwrites = sf11->f_syncwrites; - sf->f_asyncwrites = sf11->f_asyncwrites; - sf->f_syncreads = sf11->f_syncreads; - sf->f_asyncreads = sf11->f_asyncreads; - sf->f_namemax = sf11->f_namemax; - sf->f_owner = sf11->f_owner; - sf->f_fsid = sf11->f_fsid; - memset(sf->f_spare, 0, sizeof(sf->f_spare)); - memset(sf->f_charspare, 0, sizeof(sf->f_charspare)); - strlcpy(sf->f_fstypename, sf11->f_fstypename, sizeof(sf->f_fstypename)); - strlcpy(sf->f_mntfromname, sf11->f_mntfromname, sizeof(sf->f_mntfromname)); - strlcpy(sf->f_mntonname, sf11->f_mntonname, sizeof(sf->f_mntonname)); -} diff --git a/lib/libc/sys/fstat.c b/lib/libc/sys/fstat.c deleted file mode 100644 index 4efeecfd0978..000000000000 --- a/lib/libc/sys/fstat.c +++ /dev/null @@ -1,51 +0,0 @@ -/*- - * Copyright (c) 2017 M. Warner Losh - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include -#include "namespace.h" -#include -#include -#include "compat-ino64.h" -#include - -#include "libc_private.h" - -#undef fstat -__weak_reference(_fstat, fstat); - -#pragma weak _fstat -int -_fstat(int fd, struct stat *sb) -{ - struct freebsd11_stat stat11; - int rv; - - if (__getosreldate() >= INO64_FIRST) - return (__sys_fstat(fd, sb)); - rv = syscall(SYS_freebsd11_fstat, fd, &stat11); - if (rv == 0) - __stat11_to_stat(&stat11, sb); - return (rv); -} diff --git a/lib/libc/sys/fstatat.c b/lib/libc/sys/fstatat.c deleted file mode 100644 index d83647f98da1..000000000000 --- a/lib/libc/sys/fstatat.c +++ /dev/null @@ -1,47 +0,0 @@ -/*- - * Copyright (c) 2017 M. Warner Losh - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include -#include "namespace.h" -#include -#include -#include "compat-ino64.h" -#include - -#include "libc_private.h" - -int -fstatat(int fd, const char *path, struct stat *sb, int flag) -{ - struct freebsd11_stat stat11; - int rv; - - if (__getosreldate() >= INO64_FIRST) - return (__sys_fstatat(fd, path, sb, flag)); - rv = syscall(SYS_freebsd11_fstatat, fd, path, &stat11, flag); - if (rv == 0) - __stat11_to_stat(&stat11, sb); - return (rv); -} diff --git a/lib/libc/sys/fstatfs.c b/lib/libc/sys/fstatfs.c deleted file mode 100644 index 517ba2a420b6..000000000000 --- a/lib/libc/sys/fstatfs.c +++ /dev/null @@ -1,51 +0,0 @@ -/*- - * Copyright (c) 2017 M. Warner Losh - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include -#include "namespace.h" -#include -#include -#include "compat-ino64.h" -#include - -#include "libc_private.h" - -#undef fstatfs -__weak_reference(_fstatfs, fstatfs); - -#pragma weak _fstatfs -int -_fstatfs(int fd, struct statfs *buf) -{ - struct freebsd11_statfs statfs11; - int rv; - - if (__getosreldate() >= INO64_FIRST) - return (__sys_fstatfs(fd, buf)); - rv = syscall(SYS_freebsd11_fstatfs, fd, &statfs11); - if (rv == 0) - __statfs11_to_statfs(&statfs11, buf); - return (rv); -} diff --git a/lib/libc/sys/getdents.c b/lib/libc/sys/getdents.c index b34b7003a729..673b7d62d1ee 100644 --- a/lib/libc/sys/getdents.c +++ b/lib/libc/sys/getdents.c @@ -34,11 +34,6 @@ ssize_t getdents(int fd, char *buf, size_t nbytes) { - /* - * _getdirentries knows how to call the right thing and - * return it in the new format. It assumes that the entire - * libc expecting the new format. - */ - return (_getdirentries(fd, buf, nbytes, NULL)); + return (__sys_getdirentries(fd, buf, nbytes, NULL)); } diff --git a/lib/libc/sys/getdirentries.c b/lib/libc/sys/getdirentries.c deleted file mode 100644 index 92f43e74cab7..000000000000 --- a/lib/libc/sys/getdirentries.c +++ /dev/null @@ -1,114 +0,0 @@ -/*- - * Copyright (c) 2017 M. Warner Losh - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include -#define _WANT_FREEBSD11_DIRENT - -#include "namespace.h" -#include -#include -#include "compat-ino64.h" -#include -#include -#include -#include -#include -#include -#include -#include "libc_private.h" - -static ssize_t -__cvt_dirents_from11(const char *de11, ssize_t len11, char *de, ssize_t len) -{ - struct dirent *dst; - const struct freebsd11_dirent *src; - const char *edst, *esrc; - ssize_t rlen; - - src = (const struct freebsd11_dirent *)de11; - dst = (struct dirent *)de; - esrc = de11 + len11; - edst = de + len; - while ((const char *)src < esrc && (const char *)dst < edst) { - rlen = roundup(offsetof(struct dirent, d_name) + src->d_namlen + 1, 8); - if ((const char *)dst + rlen >= edst) - break; - dst->d_fileno = src->d_fileno; - dst->d_off = 0; /* nothing uses it yet, so safe for now */ - dst->d_reclen = rlen; - dst->d_type = src->d_type; - dst->d_pad0 = 0; - dst->d_namlen = src->d_namlen; - dst->d_pad1 = 0; - memset(dst->d_name, 0, roundup(src->d_namlen + 1, 8)); - memcpy(dst->d_name, src->d_name, src->d_namlen); - dst = (struct dirent *)((char *)dst + rlen); - src = (const struct freebsd11_dirent *)((const char *)src + src->d_reclen); - } - return ((char *)dst - de); -} - -#undef getdirentries -__weak_reference(_getdirentries, getdirentries); - -#pragma weak _getdirentries -ssize_t -_getdirentries(int fd, char *buf, size_t nbytes, off_t *basep) -{ - char *oldbuf; - size_t len; - ssize_t rv; - - if (__getosreldate() >= INO64_FIRST) - return (__sys_getdirentries(fd, buf, nbytes, basep)); - - /* - * Because the old system call returns entries that are smaller than the - * new, we could wind up in a situation where we have too many to fit in - * the buffer with the new encoding. So sacrifice a small bit of - * efficiency to ensure that never happens. We pick 1/4 the size round - * up to the next DIRBLKSIZ. This will guarnatee enough room exists in - * the dst buffer due to changes in efficiency in packing dirent - * entries. We don't check against minimum block size to avoid a lot of - * stat calls, we'll see if that's wise or not. - * TBD: Will this difference matter to lseek? - */ - len = roundup(nbytes / 4, DIRBLKSIZ); - oldbuf = malloc(len); - if (oldbuf == NULL) { - errno = EINVAL; /* ENOMEM not in possible list */ - return (-1); - } - rv = syscall(SYS_freebsd11_getdirentries, fd, oldbuf, len, basep); - if (rv == -1) { - free(oldbuf); - return (rv); - } - if (rv > 0) - rv = __cvt_dirents_from11(oldbuf, rv, buf, nbytes); - free(oldbuf); - - return (rv); -} diff --git a/lib/libc/sys/getfsstat.c b/lib/libc/sys/getfsstat.c deleted file mode 100644 index 60cd433c9d40..000000000000 --- a/lib/libc/sys/getfsstat.c +++ /dev/null @@ -1,62 +0,0 @@ -/*- - * Copyright (c) 2017 M. Warner Losh - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include -#include "namespace.h" -#include -#include "compat-ino64.h" -#include -#include -#include -#include - -#include "libc_private.h" - -int -getfsstat(struct statfs *buf, long bufsize, int flags) -{ - struct freebsd11_statfs *statfs11 = NULL; - ssize_t len = 0; - int rv, i; - - if (__getosreldate() >= INO64_FIRST) - return (__sys_getfsstat(buf, bufsize, flags)); - if (buf != NULL) { - len = sizeof(struct freebsd11_statfs) * /* Round down on purpose to avoid */ - (bufsize / sizeof(struct statfs)); /* overflow on translation. */ - statfs11 = malloc(len); - if (statfs11 == NULL) { - errno = ENOMEM; - return (-1); - } - } - rv = syscall(SYS_freebsd11_getfsstat, statfs11, len, flags); - if (rv != -1 && buf != NULL) { - for (i = 0; i < rv; i++) - __statfs11_to_statfs(&statfs11[i], &buf[i]); - } - free(statfs11); - return (rv); -} diff --git a/lib/libc/sys/lstat.c b/lib/libc/sys/lstat.c index c9c3351e79fc..b335946d2f3c 100644 --- a/lib/libc/sys/lstat.c +++ b/lib/libc/sys/lstat.c @@ -27,22 +27,15 @@ #include #include "namespace.h" #include +#include #include -#include "compat-ino64.h" +#include #include - #include "libc_private.h" int lstat(const char *path, struct stat *sb) { - struct freebsd11_stat stat11; - int rv; - if (__getosreldate() >= INO64_FIRST) - return (__sys_fstatat(AT_FDCWD, path, sb, AT_SYMLINK_NOFOLLOW)); - rv = syscall(SYS_freebsd11_lstat, path, &stat11); - if (rv == 0) - __stat11_to_stat(&stat11, sb); - return (rv); + return (__sys_fstatat(AT_FDCWD, path, sb, AT_SYMLINK_NOFOLLOW)); } diff --git a/lib/libc/sys/stat.c b/lib/libc/sys/stat.c index dc9ef16c79e7..88a4e784adff 100644 --- a/lib/libc/sys/stat.c +++ b/lib/libc/sys/stat.c @@ -27,22 +27,15 @@ #include #include "namespace.h" #include +#include #include -#include "compat-ino64.h" +#include #include - #include "libc_private.h" int stat(const char *path, struct stat *sb) { - struct freebsd11_stat stat11; - int rv; - if (__getosreldate() >= INO64_FIRST) - return (__sys_fstatat(AT_FDCWD, path, sb, 0)); - rv = syscall(SYS_freebsd11_stat, path, &stat11); - if (rv == 0) - __stat11_to_stat(&stat11, sb); - return (rv); + return (__sys_fstatat(AT_FDCWD, path, sb, 0)); } diff --git a/lib/libc/sys/statfs.c b/lib/libc/sys/statfs.c deleted file mode 100644 index b8ac38b131ca..000000000000 --- a/lib/libc/sys/statfs.c +++ /dev/null @@ -1,47 +0,0 @@ -/*- - * Copyright (c) 2017 M. Warner Losh - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include -#include "namespace.h" -#include -#include -#include "compat-ino64.h" -#include - -#include "libc_private.h" - -int -statfs(const char *path, struct statfs *buf) -{ - struct freebsd11_statfs statfs11; - int rv; - - if (__getosreldate() >= INO64_FIRST) - return (__sys_statfs(path, buf)); - rv = syscall(SYS_freebsd11_statfs, path, &statfs11); - if (rv == 0) - __statfs11_to_statfs(&statfs11, buf); - return (rv); -} diff --git a/libexec/rtld-elf/rtld-libc/Makefile.inc b/libexec/rtld-elf/rtld-libc/Makefile.inc index 91eb6f5cabec..c3a74fbecbdc 100644 --- a/libexec/rtld-elf/rtld-libc/Makefile.inc +++ b/libexec/rtld-elf/rtld-libc/Makefile.inc @@ -56,8 +56,8 @@ CFLAGS.strtok.c+=-Wno-cast-qual _libc_other_objects= sigsetjmp lstat stat fstat fstatat fstatfs syscall \ cerror geteuid getegid sigfastblock munmap mprotect \ sysarch __sysctl issetugid __getcwd utrace getpid \ - thr_self thr_kill pread mmap lseek _exit _fstat _fstatat _fstatfs \ - getdirentries _getdirentries _close _fcntl _open _openat _read \ + thr_self thr_kill pread mmap lseek _exit \ + getdirentries _close _fcntl _open _openat _read \ _sigprocmask _write readlink __realpathat _setjmp setjmp setjmperr