中将为pid_t,将uid_t,gid_t在Linux上尺寸 [英] Size of pid_t, uid_t, gid_t on Linux

查看:1106
本文介绍了中将为pid_t,将uid_t,gid_t在Linux上尺寸的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Linux系统中(32位或64位),什么是将为pid_t 的大小将uid_t gid_t

解决方案

 的#include< stdio.h中>
#包括< SYS / types.h中>

诠释的main()
{
    的printf(将为pid_t:%祖\ N的sizeof(将为pid_t));
    的printf(将uid_t:%祖\ N的sizeof(将uid_t));
    的printf(gid_t:%祖\ N的sizeof(gid_t));
}
 

编辑:每受欢迎的请求(因为,现实的是,99%的人来到这个问题将要运行x86或x86_64的)...

在一个i686的和x86_64(所以,32位和64位)处理器,运行Linux> = 3.0.0,得到的答复是:

 将为pid_t:4
将uid_t:4
gid_t:4
 

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\n", sizeof(pid_t));
    printf("uid_t: %zu\n", sizeof(uid_t));
    printf("gid_t: %zu\n", sizeof(gid_t));
}

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:

pid_t: 4
uid_t: 4
gid_t: 4

这篇关于中将为pid_t,将uid_t,gid_t在Linux上尺寸的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆