Skip to content

Commit

Permalink
Add a supplementary explanation to function get_syscall_fnname (iov…
Browse files Browse the repository at this point in the history
…isor#2593)

* add a supplementary explanation to function `get_syscall_fnname`.
* fix the contents
  • Loading branch information
wwyf authored and yonghong-song committed Nov 13, 2019
1 parent 2a2dbd2 commit a6f658d
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions docs/reference_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ This guide is incomplete. If something feels missing, check the bcc and kernel s
- [2. ksymname()](#2-ksymname)
- [3. sym()](#3-sym)
- [4. num_open_kprobes()](#4-num_open_kprobes)
- [5. get_syscall_fnname()](#5-get_syscall_fnname)

- [BPF Errors](#bpf-errors)
- [1. Invalid mem access](#1-invalid-mem-access)
Expand Down Expand Up @@ -1604,6 +1605,23 @@ Examples in situ:
[search /examples](https://github.com/iovisor/bcc/search?q=num_open_kprobes+path%3Aexamples+language%3Apython&type=Code),
[search /tools](https://github.com/iovisor/bcc/search?q=num_open_kprobes+path%3Atools+language%3Apython&type=Code)

### 5. get_syscall_fnname()

Syntax: ```BPF.get_syscall_fnname(name : str)```

Return the corresponding kernel function name of the syscall. This helper function will try different prefixes and use the right one to concatenate with the syscall name. Note that the return value may vary in different versions of linux kernel and sometimes it will causing trouble. (see [#2590](https://github.com/iovisor/bcc/issues/2590))

Example:

```Python
print("The function name of %s in kernel is %s" % ("clone", b.get_syscall_fnname("clone")))
# sys_clone or __x64_sys_clone or ...
```

Examples in situ:
[search /examples](https://github.com/iovisor/bcc/search?q=get_syscall_fnname+path%3Aexamples+language%3Apython&type=Code),
[search /tools](https://github.com/iovisor/bcc/search?q=get_syscall_fnname+path%3Atools+language%3Apython&type=Code)

# BPF Errors

See the "Understanding eBPF verifier messages" section in the kernel source under Documentation/networking/filter.txt.
Expand Down

0 comments on commit a6f658d

Please sign in to comment.