回答:
あなたには調べる必要があります<limits.h>(例えば、またはそれに含まれるファイルの一つsys/syslimits.hのためにOS X上で)#defineのUID_MAX。
最新のオペレーティングシステム(Solaris 2.x、OS X、BSD、Linux、HP-UX 11i、AIX 6)は最大20億(2^31-2)を処理できるので、そうでないと思われるより曖昧なシステムの回避策を講じます't。
glibcは、これらすべてのシステムタイプの定義を提供します。
以下を確認できます/usr/include/bits/typesizes.h。
% grep UID_T /usr/include/bits/typesizes.h
#define __UID_T_TYPE __U32_TYPE
次に、あなたが調べます/usr/include/bits/types.h:
% grep '#define __U32_TYPE' /usr/include/bits/types.h
#define __U32_TYPE unsigned int
これにより、Cタイプを見つけることができます。バイト単位のサイズが必要なので、最良のオプションは、次の仕様に従ってtypedef名を解析することですtypes.h。
We define __S<SIZE>_TYPE and __U<SIZE>_TYPE for the signed and unsigned
variants of each of the following integer types on this machine.
16 -- "natural" 16-bit type (always short)
32 -- "natural" 32-bit type (always int)
64 -- "natural" 64-bit type (long or long long)
LONG32 -- 32-bit type, traditionally long
QUAD -- 64-bit type, always long long
WORD -- natural type of __WORDSIZE bits (int or long)
LONGWORD -- type of __WORDSIZE bits, traditionally long
それで、ここにワンライナーがあります:
% grep '#define __UID_T_TYPE' /usr/include/bits/typesizes.h | cut -f 3 | sed -r 's/__([US])([^_]*)_.*/\1 \2/'
U 32
ここUの手段unsigned(これも可能Sのためsigned)と32大きさである(上記のリストにそれを見て、ほとんどの時間は、あなたはそれがすでにバイト単位のサイズだと仮定することができ、私は思いますが、あなたはあなたのスクリプトが完全に移植、それになりたい場合はcaseこの値をオンにする方が良いかもしれません)。
/usr/include/$(gcc -print-multiarch)/bits/typesizes.hまたは、代わりに/usr/include/$(dpkg-architecture -qDEB_HOST_MULTIARCH)/bits/typesizes.h
UID_MAX。たとえば、UIDの最大値を見つけるためにshadow-utils使用(uid_t)-1するツール。