Debian Codegraph @

testsuite/systemtap.syscall/modify_ldt.c

raw
1 /* COVERAGE: modify_ldt */
2
3 #define _GNU_SOURCE
4 #include <unistd.h>
5 #include <sys/types.h>
6 #include <sys/syscall.h>
7
8 #if defined(__NR_modify_ldt) && !defined(__powerpc64__)
9 #include <asm/ldt.h>
10
11 static inline int
12 __modify_ldt(int func, void *ptr, unsigned long bytecount)
13 {
14 return syscall(__NR_modify_ldt, func, ptr, bytecount);
15 }
16 #endif
17
18 int main()
19 {
20 #if defined(__NR_modify_ldt) && !defined(__powerpc64__)
21 struct user_desc desc;
22
23 __modify_ldt(0, &desc, sizeof(desc));
24 //staptest// modify_ldt (0, XXXX, NNNN) = 0
25
26 /* Limit testing. */
27
28 __modify_ldt(-1, &desc, sizeof(desc));
29 //staptest// modify_ldt (-1, XXXX, NNNN) = NNNN
30
31 __modify_ldt(0, (void *)-1, 0);
32 //staptest// modify_ldt (0, 0x[f]+, 0) = NNNN
33
34 __modify_ldt(0, NULL, (unsigned long)-1L);
35 #if __WORDSIZE == 64
36 //staptest// modify_ldt (0, 0x0, 18446744073709551615) = NNNN
37 #else
38 //staptest// modify_ldt (0, 0x0, 4294967295) = NNNN
39 #endif
40 #endif
41 }