Skip to content

Commit dd4a51b

Browse files
wwyfsync_forks
authored and
sync_forks
committed
Add a supplementary explanation to function get_syscall_fnname (iovisor#2593)
* add a supplementary explanation to function `get_syscall_fnname`. * fix the contents
1 parent ac64565 commit dd4a51b

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

docs/reference_guide.md

+18
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ This guide is incomplete. If something feels missing, check the bcc and kernel s
8686
- [2. ksymname()](#2-ksymname)
8787
- [3. sym()](#3-sym)
8888
- [4. num_open_kprobes()](#4-num_open_kprobes)
89+
- [5. get_syscall_fnname()](#5-get_syscall_fnname)
8990

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

1608+
### 5. get_syscall_fnname()
1609+
1610+
Syntax: ```BPF.get_syscall_fnname(name : str)```
1611+
1612+
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))
1613+
1614+
Example:
1615+
1616+
```Python
1617+
print("The function name of %s in kernel is %s" % ("clone", b.get_syscall_fnname("clone")))
1618+
# sys_clone or __x64_sys_clone or ...
1619+
```
1620+
1621+
Examples in situ:
1622+
[search /examples](https://github.com/iovisor/bcc/search?q=get_syscall_fnname+path%3Aexamples+language%3Apython&type=Code),
1623+
[search /tools](https://github.com/iovisor/bcc/search?q=get_syscall_fnname+path%3Atools+language%3Apython&type=Code)
1624+
16071625
# BPF Errors
16081626

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

0 commit comments

Comments
 (0)