Linux 上 pid_t、uid_t、gid_t 的大小 [英] Size of pid_t, uid_t, gid_t on Linux
本文介绍了Linux 上 pid_t、uid_t、gid_t 的大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在 Linux 系统(32 位或 64 位)上,pid_t
、uid_t
和 gid_t
的大小是多少?
On Linux systems (either 32- or 64-bit), what is the size of pid_t
, uid_t
, and gid_t
?
推荐答案
#include <stdio.h>
#include <sys/types.h>
int main()
{
printf("pid_t: %zu
", sizeof(pid_t));
printf("uid_t: %zu
", sizeof(uid_t));
printf("gid_t: %zu
", sizeof(gid_t));
}
每个受欢迎的请求(并且因为,实际上,99% 的人会使用 x86 或 x86_64)...
Per popular request (and because, realistically, 99% of the people coming to this question are going to be running x86 or x86_64)...
在运行 Linux >= 3.0.0 的 i686 和 x86_64(因此,32 位和 64 位)处理器上,答案是:
On an i686 and x86_64 (so, 32-bit and 64-bit) processor running Linux >= 3.0.0, the answer is:
pid_t: 4
uid_t: 4
gid_t: 4
这篇关于Linux 上 pid_t、uid_t、gid_t 的大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文