Help us understand the problem. What is going on with this article?

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

More than 5 years have passed since last update.

システムコール番号の探し方のメモ。たまに必要になるので。
(記事のタグは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
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした