root / branches / simulator / projects / simulator / test / test_rlimit.c @ 989
History | View | Annotate | Download (447 Bytes)
1 |
#include <stdio.h> |
---|---|
2 |
#include <sys/time.h> |
3 |
#include <sys/resource.h> |
4 |
|
5 |
int main()
|
6 |
{ |
7 |
int ret;
|
8 |
struct rlimit rl;
|
9 |
|
10 |
ret = getrlimit(RLIMIT_CPU, &rl); |
11 |
|
12 |
printf("getrlimit(RLIMIT_CPU) returned %d.\n"
|
13 |
"soft = %d\nhard = %d\n",
|
14 |
ret, rl.rlim_cur, rl.rlim_max); |
15 |
|
16 |
printf("seting soft limit to 3 seconds...\n");
|
17 |
|
18 |
rl.rlim_cur = 30;
|
19 |
ret = setrlimit(RLIMIT_CPU, &rl); |
20 |
|
21 |
printf("done. returned %d\nentering loop", ret);
|
22 |
|
23 |
while(1); |
24 |
|
25 |
return 0; |
26 |
} |