首页 > 代码库 > sysconf获取系统参数
sysconf获取系统参数
头文件: #include <unistd.h>
原型:long sysconf(int sysnum);
示例:
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
int main() {
printf("Size of a page in bytes:%ld\n",sysconf(_SC_PAGESIZE));
printf("Max length of a hostname:%ld\n",sysconf(_SC_HOST_NAME_MAX));
printf(" The maximum number of files that a process can have open at any time.:%ld\n",sysconf(_SC_OPEN_MAX));
printf(" The number of clock ticks per second.:%ld\n",sysconf(_SC_CLK_TCK));
printf("The number of processors currently online .:%ld\n",sysconf(_SC_NPROCESSORS_ONLN)); printf("The number of processors configured..:%ld\n",sysconf(_SC_NPROCESSORS_CONF));
return 0;
}
sysconf获取系统参数
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。