| 1 |
/* COVERAGE: get_thread_area set_thread_area */ |
| 2 |
|
| 3 |
#define _GNU_SOURCE |
| 4 |
#include <unistd.h> |
| 5 |
#include <sys/syscall.h> |
| 6 |
#include <linux/unistd.h> |
| 7 |
|
| 8 |
#if defined __NR_get_thread_area && defined __NR_set_thread_area |
| 9 |
|
| 10 |
#include <asm/ldt.h> |
| 11 |
|
| 12 |
static inline int |
| 13 |
__get_thread_area(struct user_desc *u_info) |
| 14 |
{ |
| 15 |
return syscall(__NR_get_thread_area, u_info); |
| 16 |
} |
| 17 |
|
| 18 |
static inline int |
| 19 |
__set_thread_area(struct user_desc *u_info) |
| 20 |
{ |
| 21 |
return syscall(__NR_set_thread_area, u_info); |
| 22 |
} |
| 23 |
|
| 24 |
int |
| 25 |
main() |
| 26 |
{ |
| 27 |
struct user_desc ud; |
| 28 |
ud.entry_number = -1; |
| 29 |
__set_thread_area(&ud); |
| 30 |
//staptest// [[[[set_thread_area ({entry_number=XXXX, base_addr=XXXX, limit=XXXX, seg_32bit=XXXX, contents=XXXX, read_exec_only=XXXX, limit_in_pages=XXXX, seg_not_present=XXXX, useable=XXXX[[[[, lm=XXXX!!!!]]]]})!!!!ni_syscall ()]]]] = NNNN |
| 31 |
|
| 32 |
__get_thread_area(&ud); |
| 33 |
//staptest// [[[[get_thread_area ({entry_number=XXXX, base_addr=XXXX, limit=XXXX, seg_32bit=XXXX, contents=XXXX, read_exec_only=XXXX, limit_in_pages=XXXX, seg_not_present=XXXX, useable=XXXX[[[[, lm=XXXX!!!!]]]]})!!!!ni_syscall ()]]]] = NNNN |
| 34 |
|
| 35 |
// Limit testing |
| 36 |
|
| 37 |
__set_thread_area((struct user_desc *)-1); |
| 38 |
//staptest// [[[[set_thread_area (0x[f]+)!!!!ni_syscall ()]]]] = NNNN |
| 39 |
|
| 40 |
__get_thread_area((struct user_desc *)-1); |
| 41 |
//staptest// [[[[get_thread_area (0x[f]+)!!!!ni_syscall ()]]]] = NNNN |
| 42 |
|
| 43 |
return 0; |
| 44 |
} |
| 45 |
#else |
| 46 |
int |
| 47 |
main() |
| 48 |
{ |
| 49 |
return 0; |
| 50 |
} |
| 51 |
#endif |