File: syscall_table.stp

package info (click to toggle)
systemtap 4.0-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 36,436 kB
  • sloc: cpp: 72,388; ansic: 58,430; xml: 47,797; exp: 40,417; sh: 10,793; python: 2,759; perl: 2,252; tcl: 1,305; makefile: 1,119; lisp: 105; java: 102; awk: 101; asm: 91; sed: 16
file content (47 lines) | stat: -rw-r--r-- 1,475 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
# This is syscall_table tapset providing namely syscall_name() and syscall_num()
# functions.  It uses architecture specific data contained in other arch
# specific tapsets.  Helper scripts/dump-syscalls.sh is used to generate those.

function syscall_name(num) {
%( CONFIG_COMPAT == "y" %?
    if (@__compat_task)
        return __syscall_32_num2name[num]
%)
%( CONFIG_64BIT == "y" %?
    return __syscall_64_num2name[num]
%:
    return __syscall_32_num2name[num]
%)
}

# Systemtap is benevolent when an associative array is being queried for an
# unexisting key.  If we call e.g. __syscall_64_name2num["unexisting_syscall"],
# the result is zero.  But at the same time zero is a valid syscall number, so
# we really need to return some other value in this case to indicate that
# syscall with given name doesn't exist.  Let's use following
# @return_sanitized macro.
#
# The other way round, when evaluating e.g. __syscall_64_num2name[-123], stap
# is benevolent too - we'll get an empty string.  But that is sufficiently
# unique, so we are good at this front.

@define return_sanitized(indexable, key)
%(
    if (@key in @indexable)
        return @indexable[@key]
    else
        return -1
%)

function syscall_num(name) {
%( CONFIG_COMPAT == "y" %?
    if (@__compat_task)
        @return_sanitized(__syscall_32_name2num, name)
%)
%( CONFIG_64BIT == "y" %?
    @return_sanitized(__syscall_64_name2num, name)
%:
    @return_sanitized(__syscall_32_name2num, name)
%)
}