From nobody Wed Oct 1 03:13:15 2025 X-Original-To: dev-commits-src-all@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 4cc0P80X5Lz69tB5; Wed, 01 Oct 2025 03:13:16 +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 "R12" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4cc0P71cxGz3LKb; Wed, 01 Oct 2025 03:13:15 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1759288395; 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=/4afh1lvij3c6SBhs/o2cekb/n2/YnIESRc10uRrYVQ=; b=IcmyA8Dk0vpR8k5aQoHD/iYPVFEGMfcM6CKYm3e99bUgPQpdvze0SZRhX2UJ9PV0nQV5/d JbRwn0rWfIyj3zvzadSxu7M7o8LSfa/DMuZZCWYQiPf7xaGgYizL/B5f9SV6YiszCgzijZ s6xfOLw+EPAimPMmmSSGqXivNsRAPheCB/PyVoKgYUBikrxNNJyNpe3TNOLZO4yrKHgA0p ymgvOHuMDQ8ccJF3O919Y3UxjwfqzOiyXFOzJ/efPsPKoK0zohqj8og8BRrQpQDjJAGIe5 siSQ5txKr/5N6Go0ZFM/ZD9mk18MyEShlkltJItISq9qTqeYvKl6ilHZuC8RGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1759288395; 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=/4afh1lvij3c6SBhs/o2cekb/n2/YnIESRc10uRrYVQ=; b=FPYWCSsf3vUFCn4BXQCjGgt5RXIcNRQQdWU4Erc9PrDEVxJ6uREo85HhK7sEdOMsiZbF8O l9gijkxPtD2MqpVW9rQzw1/DwrFN6IR33FQMBzDUsZCAUYx9PEi9StR6d1fXDlfo4G3lL+ 8vLK2h9PnMIOvC/sc+au8rvXAUPP1sFExCzcR1UWegNI3gK6+Uau0+qMGpKbBqdTzhPDNO xvxIM2NFOwz2rAM2JyKtWK2GI3I7LGqWv57+DtBRSm7uW21PwHVRNl2rUn9c/+QfNCmY7T 9MX7j6MyVXNwtIjBxxLUeAVECe7N0qcSb6ujQz9av0LzpyMt2Dnu4tzp9D/8sA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1759288395; a=rsa-sha256; cv=none; b=wY+VEq43xJyz+VxldpCp9nqBO9PnGcMNnYz0GmKj++5XNF9lIGsACUUXyYfQKfmi7BC4XO 07tCPa3d8AznidVK00CgCSwc+MSsDvtderSNwKjH1A4pGs5GHXBrUIRLb+PV4Jut64ArZR fo2Q6K48MVdmcLxV9LxvYxQreKd07OPrV3NaULwb8tA0IX2H/HMA+q9B6q8m7IVB6wzN4B pswbFYtoXWCJI9Mrv7UQSaPji1Prap/ZV3uTxpvuxbl6QplSSiib5UNSDTDSOYn1yKknom YASz/lw680wQ0AUtm7n6sjt6OhKWJyql4vRoJECkSEzS69n2eiNQPi3vvjKuzA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4cc0P70xgzz141y; Wed, 01 Oct 2025 03:13:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 5913DFvN089737; Wed, 1 Oct 2025 03:13:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 5913DF03089734; Wed, 1 Oct 2025 03:13:15 GMT (envelope-from git) Date: Wed, 1 Oct 2025 03:13:15 GMT Message-Id: <202510010313.5913DF03089734@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 47f5f89dbd27 - stable/15 - libc: properly forward the compat syscall references to libsys List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/15 X-Git-Reftype: branch X-Git-Commit: 47f5f89dbd277caf1a0523d3863a259562c4c6b9 Auto-Submitted: auto-generated The branch stable/15 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=47f5f89dbd277caf1a0523d3863a259562c4c6b9 commit 47f5f89dbd277caf1a0523d3863a259562c4c6b9 Author: Konstantin Belousov AuthorDate: 2025-09-22 23:27:05 +0000 Commit: Konstantin Belousov CommitDate: 2025-10-01 03:00:08 +0000 libc: properly forward the compat syscall references to libsys (cherry picked from commit e194103bd35d9e08a5d271d814d6184ec159eadf) --- lib/libc/gen/gen-compat.h | 48 ++++++++++++++++++++++++++++++++++++----------- 1 file changed, 37 insertions(+), 11 deletions(-) diff --git a/lib/libc/gen/gen-compat.h b/lib/libc/gen/gen-compat.h index 74678301af6f..19b9addb4321 100644 --- a/lib/libc/gen/gen-compat.h +++ b/lib/libc/gen/gen-compat.h @@ -40,24 +40,50 @@ struct freebsd11_statfs; struct freebsd11_dirent *freebsd11_readdir(DIR *); int freebsd11_readdir_r(DIR *, struct freebsd11_dirent *, struct freebsd11_dirent **); -int freebsd11_stat(const char *, struct freebsd11_stat *); -int freebsd11_lstat(const char *, struct freebsd11_stat *); -int freebsd11_fstat(int, struct freebsd11_stat *); -int freebsd11_fstatat(int, const char *, struct freebsd11_stat *, int); -int freebsd11_statfs(const char *, struct freebsd11_statfs *); -int freebsd11_getfsstat(struct freebsd11_statfs *, long, int); int freebsd11_getmntinfo(struct freebsd11_statfs **, int); char *freebsd11_devname(__uint32_t dev, __mode_t type); -char *freebsd11_devname_r(__uint32_t dev, __mode_t type, char *buf, int len); +char *freebsd11_devname_r(__uint32_t dev, __mode_t type, char *buf, + int len); -#define F14SG int freebsd14_setgroups(int gidsize, const __gid_t *gidset) +/* + * We want freebsd11_fstat in C source to result in resolution to + * - fstat@FBSD_1.0 for libc.so (but we do not need the _definition_ + * of this fstat, it is provided by libsys.so which we want to use). + * - freebsd11_fstat for libc.a (since if we make it fstat@FBSD_1.0 + * for libc.a, then final linkage into static object ignores version + * and would reference fstat, which is the current syscall, not the + * compat syscall). libc.a provides the freebsd11_fstat implementation. + * Note that freebsd11_fstat from libc.a is not used for anything, but + * we make it correct nonetheless, just in case it would. + * This is arranged by COMPAT_SYSCALL, and libc can just use freebsd11_fstat. + */ #ifdef PIC -static F14SG __attribute__((__weakref__("setgroups@FBSD_1.0"))); +#define COMPAT_SYSCALL(rtype, fun, args, sym, ver) \ + rtype fun args; __sym_compat(sym, fun, ver); #else -F14SG; +#define COMPAT_SYSCALL(rtype, fun, args, sym, ver) \ + rtype fun args; #endif -#undef F14SG + +COMPAT_SYSCALL(int, freebsd11_stat, (const char *, struct freebsd11_stat *), + stat, FBSD_1.0); +COMPAT_SYSCALL(int, freebsd11_lstat, (const char *, struct freebsd11_stat *), + lstat, FBSD_1.0); +COMPAT_SYSCALL(int, freebsd11_fstat, (int, struct freebsd11_stat *), + fstat, FBSD_1.0); +COMPAT_SYSCALL(int, freebsd11_fstatat, (int, const char *, + struct freebsd11_stat *, int), fstatat, FBSD_1.1); + +COMPAT_SYSCALL(int, freebsd11_statfs, (const char *, + struct freebsd11_statfs *), statfs, FBSD_1.0); +COMPAT_SYSCALL(int, freebsd11_getfsstat, (struct freebsd11_statfs *, long, + int), getfsstat, FBSD_1.0); + +COMPAT_SYSCALL(int, freebsd14_setgroups, (int gidsize, const __gid_t *gidset), + setgroups, FBSD_1.0); + +#undef COMPAT_SYSCALL #endif /* _GEN_COMPAT_H_ */