Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1882 | clevermous | 1 | /* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */ |
2 | #include |
||
3 | #include |
||
4 | #include |
||
5 | |||
6 | extern struct rlimit __libc_limits[]; |
||
7 | |||
8 | int |
||
9 | setrlimit (int rltype, const struct rlimit *rlimitp) |
||
10 | { |
||
11 | /* check argument range */ |
||
12 | if (rlimitp->rlim_cur > rlimitp->rlim_max || rlimitp == NULL) |
||
13 | { |
||
14 | errno = EINVAL; |
||
15 | return -1; |
||
16 | } |
||
17 | |||
18 | switch (rltype) |
||
19 | { |
||
20 | case RLIMIT_CPU: |
||
21 | case RLIMIT_FSIZE: |
||
22 | case RLIMIT_DATA: |
||
23 | case RLIMIT_STACK: |
||
24 | case RLIMIT_CORE: |
||
25 | case RLIMIT_RSS: |
||
26 | case RLIMIT_MEMLOCK: |
||
27 | case RLIMIT_NPROC: |
||
28 | case RLIMIT_NOFILE: |
||
29 | /* not supported */ |
||
30 | errno = EPERM; |
||
31 | return -1; |
||
32 | default: |
||
33 | errno = EINVAL; |
||
34 | return -1; |
||
35 | } |
||
36 | |||
37 | return 0; |
||
38 | } |