Debian Codegraph @

testsuite/systemtap.syscall/getrlimit.c

raw
1 /* COVERAGE: getrlimit old_getrlimit setrlimit */
2 /* 'old_getrlimit' isn't a separate syscall from 'getrlimit'. On some
3 * platforms (like i386), getrlimit is implemented via
4 * old_getrlimit. */
5
6 #include <sys/time.h>
7 #include <sys/resource.h>
8
9 struct rlimit rlim;
10
11 int main()
12 {
13
14 // --- first try out normal operation ---
15
16 getrlimit(RLIMIT_CPU, &rlim);
17 //staptest// [[[[getrlimit (RLIMIT_CPU, XXXX)!!!!prlimit64 (0, RLIMIT_CPU, NULL, XXXX)]]]] = 0
18
19 setrlimit(RLIMIT_CPU, &rlim);
20 //staptest// [[[[setrlimit (RLIMIT_CPU, \[NNNN,NNNN\])!!!!prlimit64 (0, RLIMIT_CPU, \[NNNN,NNNN\], 0x0)]]]] = 0
21
22 // --- then check nasty calls ---
23
24 getrlimit(-1, &rlim);
25 //staptest// [[[[getrlimit (RLIM_INFINITY, XXXX)!!!!prlimit64 (0, RLIM_INFINITY, NULL, XXXX)]]]] = NNNN (EINVAL)
26
27 getrlimit(-15, &rlim);
28 //staptest// [[[[getrlimit (0xfffffff1, XXXX)!!!!prlimit64 (0, 0xfffffff1, NULL, XXXX)]]]] = NNNN (EINVAL)
29
30 getrlimit(RLIMIT_CPU, (struct rlimit *)-1);
31 #ifdef __s390__
32 //staptest// [[[[getrlimit (RLIMIT_CPU, 0x[7]?[f]+)!!!!prlimit64 (0, RLIMIT_CPU, 0x[7]?[f]+)]]]] = NNNN (EFAULT)
33 #else
34 //staptest// [[[[getrlimit (RLIMIT_CPU, 0x[f]+)!!!!prlimit64 (0, RLIMIT_CPU, NULL, 0x[f]+)]]]] = NNNN (EFAULT)
35 #endif
36
37 setrlimit(-1, &rlim);
38 //staptest// [[[[setrlimit (RLIM_INFINITY, \[NNNN,NNNN\])!!!!prlimit64 (0, RLIM_INFINITY, \[NNNN,NNNN\], 0x0)]]]] = NNNN (EINVAL)
39
40 // Causes a SIGSEGV...
41 #if 0
42 setrlimit(RLIMIT_CPU, (const struct rlimit *)-1);
43 #ifdef __s390__
44 //staptest// [[[[setrlimit (RLIMIT_CPU, 0x[7]?[f]+)!!!!prlimit64 (0, RLIMIT_CPU, 0x[7]?[f]+, 0x0)]]]] = NNNN (EFAULT)
45 #else
46 //staptest// [[[[setrlimit (RLIMIT_CPU, 0x[f]+)!!!!prlimit64 (0, RLIMIT_CPU, 0x[f]+, 0x0)]]]] = NNNN (EFAULT)
47 #endif
48 #endif
49
50 return 0;
51 }