use of the uniquely NetBSD _OPENBSD_SOURCE vs something better?
"Greg A. Woods" <[email protected]> Wed, 07 May 2025 11:24:41 -0700
| Newsgroups | gmane.os.netbsd.devel.userlevel |
|---|---|
| Organization | Planix, Inc. |
| Message-ID | <[email protected]> |
I happened to be looking at some source I have that uses strtonum(3) this morning and I noted I had to define _OPENBSD_SOURCE to make its prototype visible on NetBSD, but not on FreeBSD, nor of course on OpenBSD. On both OpenBSD and FreeBSD it is protected by __BSD_VISIBLE, which is I believe defined by default on both systems (especially if _BSD_SOURCE is defined on OpenBSD). There is no _OPENBSD_SOURCE on OpenBSD. It is purely a NetBSD invention. strfmon(3) is an example of a function taken from FreeBSD that's protected by _NETBSD_SOURCE, not something unique to indicate it came from FreeBSD. Shouldn't strtonum() likewise be protected by _NETBSD_SOURCE on NetBSD? I see reallocarray() has also been added within the _OPENBSD_SOURCE as well, and I think it too should only be protected by _NETBSD_SOURCE. Notably strlcpy() and strlcat() are not protected by this unique _OPENBSD_SOURCE though they both were invented by and taken from OpenBSD. Instead they are protected by _NETBSD_SOURCE. (Maybe _NETBSD_SOURCE should be changed to __BSD_VISIBLE too? There could be some confusion from that I guess given it would offer different symbols on different systems unless there's a _lot_ more coordination and cooperation between the system's developers!) -- Greg A. Woods <[email protected]> Kelowna, BC +1 250 762-7675 RoboHack <[email protected]> Planix, Inc. <[email protected]> Avoncote Farms <[email protected]>
signature.asc
(application/pgp-signature, 195 B)
-----BEGIN PGP SIGNATURE----- iF0EABECAB0WIQRuK6dmwVAucmRxuh9mfXG3eL/0fwUCaBulYwAKCRBmfXG3eL/0 f9oEAJ0f/YBsUvjJCHXe3aBGqvTXhlrRdgCgoA+JxPOwfI9iN5ZPNCqHFBKQd40= =fXeE -----END PGP SIGNATURE-----