libutil: add O_NOCTTY back to old pty open code
[minix.git] / lib / libc / sys-minix / getrlimit.c
blob291e3daabb7c953143542e107ce1c224ed5dc22f
1 /* getrlimit Author: Erik van der Kouwe
2 * query resource consumtion limits 4 December 2009
4 * Based on these specifications:
5 * http://www.opengroup.org/onlinepubs/007908775/xsh/getdtablesize.html
6 * http://www.opengroup.org/onlinepubs/007908775/xsh/getrlimit.html
7 */
9 #include <sys/cdefs.h>
10 #include "namespace.h"
12 #include <errno.h>
13 #include <limits.h>
14 #include <sys/resource.h>
15 #include <unistd.h>
17 int getrlimit(int resource, struct rlimit *rlp)
19 rlim_t limit;
21 switch (resource)
23 case RLIMIT_CORE:
24 /* no core currently produced */
25 limit = 0;
26 break;
28 case RLIMIT_CPU:
29 case RLIMIT_DATA:
30 case RLIMIT_FSIZE:
31 case RLIMIT_STACK:
32 case RLIMIT_AS:
33 /* no limit enforced (however architectural limits
34 * may apply)
35 */
36 limit = RLIM_INFINITY;
37 break;
39 case RLIMIT_NOFILE:
40 limit = OPEN_MAX;
41 break;
43 default:
44 errno = EINVAL;
45 return -1;
48 /* return limit */
49 rlp->rlim_cur = limit;
50 rlp->rlim_max = limit;
51 return 0;