Comments (5)
The solution ended up more complicated (as the asm-generic/unistd.h has different format for some #defines due to old 32-64 bit compat reasons). But the x86 system uses the traditional unistd file/format... so I made the unistd.h file lookup platform specific (currently just aarch64 vs everything else).
Works on my x86_64 RHEL8 clone and aarch64 RHEL9 so far:
tanel@linux01 0xtools]$ sudo psn -p nslookup -a -G syscall,wchan,kstack
Linux Process Snapper v1.2.4 by Tanel Poder [https://0x.tools]
Sampling /proc/stat, syscall, wchan, stack for 5 seconds...
finished.
=== Active Threads =======================================================================================================================================================
samples | avg_threads | comm | state | syscall | wchan | kstack
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
100 | 1.00 | (isc-socket) | Sleep (Interruptible) | epoll_wait | 0 | __x64_sys_epoll_wait()->do_epoll_wait()->ep_poll()
100 | 1.00 | (isc-timer) | Sleep (Interruptible) | futex | 0 | __x64_sys_futex()->do_futex()->futex_wait()->futex_wait_queue_me()
100 | 1.00 | (isc-worker*) | Sleep (Interruptible) | read | 0 | ksys_read()->vfs_read()->new_sync_read()->tty_read()->n_tty_read()->wait_woken()
100 | 1.00 | (nslookup) | Sleep (Interruptible) | rt_sigsuspend | 0 | __x64_sys_rt_sigsuspend()->sigsuspend()
samples: 100
(expected: 100)
total processes: 1, threads: 4
runtime: 5.00, measure time: 0.47
aarch64:
[tanel@rhel9 ~]$ sudo psn -p nslookup -G syscall,wchan,kstack -a
Linux Process Snapper v1.2.4 by Tanel Poder [https://0x.tools]
Sampling /proc/stat, syscall, wchan, stack for 5 seconds...
finished.
=== Active Threads =========================================================================================================================================================================================
samples | avg_threads | comm | state | syscall | wchan | kstack
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
100 | 1.00 | (isc-net-*) | Sleep (Interruptible) | read | wait_woken | __arm64_sys_read()->ksys_read()->vfs_read()->new_sync_read()->tty_read()->n_tty_read()->wait_woken()
100 | 1.00 | (isc-socket-*) | Sleep (Interruptible) | epoll_pwait | ep_poll | __arm64_sys_epoll_pwait()->do_epoll_wait()->ep_poll()
100 | 1.00 | (isc-timer) | Sleep (Interruptible) | futex | futex_wait_queue | __arm64_sys_futex()->do_futex()->futex_wait()->futex_wait_queue()
100 | 1.00 | (nslookup) | Sleep (Interruptible) | rt_sigtimedwait | do_sigtimedwait | __arm64_sys_rt_sigtimedwait()->do_sigtimedwait()
samples: 100
(expected: 100)
total processes: 1, threads: 4
runtime: 5.01, measure time: 0.40
Made some other minor improvements too (but will do the release tomorrow).
from 0xtools.
Ok interesting. Which architeture is it (intel or arm?). I tested on my RHEL 9.2 env and it was ok (not exactly the same as your env).
The syscall 45 should be recvfrom
, but for some reason it wasn't picket up...
can you send the output of:
ls -l /usr/include/asm-generic/unistd.h /usr/include/asm/unistd_64.h /usr/include/x86_64-linux-gnu/asm/unistd_64.h /usr/ include/asm-x86_64/unistd.h /usr/include/asm/unistd.h
grep -H " 45" /usr/include/asm-generic/unistd.h /usr/include/asm/unistd_64.h /usr/include/x86_64-linux-gnu/asm/unistd_64 .h /usr/include/asm-x86_64/unistd.h /usr/include/asm/unistd.h
rpm -ql kernel-headers | grep unistd
from 0xtools.
It's intel cpu. Here is the output. Thanks.
[root@tc-tikv-0 /]# ls -l /usr/include/asm-generic/unistd.h /usr/include/asm/unistd_64.h /usr/include/x86_64-linux-gnu/asm/unistd_64.h /usr/ include/asm-x86_64/unistd.h /usr/include/asm/unistd.h
ls: cannot access '/usr/include/x86_64-linux-gnu/asm/unistd_64.h': No such file or directory
ls: cannot access 'include/asm-x86_64/unistd.h': No such file or directory
-rw-r--r-- 1 root root 31321 May 10 01:24 /usr/include/asm-generic/unistd.h
-rw-r--r-- 1 root root 623 May 10 01:24 /usr/include/asm/unistd.h
-rw-r--r-- 1 root root 9716 May 10 01:24 /usr/include/asm/unistd_64.h
/usr/:
total 60
drwxr-xr-x 1 root root 4096 May 24 21:49 bin
drwxr-xr-x 2 root root 4096 May 16 2022 games
drwxr-xr-x 1 root root 4096 May 24 21:49 include
dr-xr-xr-x 1 root root 4096 May 24 21:49 lib
dr-xr-xr-x 1 root root 4096 May 24 21:49 lib64
drwxr-xr-x 1 root root 4096 May 24 21:49 libexec
drwxr-xr-x 12 root root 4096 Feb 16 03:32 local
dr-xr-xr-x 1 root root 4096 May 24 21:49 sbin
drwxr-xr-x 1 root root 4096 May 24 21:49 share
drwxr-xr-x 4 root root 4096 Feb 16 03:32 src
lrwxrwxrwx 1 root root 10 May 16 2022 tmp -> ../var/tmp
[root@tc-tikv-0 /]# grep -H " 45" /usr/include/asm-generic/unistd.h /usr/include/asm/unistd_64.h /usr/include/x86_64-linux-gnu/asm/unistd_64 .h /usr/include/asm-x86_64/unistd.h /usr/include/asm/unistd.h
/usr/include/asm-generic/unistd.h:#define __NR3264_truncate 45
/usr/include/asm-generic/unistd.h:#define __NR_syscalls 450
/usr/include/asm/unistd_64.h:#define __NR_recvfrom 45
grep: /usr/include/x86_64-linux-gnu/asm/unistd_64: No such file or directory
grep: .h: No such file or directory
grep: /usr/include/asm-x86_64/unistd.h: No such file or directory
[root@tc-tikv-0 /]# rpm -ql kernel-headers | grep unistd
/usr/include/asm-generic/unistd.h
/usr/include/asm/unistd.h
/usr/include/asm/unistd_32.h
/usr/include/asm/unistd_64.h
/usr/include/asm/unistd_x32.h
/usr/include/linux/unistd.h
from 0xtools.
is it due to the recvfrom
is missing in the /usr/include/asm-generic/unistd.h
, should we merge the the key-values from all the header files rather then just return from the first available header file?
from 0xtools.
verified it's been fix in 1.2.4
from 0xtools.
Related Issues (20)
- Improve schedlat to report thread/task sched latency
- Enhancement: Addition of checksum to go with a release
- add command line option to sample processes of a user
- Add tid field to psn
- Fix missing newlines when formatting python3 HOT 1
- KeyError getting syscall_id HOT 7
- Not working on Fedora 35 HOT 7
- cmdline HOT 1
- Modify Makefile to better accommodate cross compilation HOT 4
- Pstool snapshot HOT 1
- unistd_64.h HOT 6
- add epoll_pwait() to the list of single-fd syscalls
- psn v1.2.3 release may show wrong syscall names on x86_64 due to looking them up from a wrong/template file HOT 1
- bpf_attach_raw_tracepoint (sched_switch): Invalid argument on ARM64 HOT 2
- Problem building from source on Linux with gcc 13.2.0 HOT 3
- AlmaLinux 8.9.0 Please make sure you have the correct access rights and the repository exists. HOT 1
- Homebrew Installation / Package Managers? HOT 3
- make psn-embedded sqlite use a /tmp file instead of an in-memory DB HOT 3
- ubuntu 18 error while running make HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from 0xtools.