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