在 Debian(以及一般 Linux 系统)里,getconf 本身是“会区分架构”的,但是要分几个层面来理解:
getconf 查的是什么getconf 主要用来查询:
它不是直接“检测架构”的工具,但返回的值可能随架构不同而变化。
例如:
getconf LONG_BIT
6432getconf PAGE_SIZE
getconf WORD_BIT
getconf CHAR_BIT
还有:
getconf _POSIX_V6_ILP32_OFF32
getconf _POSIX_V7_LP64_OFF64
这些会随 数据模型(ILP32 / LP64) 变化。
像:
getconf PATH_SEPARATOR
getconf LINE_MAX
通常所有架构一致。
在 Debian 上如果你有:
amd64i386armhfarm64那么:
getconf 二进制可能不同例如:
dpkg -L libc-bin | grep getconf
在 multiarch 下:
/usr/bin/getconf
通常是 当前默认架构 的版本。
你可以用:
dpkg --print-architecture
确认当前架构。
schroot -c sid-i386
getconf LONG_BIT
交叉 rootfs 中:
chroot /srv/arm64-rootfs
getconf PAGE_SIZE
getconf -a | grep -i bit
getconf不“主动判断架构”,但它返回的值由当前运行的 C 库和 ABI 决定,因此在 Debian 上确实是“按架构区分”的。
如果你愿意,我可以帮你:
getconf -a 差异getconf 变量在 Debian 不同架构下的行为