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 ",sysconf(_SC_PAGESIZE));  

  printf("Max length of a  hostname:%ld ",sysconf(_SC_HOST_NAME_MAX));

  printf(" The maximum number of files that a process can have open at any time.:%ld ",sysconf(_SC_OPEN_MAX));

  printf("  The  number  of  clock  ticks  per  second.:%ld ",sysconf(_SC_CLK_TCK));

   printf("The number of processors currently online .:%ld ",sysconf(_SC_NPROCESSORS_ONLN));   printf("The number of processors configured..:%ld ",sysconf(_SC_NPROCESSORS_CONF));  

  return 0;  

}  

原文地址:https://www.cnblogs.com/hugb/p/7003131.html