On Linux systems (either 32- or 64-bit), what is the size of pid_t
, uid_t
, and gid_t
?
相关问题
- Multiple sockets for clients to connect to
- Is shmid returned by shmget() unique across proces
- What is the best way to do a search in a large fil
- glDrawElements only draws half a quad
- how to get running process information in java?
The standard defines
pid_t
as a "signed integer type" anduid_t
andgid_t
merely as "integer types" (so portable code shouldn't assume any particular type for them).On intel architectures, sizes are defined in
/usr/include/bits/typesizes.h
:In other words,
uid_t
andgid_t
are unsigned 32-bit integers andpid_t
is a signed 32-bit integer. This applies for both 32- and 64-bits.I am not sure what they are on other architectures offhand as I don't have any available at the moment, but the definitive way is to compile a program which prints the output of
sizeof(uid_t)
, etc.EDIT: Per popular request (and because, realistically, 99% of the people coming to this question are going to be running x86 or x86_64)...
On an i686 and x86_64 (so, 32-bit and 64-bit) processor running Linux >= 3.0.0, the answer is: