NetBSD-Users archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: getconf LONG_BIT in NetBSD
On Sun, May 19, 2024 at 22:08:27 +0200, Ramiro Aceves wrote:
> I see that "getconf LONG_BIT" works in other systems such as Linux and
> FreeBSD but in NetBSD I have tried it and it does not work:
>
> netbsd-nuc$ getconf LONG_BIT
> getconf: LONG_BIT: unknown variable
>
>
> I read this on limits (3) man page about LONG_BIT:
>
> XSI Limits
> Also the X/Open System Interface Extension (XSI) specifies few limits.
> In NetBSD these are limited to LONG_BIT (the number of bits in long),
> WORD_BIT (the number of bits in a “word”), and few limits related to float
> and double.
>
> How can I get the value of the LONG_BIT variable?
Pedantically speaking, LONG_BIT is not a "conf" variable, so the
question is where you draw the line for getconf(1)? What should be
returned for LONG_BIT on a system that can run both 32-bit and 64-bit
code (amd64/i386, sparc64/sparc, etc).
Looking a bit closer at the Open Group text for getconf(1) and
friends, I think they intend this kind of stuff to be onbtained via
POSIX_V7_WIDTH_RESTRICTED_ENVS getconf/confstr() and getconf -v
argument.
https://pubs.opengroup.org/onlinepubs/9699919799/utilities/getconf.html
https://pubs.opengroup.org/onlinepubs/9699919799/utilities/c99.html#tag_20_11_13_04
We don't support getconf -v and it seems a bit clunky and posixy
anyway. What's wrong with doing it the autoconf way by running the
compiler you are going to use? :)
-uwe
Home |
Main Index |
Thread Index |
Old Index