File: thread_area.c

package info (click to toggle)
systemtap 4.8-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 39,000 kB
  • sloc: cpp: 78,785; ansic: 62,419; xml: 49,443; exp: 42,735; sh: 11,254; python: 3,062; perl: 2,252; tcl: 1,305; makefile: 1,072; lisp: 105; awk: 101; asm: 91; java: 56; sed: 16
file content (51 lines) | stat: -rw-r--r-- 1,399 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/* COVERAGE: get_thread_area set_thread_area */

#define _GNU_SOURCE
#include <unistd.h>
#include <sys/syscall.h>
#include <linux/unistd.h>

#if defined __NR_get_thread_area && defined __NR_set_thread_area

#include <asm/ldt.h>

static inline int
__get_thread_area(struct user_desc *u_info)
{
    return syscall(__NR_get_thread_area, u_info);
}

static inline int
__set_thread_area(struct user_desc *u_info)
{
    return syscall(__NR_set_thread_area, u_info);
}

int
main()
{
    struct user_desc ud;
    ud.entry_number = -1;
    __set_thread_area(&ud);
    //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

    __get_thread_area(&ud);
    //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

    // Limit testing

    __set_thread_area((struct user_desc *)-1);
    //staptest// [[[[set_thread_area (0x[f]+)!!!!ni_syscall ()]]]] = NNNN

    __get_thread_area((struct user_desc *)-1);
    //staptest// [[[[get_thread_area (0x[f]+)!!!!ni_syscall ()]]]] = NNNN

    return 0;
}
#else
int
main()
{
    return 0;
}
#endif