From nobody Fri Nov 15 02:02:13 2024 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 4XqKys49rnz5dRDg; Fri, 15 Nov 2024 02:02:13 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4XqKys3Vjdz4dWw; Fri, 15 Nov 2024 02:02:13 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1731636133; 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=FEwnsG2hi6IJKVYZq0ex8DxxMpIMfI0rSMnL1TebtLA=; b=IcSyzg7qlwOvFMZ5stv1bn0xoy4zUpo8aHqrfLEdVbhzZv3SFvJGJVmdBHLj/ApfsvgC2D o91ATJsN1zCDYuRuZLGPRIPJWkH+ofn/nfmW+j/Us7CULOXi+UBAiWEjZr6XnwMTc/2rPx r4x+wiRI+tKoC6EO8Vw8T/X2TCV9ZnglCxyOo4Kww4/sUoiQEKfJIShaQK98bksWv8WO1R KcomNtHBVOK2sjx0DlZ0KCFEUU0YF/F1E0WWwgv9mFtge4l24CwJY0bI13xOfoqr8m0VM1 OpdlNhHYSXH4aRgfnExLJPSN51WJK6SDK46AH89hAzYbi2hg6YKa0gedr0FzGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1731636133; 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=FEwnsG2hi6IJKVYZq0ex8DxxMpIMfI0rSMnL1TebtLA=; b=Mn1F6Jw6ZcN0ZhZWRm7EsSa9+TWmz3SYaomFDmC/AxNIgTplgQ5jmfUbVJNJDXrEhK/64/ n+LA5sjAe7Ue2wNAfOHG9iWsXF7tDFiBugEBvsEnjgqsqLRVu1x0JjkWaIq8l23y3cKSAn Hm7SFH/ZEhLQSMGMiTLDWfLBcoExxLEzXj8S0O19tLM8fIY+5GdkhwdwrFG6SQP0vXnkuW q+OWq6aqNxMTf5tz4qX7AIAmv+h2NTZO/y8Oyvmm2HJsnhfIQxpMni3bIoamBjgL1URqO7 WrUqENPUf0hL2mqPBan+kI0YXm9GdD7jWkJEFTqn4sm1FQK37wlpLHw5tg70yg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1731636133; a=rsa-sha256; cv=none; b=OKPfvyhKd6vNa7jeC1+k/NQjKpG3mvshFrsGUK5IHVi+1sz6UQdRiWBmr37QowJbYZONoP 0fc4n30bOWS8xxgEmxnPgl/ECff36ncMRPsCsu+hsB6WoPZPt9H/0VcGFY9pQBrElgxT+l cegQVL1mKboRy7HQukkUJwGxuMUIliw58kA+lOHAqDb1k+StasIC4xRewbCaLblyGoaKEE L236sh6/hVaNcTF6WpPrb9vD4JXbAJeQkMysCZmZCwkRSIYmfMkFHkRkJWiWED8ELgNAwY GCXZ0VU4tq3qFemnPLdSFYEUMu5g5JtCpfTZY0pUhPnRoG71XIEgQWYVmwRMWA== 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 4XqKys2q2Lz13XQ; Fri, 15 Nov 2024 02:02:13 +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 4AF22DWY049276; Fri, 15 Nov 2024 02:02:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4AF22DFR049273; Fri, 15 Nov 2024 02:02:13 GMT (envelope-from git) Date: Fri, 15 Nov 2024 02:02:13 GMT Message-Id: <202411150202.4AF22DFR049273@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: f6ed9cd68c28 - main - cdefs.h: Document the _XOPEN_SOURCE - 0 construct 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: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f6ed9cd68c28b18082773c6f77cee4b8492dcfe6 Auto-Submitted: auto-generated The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=f6ed9cd68c28b18082773c6f77cee4b8492dcfe6 commit f6ed9cd68c28b18082773c6f77cee4b8492dcfe6 Author: Warner Losh AuthorDate: 2024-11-14 23:53:13 +0000 Commit: Warner Losh CommitDate: 2024-11-15 02:01:12 +0000 cdefs.h: Document the _XOPEN_SOURCE - 0 construct Various System V Interface Definition editions, as well as the X/Open group portability guide issue 4, recommend defining _XOPEN_SOURCE and broadly intimating it means the same thing as _POSIX_SOURCE == 2. Starting in X/Open issue 5 (1995), _XOPEN_SOURCE needs to be defined to be 500 to bring in the newer interfaces. However, it is still common hat sources define _XOPEN_SOURCE to be blank. To deal with that, we subtract 0 from _XOPEN_SOURCE to make the other expressions well formed. While here, document that we should define _POSIX_C_SOURCE to be 199209 based on the SVID, the first version of the Single Unix Specification, and X/Open CAE issue 4, version 2. Also document that historically this has been a NOP. Any value of _XOPEN_SOURCE < 500 (including it being blank) was not viewed as a request for a restricted namespace. Reviewed by: brooks (earlier version) Differential Revision: https://reviews.freebsd.org/D47584 Sponsored by: Netflix --- sys/sys/cdefs.h | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/sys/sys/cdefs.h b/sys/sys/cdefs.h index 4100cc0de7a5..0f53ff816527 100644 --- a/sys/sys/cdefs.h +++ b/sys/sys/cdefs.h @@ -513,7 +513,16 @@ #define _POSIX_C_SOURCE 199209 #endif -/* Deal with various X/Open Portability Guides and Single UNIX Spec. */ +/* + * Deal with various X/Open Portability Guides and Single UNIX Spec. We use the + * '- 0' construct so software that defines _XOPEN_SOURCE to nothing doesn't + * cause errors. X/Open CAE Specification, August 1994, System Interfaces and + * Headers, Issue 4, Version 2 section 2.2 states an empty definition means the + * same thing as _POSIX_C_SOURCE == 2. This broadly mirrors "System V Interface + * Definition, Fourth Edition", but earlier editions suggest some ambiguity. + * However, FreeBSD has histoically implemented this as a NOP, so we just + * document what it should be for now to not break ports gratuitously. + */ #ifdef _XOPEN_SOURCE #if _XOPEN_SOURCE - 0 >= 800 #define __XSI_VISIBLE 800 @@ -531,6 +540,8 @@ #define __XSI_VISIBLE 500 #undef _POSIX_C_SOURCE #define _POSIX_C_SOURCE 199506 +#else +/* #define _POSIX_C_SOURCE 199209 */ #endif #endif