Debian Codegraph @

testsuite/systemtap.syscall/uselib.c

raw
1 /* COVERAGE: uselib */
2
3 #define _GNU_SOURCE
4 #include <unistd.h>
5 #include <sys/syscall.h>
6 #include <linux/version.h>
7 #include <sys/mman.h>
8
9 int main()
10 {
11 // Some systems define __NR_uselib but do not implement uselib
12 // syscall. Examples are 3.10.0-229.el7.x86_64, or
13 // 3.19.4-200.fc21.i686+PAE.
14 //
15 // On 2.6.18-398.el5 (x86_64), the 32-bit version of uselib() is
16 // set up to call 'quiet_ni_syscall()', which is an assembly
17 // language function that we can't probe. This was changed in
18 // 2.6.22.
19 #if defined(__NR_uselib)
20 #define uselib(x) syscall(__NR_uselib,x)
21 mlockall(MCL_CURRENT);
22
23 uselib("blah");
24 //staptest// [[[[uselib ("blah") = -NNNN!!!!ni_syscall () = -NNNN (ENOSYS)]]]]
25
26 uselib((const char *)-1);
27 #ifdef __s390__
28 //staptest// [[[[uselib (0x[7]?[f]+)!!!!ni_syscall ()]]]] = -NNNN
29 #else
30 //staptest// [[[[uselib (0x[f]+) = -NNNN!!!!ni_syscall () = -NNNN (ENOSYS)]]]]
31 #endif
32 #endif
33
34 return 0;
35 }