sysconf获取系统参数
Posted Andy.gbhu
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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获取系统参数的主要内容,如果未能解决你的问题,请参考以下文章
通过System.getProperties()获取系统参数