1 #include <unistd.h> 2 #include <limits.h> 3 #include <time.h> 4 #include <errno.h> 5 #include <sys/limits.h> 6 7 long 8 sysconf(int name) 9 { 10 switch(name) 11 { 12 case _SC_ARG_MAX: 13 return ARG_MAX; 14 case _SC_CHILD_MAX: 15 return CHILD_MAX; 16 case _SC_CLK_TCK: 17 return CLOCKS_PER_SEC; 18 case _SC_NGROUPS_MAX: 19 return NGROUPS_MAX; 20 case _SC_OPEN_MAX: 21 return OPEN_MAX; 22 case _SC_JOB_CONTROL: 23 #ifdef _POSIX_JOB_CONTROL 24 return _POSIX_JOB_CONTROL; 25 #else 26 return -1; 27 #endif 28 case _SC_SAVED_IDS: 29 #ifdef _POSIX_SAVED_IDS 30 return _POSIX_SAVED_IDS; 31 #else 32 return -1; 33 #endif 34 case _SC_VERSION: 35 return _POSIX_VERSION; 36 } 37 errno = EINVAL; 38 return -1; 39 } 40