LoginSignup
27
29

More than 5 years have passed since last update.

Linuxのシステムコール番号を探す

Last updated at Posted at 2014-10-13

システムコール番号の探し方のメモ。たまに必要になるので。
(記事のタグはCentOS7だけれど、CentOS6.5でも同じ)

一覧をダンプする

$ ausyscall --dump
Using x86_64 syscall table:
0       read
1       write
2       open
3       close
.
.
.

ピンポイントで表示

名前->番号

$ ausyscall fork --exact
57

番号->名前

$ ausyscall 32
dup

アーキを指定

番号はアーキによって違うので!

$ ausyscall x86_64 fork
fork               57
vfork              58

$ ausyscall i386 fork
fork               2
vfork              190

定義ファイルを探して参照

$ grep 'define *__NR_fork' /usr/include/ -r
/usr/include/asm/unistd_32.h:#define __NR_fork 2
/usr/include/asm/unistd_64.h:#define __NR_fork 57
/usr/include/asm/unistd_x32.h:#define __NR_fork (__X32_SYSCALL_BIT + 57)
/usr/include/asm-generic/unistd.h:#define __NR_fork 1079

$ head /usr/include/asm/unistd_64.h
#ifndef _ASM_X86_UNISTD_64_H
#define _ASM_X86_UNISTD_64_H 1

#define __NR_read 0
#define __NR_write 1
#define __NR_open 2
#define __NR_close 3
#define __NR_stat 4
#define __NR_fstat 5
#define __NR_lstat 6
27
29
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
27
29