SYSCALLS(2) Linux Programmer’s Manual SYSCALLS(2) 名前 syscalls - Linux のシステムコール 書式 Linux のシステムコール。 説明 システムコールは、アプリケーションと Linux カーネルとの間の基本的なイン タフェースである。 システムコールとライブラリのラッパー関数 システムコールは一般には直接起動されず、 glibc (や他の何らかのライブ ラ リ) 経 由 で 起 動される。システムコールの直接起動については、詳細は intro(2) を参照のこと。いつもという訳ではないが、普通は、ラッパー関数の 名前はその関数が起動するシステムコールの名前と同じである。例えば、glibc には truncate() という関数があり、この関数は "truncate" システムコー ル を起動する。 た いていの場合、glibc のラッパー関数はかなり簡単なもので、システムコー ルを起動する前に引き数を適切なレジスタにコピーし、システムコールが返 っ た後は errno を適切に設定する以外は、ほとんど処理を行わない (これらは、 ラッパー関数が提供されていない場合にシステムコールを起動するのに使用 す る syscall(2) により実行される処理と同じである)。 [注意] システムコール は失敗を示すのに負のエラー番号を呼び出し元に返す。失敗が起こった際に は 、 ラ ッパー関数は返されたエラー番号を反転して (正の値に変換し)、それを errno にコピーし、ラッパー関数の呼び出し元に -1 を返す。 しかしながら、時には、ラッパー関数がシステムコールを起動する前に何ら か の 追加の処理を行う場合がある。例えば、現在、二つの関連するシステムコー ル truncate(2) と truncate64(2) があり、glibc のラッパー関数 truncate() は 、カーネルがこれらのシステムコールのうちどちらを提供しているかをチェ ックし、どちらを採用するかを決定する。 システムコールのリスト 以下は、ほとんどのプラットフォームに共通するシステムコールのリストで あ る 。このリストで、 Kernel の列は、Linux 2.2 以降で登場したシステムコー ルが登場したカーネルバージョンを示す。以下に詳細な説明を記す。 * カーネルバージョンがない場合、そのシステムコールはカーネル 1.0 も し くはそれ以前に登場した。 * システムコールに "1.2" と書かれている場合、そのシステムコールがおそ らくバージョン 1.1.x のカーネルで登場し、安定版のカーネルでは 1.2 で 初 めて登場したことを意味する。 (バージョン 1.2 のカーネルは、カーネ ル 1.0.6 から分岐し、バージョン 1.1.x の不安定版のカーネル系列として 開発された。) * システムコールに "2.0" と書かれている場合、そのシステムコールがおそ らくバージョン 1.3.x のカーネルで登場し、安定版のカーネルでは 2.0 で 初 めて登場したことを意味する。 (バージョン 2.0 のカーネルは、バージ ョン 1.2.10 あたりのカーネル 1.2.x から分岐し、バージョン 1.3.x の不 安定版のカーネル系列として開発された。) * システムコールに "2.2" と書かれている場合、そのシステムコールがおそ らくバージョン 2.1.x のカーネルで登場し、安定版のカーネルでは 2.2.0 で 初めて登場したことを意味する。 (バージョン 2.2 のカーネルは、カー ネル 2.0.21 から分岐し、バージョン 2.1.x の不安定版のカーネル系列 と して開発された。) * システムコールに "2.4" と書かれている場合、そのシステムコールがおそ らくバージョン 2.3.x のカーネルで登場し、安定版のカーネルでは 2.4.0 で 初めて登場したことを意味する。 (バージョン 2.4 のカーネルは、カー ネル 2.2.8 から分岐し、バージョン 2.3.x の不安定版のカーネル系列とし て開発された。) * システムコールに "2.6" と書かれている場合、そのシステムコールがおそ らくバージョン 2.5.x のカーネルで登場し、安定版のカーネルでは 2.6.0 で 初めて登場したことを意味する。 (バージョン 2.6 のカーネルは、カー ネル 2.4.15 から分岐し、バージョン 2.5.x の不安定版のカーネル系列 と して開発された。) * カーネル 2.6.0 から開発モデルは変更され、新しいシステムコールが個々 の 2.6.x のリリースでも登場するようになった。この場合、リストでは 、 システムコールが登場した厳密なバージョン番号が記載されている。 * 前の安定版カーネル系列から分岐した後に安定版カーネル系列にシステムコ ールが追加された場合、以前の安定版カーネル系列にそのシステムコールが 移植 (backport) されることがある。例えば、2.6.x で登場したシステムコ ールのいくつかは、 2.4.15 以降の 2.4.x リリースにも backport され た 。この場合、システムコールが登場したバージョンとして、両方の安定版系 列のバージョンが記載されている。 カーネル 2.6.28 で利用可能なシステムコールのリストを以下に示す (それ 以 前のカーネルでだけ利用可能なものも少数だが含まれる): System call Kernel Notes ----------------------------------------------------------------------- _llseek(2) 1.2 _newselect(2) _sysctl(2) accept(2) accept4(2) 2.6.28 access(2) acct(2) add_key(2) 2.6.11 adjtimex(2) afs_syscall(2) Not implemented alarm(2) alloc_hugepages(2) 2.5.36 Removed in 2.5.44 bdflush(2) bind(2) break(2) Not implemented brk(2) cacheflush(2) 1.2 Not on i386 capget(2) 2.2 capset(2) 2.2 chdir(2) chmod(2) chown(2) chown32(2) 2.4 chroot(2) clock_getres(2) 2.6 clock_gettime(2) 2.6 clock_nanosleep(2) 2.6 clock_settime(2) 2.6 clone(2) close(2) connect(2) creat(2) create_module(2) delete_module(2) dup(2) dup2(2) dup3(2) 2.6.27 epoll_create(2) 2.6 epoll_create1(2) 2.6.27 epoll_ctl(2) 2.6 epoll_pwait(2) 2.6.19 epoll_wait(2) 2.6 eventfd(2) 2.6.22 eventfd2(2) 2.6.27 execve(2) exit(2) exit_group(2) 2.6 faccessat(2) 2.6.16 fadvise64(2) 2.6 fadvise64_64(2) 2.6 fallocate(2) 2.6.23 fchdir(2) fchmod(2) fchmodat(2) 2.6.16 fchown(2) fchown32(2) 2.4 fchownat(2) 2.6.16 fcntl(2) fcntl64(2) 2.4 fdatasync(2) fgetxattr(2) 2.6; 2.4.18 flistxattr(2) 2.6; 2.4.18 flock(2) 2.0 fork(2) free_hugepages(2) 2.5.36 Removed in 2.5.44 fremovexattr(2) 2.6; 2.4.18 fsetxattr(2) 2.6; 2.4.18 fstat(2) fstat64(2) 2.4 fstatat64(2) 2.6.16 fstatfs(2) fstatfs64(2) 2.6 fsync(2) ftime(2) Not implemented ftruncate(2) ftruncate64(2) 2.4 futex(2) 2.6 futimesat(2) 2.6.16 get_kernel_syms(2) get_mempolicy(2) 2.6.6 get_robust_list(2) 2.6.17 get_thread_area(2) 2.6 getcpu(2) 2.6.19 getcwd(2) 2.2 getdents(2) 2.0 getdents64(2) 2.4 getegid(2) getegid32(2) 2.4 geteuid(2) geteuid32(2) 2.4 getgid(2) getgid32(2) 2.4 getgroups(2) getgroups32(2) 2.4 getitimer(2) getpeername(2) getpagesize(2) 2.0 Not on i386 getpgid(2) getpgrp(2) getpid(2) getpmsg(2) Not implemented getppid(2) getpriority(2) getresgid(2) 2.2 getresgid32(2) 2.4 getresuid(2) 2.2 getresuid32(2) 2.4 getrlimit(2) getrusage(2) getsid(2) 2.0 getsockname(2) getsockopt(2) gettid(2) 2.4.11 gettimeofday(2) getuid(2) getuid32(2) 2.4 getxattr(2) 2.6; 2.4.18 gtty(2) Not implemented idle(2) Not implemented init_module(2) inotify_add_watch(2) 2.6.13 inotify_init(2) 2.6.13 inotify_init1(2) 2.6.27 inotify_rm_watch(2) 2.6.13 io_cancel(2) 2.6 io_destroy(2) 2.6 io_getevents(2) 2.6 io_setup(2) 2.6 io_submit(2) 2.6 ioctl(2) ioperm(2) iopl(2) ioprio_get(2) 2.6.13 ioprio_set(2) 2.6.13 ipc(2) kexec_load(2) 2.6.7 keyctl(2) 2.6.11 kill(2) lchown(2) 2.2 lchown32(2) 2.4 lgetxattr(2) 2.6; 2.4.18 link(2) linkat(2) 2.6.16 listen(2) listxattr(2) 2.6; 2.4.18 llistxattr(2) 2.6; 2.4.18 lock(2) Not implemented lookup_dcookie(2) 2.6 lremovexattr(2) 2.6; 2.4.18 lseek(2) lsetxattr(2) 2.6; 2.4.18 lstat(2) lstat64(2) 2.4 madvise(2) 2.4 madvise1(2) 2.4 mbind(2) 2.6.6 migrate_pages(2) 2.6.16 mincore(2) 2.4 mkdir(2) mkdirat(2) 2.6.16 mknod(2) mknodat(2) 2.6.16 mlock(2) mlockall(2) mmap(2) mmap2(2) 2.4 modify_ldt(2) mount(2) move_pages(2) 2.6.18 mprotect(2) mpx(2) Not implemented mq_getsetattr(2) 2.6.6 mq_notify(2) 2.6.6 mq_open(2) 2.6.6 mq_timedreceive(2) 2.6.6 mq_timedsend(2) 2.6.6 mq_unlink(2) mremap(2) 2.0 msgctl(2) msgget(2) msgrcv(2) msgsnd(2) msync(2) 2.0 munlock(2) munlockall(2) munmap(2) nanosleep(2) 2.0 nfsservctl(2) 2.2 nice(2) oldfstat(2) oldlstat(2) oldolduname(2) oldstat(2) olduname(2) open(2) openat(2) 2.6.16 pause(2) pciconfig_iobase(2) 2.2.15; 2.4 Not on i386 pciconfig_read(2) 2.0.26; 2.2 Not on i386 pciconfig_write(2) 2.0.26; 2.2 Not on i386 personality(2) 1.2 phys(2) Not implemented pipe(2) pipe2(2) 2.6.27 pivot_root(2) 2.4 poll(2) 2.2 ppoll(2) 2.6.16 prctl(2) 2.2 pread64(2) Added as "pread" in 2.2; renamed "pread64" in 2.6 prof(2) Not implemented profil(2) Not implemented pselect6(2) 2.6.16 ptrace(2) putpmsg(2) Not implemented pwrite64(2) Added as "pwrite" in 2.2; renamed "pwrite64" in 2.6 query_module(2) 2.2 quotactl(2) read(2) readahead(2) 2.4.13 readdir(2) readlink(2) readlinkat(2) 2.6.16 readv(2) 2.0 reboot(2) recv(2) recvfrom(2) recvmsg(2) remap_file_pages(2) 2.6 removexattr(2) 2.6; 2.4.18 rename(2) renameat(2) 2.6.16 request_key(2) 2.6.11 restart_syscall(2) 2.6 rmdir(2) rt_sigaction(2) 2.2 rt_sigpending(2) 2.2 rt_sigprocmask(2) 2.2 rt_sigqueueinfo(2) 2.2 rt_sigreturn(2) 2.2 rt_sigsuspend(2) 2.2 rt_sigtimedwait(2) 2.2 sched_get_priority_max(2) 2.0 sched_get_priority_min(2) 2.0 sched_getaffinity(2) 2.6 sched_getparam(2) 2.0 sched_getscheduler(2) 2.0 sched_rr_get_interval(2) 2.0 sched_setaffinity(2) 2.6 sched_setparam(2) 2.0 sched_setscheduler(2) 2.0 sched_yield(2) 2.0 security(2) Not implemented select(2) semctl(2) semget(2) semop(2) semtimedop(2) 2.6; 2.4.22 send(2) sendfile(2) 2.2 sendfile64(2) 2.6; 2.4.19 sendmsg(2) sendto(2) set_mempolicy(2) 2.6.6 set_robust_list(2) 2.6.17 set_thread_area(2) 2.6 set_tid_address(2) 2.6 set_zone_reclaim(2) 2.6.13 Removed in 2.6.16 (was never available to userspace) setdomainname(2) setfsgid(2) 1.2 setfsgid32(2) 2.4 setfsuid(2) 1.2 setfsuid32(2) 2.4 setgid(2) setgid32(2) 2.4 setgroups(2) setgroups32(2) 2.4 sethostname(2) setitimer(2) setpgid(2) setpriority(2) setregid(2) setregid32(2) 2.4 setresgid(2) 2.2 setresgid32(2) 2.4 setresuid(2) 2.2 setresuid32(2) 2.4 setreuid(2) setreuid32(2) 2.4 setrlimit(2) setsid(2) setsockopt(2) settimeofday(2) setuid(2) setuid32(2) 2.4 setup(2) Removed in 2.2 setxattr(2) 2.6; 2.4.18 sgetmask(2) shmat(2) shmctl(2) shmdt(2) shmget(2) shutdown(2) sigaction(2) sigaltstack(2) 2.2 signal(2) signalfd(2) 2.6.22 signalfd4(2) 2.6.27 sigpending(2) sigprocmask(2) sigreturn(2) sigsuspend(2) socket(2) socketcall(2) socketpair(2) splice(2) 2.6.17 spu_create(2) 2.6.16 PowerPC only spu_run(2) 2.6.16 PowerPC only ssetmask(2) stat(2) stat64(2) 2.4 statfs(2) statfs64(2) 2.6 stime(2) stty(2) Not implemented swapoff(2) swapon(2) symlink(2) symlinkat(2) 2.6.16 sync(2) sync_file_range(2) 2.6.17 sysfs(2) 1.2 sysinfo(2) syslog(2) tee(2) 2.6.17 tgkill(2) 2.6 time(2) timer_create(2) 2.6 timer_delete(2) 2.6 timer_getoverrun(2) 2.6 timer_gettime(2) 2.6 timer_settime(2) 2.6 timerfd_create(2) 2.6.25 timerfd_gettime(2) 2.6.25 timerfd_settime(2) 2.6.25 times(2) tkill(2) 2.6; 2.4.22 truncate(2) truncate64(2) 2.4 tuxcall(2) Not implemented ugetrlimit(2) 2.4 ulimit(2) Not implemented umask(2) umount(2) umount2(2) 2.2 uname(2) unlink(2) unlinkat(2) 2.6.16 unshare(2) 2.6.16 uselib(2) ustat(2) utime(2) utimensat(2) 2.6.22 utimes(2) 2.6 vfork(2) vhangup(2) vm86old(2) vmsplice(2) 2.6.17 vserver(2) Not implemented wait4(2) waitid(2) 2.6.10 waitpid(2) write(2) writev(2) 2.0 i386 を含む多くのプラットフォームでは、ソケット関連のシステムコールは (glibc のラッパー関数を介してだが) すべて socketcall(2) 経由に多重さ れ ている。同様に、System V IPC 関連のシステムコールは ipc(2) 経由に多重さ れている。 注意 以下の点に留意すること: * 以下のシステムコールは、システムコール・テーブルにスロットが予約され て い る が 、 標 準 のカーネルには実装されていない: afs_syscall(2), break(2), ftime(2), getpmsg(2), gtty(2), idle(2), lock(2), mad- vise1(2), mpx(2), phys(2), prof(2), profil(2), putpmsg(2), secu- rity(2), stty(2), tuxcall(2), ulimit(2), vserver(2) (unimple- mented(2) も参照)。しかし、 ftime(3), profil(3), ulimit(3) はライブ ラリ・ルーチンとして実装されている。 phys(2) 用の場所は 2.1.116 以降 では umount(2) 用に使用されている; 将来においても phys(2) は実装され ない。 * getpmsg(2) と putpmsg(2) は、ストリーム対応のパッチが当てられたカ ー ネル用のもので、標準のカーネルに存在することは今後もない。 たいていは、 /usr/include/asm/unistd.h で定義されている番号 __NR_xxx の システムコールのコードは、カーネル・ソースの sys_xxx() というルーチンに 書かれている (i386 における実行テーブルは /usr/src/linux/arch/i386/ker- nel/entry.S に書かれている)。しかしこれには多くの例外がある。古いシステ ム コールは新版に置き換えられてきたが、この置き換えはあまり体系立てて行 われて来なかったからである。 parisc, sparc, sparc64, alpha といったプロ プ リエタリ OS のエミュレーション機能があるプラットフォームでは、多くの 追加システムコールがある。 mips64 には、32 ビットシステムコールのフルセ ットも含まれている。 時 間の経過とともに、いくつかのシステムコールではインタフェースの変更が 必要になってきた。こうした変更の理由の一つは、システムコールに渡され る 構 造体やスカラー値のサイズを増やす必要があることだった。これらの変更の 結果、現在では、同様の処理を実行するが引き数のサイズなどの詳細は異な る 、 一 連 の システムコール群がいくつか存在する (例えば、 truncate(2) と truncate64(2))。 (すでに述べたように、一般にはアプリケーションがこの こ とを意識することはない。 glibc のラッパー関数が、適切なシステムコールを 起動し、古いバイナリに対して ABI レベルでの互換性を保持することを保証す る 処理を行っている。) 複数のバージョンが存在するシステムコールの例を以 下に挙げる。 * これまでに、 stat(2) には 3 種類の異なるバージョン が 存 在 す る 。 sys_stat() ( ス ロ ットは __NR_oldstat)、 sys_newstat() (スロットは __NR_stat)、 sys_stat64() (カーネル 2.4 で 導 入; ス ロ ッ ト は __NR_stat64) 。 3 つ の う ち 最 後のものが最新である。 lstat(2) と fstat(2) についても同様である。 * また、 __NR_oldolduname, __NR_olduname, __NR_uname という定義は、 そ れ ぞれ sys_olduname(), sys_uname(), sys_newuname() というルーチンを 参照している。 * Linux 2.0 では、 vm86(2) の新バージョンが登場した。カーネルルーチ ン の 古 い バ ー ジ ョ ン 、 新しいバージョンはそれぞれ sys_vm86old(), sys_vm86() という名前である。 * Linux 2.4 では、 getrlimit(2) の新バージョンが登場した。カーネルルー チンの古いバージョン、新しいバージョンはそれぞれ sys_old_getrlimit() (スロットは __NR_getrlimit), sys_getrlimit() (スロットは __NR_ugetr- limit) という名前である。 * Linux 2.4 で、ユーザ ID とグループ ID のサイズが 16 ビットから 32 ビ ットに増えた。この変更に対応するため、いくつかのシステムコールが追加 さ れ た (chown32(2), getuid32(2), getgroups32(2), setresuid32(2) な ど)。これらのシステムコールが、末尾の "32" が付かない同名の古いバ ー ジョンに代わって使われるようになった。 * Linux 2.4 では、32 ビット・アーキテクチャ上のアプリケーションが大き なファイル (つまり、32 ビットでは表現できないサイズやファイル・オ フ セットが必要なファイル) にアクセスできるようになった。この変更に対応 するため、ファイル・オフセットとサイズを扱うシステムコールの置き換え が 必 要 と な っ た 。 そ の結果、 fcntl64(2), ftruncate64(2), get- dents64(2), stat64(2), statfs64(2) と、ファイルディスクリプタやシ ン ボリックリンクで同じ機能を持つシステムコールが追加された。これらのシ ステムコールが、末尾の "64" が付かない同名の古いバージョンに代わって 使 われるようになった。但し、"stat" 系のシステムコールはその限りでは ない。 64-bit ファイルアクセスと 32-bit UID のみを持つ新しいプラットフォ ー ム (alpha, ia64, s390x など) では、 *64 や *32 という名前のシステム コールはない。 *64 や *32 というシステムコールが存在する場合 、 *64 や *32 がついていないシステムコールは廃止扱いである。 * リ ア ル タイムシグナル (signal(7) 参照) への対応を追加するために、 rt_sig* 系のシステムコールがカーネル 2.2 で追加された。これらのシ ス テ ムコールが、先頭に "rt_" が付かない同名の古いバージョンに代わって 使われるようになった。 * select(2) と mmap(2) は 5つもしくはそれ以上の引き数を使用しており 、 i386 では引き数の受け渡しに問題が生じる。そのため、他のアーキテクチ ャでは __NR_select と __NR_mmap に 対 応 す る sys_select() と sys_mmap() が 存 在 す る が 、i386 では代わりに old_select() と old_mmap() というルーチンがある (これらのルーチンは引き数ブロック へ の ポインタを使用する)。現在では 5つの引き数を渡すことはもはや問題で はなくなっており、 __NR__newselect は sys_select() に直接対応する よ うになっている。 __NR_mmap2 についても同様である。 関連項目 syscall(2), unimplemented(2), libc(7) Linux 2009-02-11 SYSCALLS(2)
SYSCALLS(2) Linux Programmer’s Manual SYSCALLS(2) NAME syscalls - Linux system calls SYNOPSIS Linux system calls. DESCRIPTION The system call is the fundamental interface between an application and the Linux kernel. System calls and library wrapper functions System calls are generally not invoked directly, but rather via wrapper functions in glibc (or perhaps some other library). For details of direct invocation of a system call, see intro(2). Often, but not always, the name of the wrapper function is the same as the name of the system call that it invokes. For example, glibc contains a function truncate() which invokes the underlying "truncate" system call. Often the glibc wrapper function is quite thin, doing little work other than copying arguments to the right registers before invoking the sys- tem call, and then setting errno appropriately after the system call has returned. (These are the same steps that are performed by syscall(2), which can be used to invoke system calls for which no wrap- per function is provided.) Note: system calls indicate a failure by returning a negative error number to the caller; when this happens, the wrapper function negates the returned error number (to make it posi- tive), copies it to errno, and returns -1 to the caller of the wrapper. Sometimes, however, the wrapper function does some extra work before invoking the system call. For example, nowadays there are (for reasons described below) two related system calls, truncate(2) and trun- cate64(2), and the glibc truncate() wrapper function checks which of those system calls are provided by the kernel and determines which should be employed. System call list Below is a list of those system calls that are common to most plat- forms. In the list, the Kernel column indicates the kernel version for those system calls that were new in Linux 2.2, or have appeared since that kernel version. Note the following points: * Where no kernel version is indicated, the system call appeared in kernel 1.0 or earlier. * Where a system call is marked "1.2" this means the system call prob- ably appeared in a 1.1.x kernel version, and first appeared in a stable kernel with 1.2. (Development of the 1.2 kernel was initi- ated from a branch of kernel 1.0.6 via the 1.1.x unstable kernel series.) * Where a system call is marked "2.0" this means the system call prob- ably appeared in a 1.3.x kernel version, and first appeared in a stable kernel with 2.0. (Development of the 2.0 kernel was initi- ated from a branch of kernel 1.2.x, somewhere around 1.2.10, via the 1.3.x unstable kernel series.) * Where a system call is marked "2.2" this means the system call prob- ably appeared in a 2.1.x kernel version, and first appeared in a stable kernel with 2.2.0. (Development of the 2.2 kernel was initi- ated from a branch of kernel 2.0.21 via the 2.1.x unstable kernel series.) * Where a system call is marked "2.4" this means the system call prob- ably appeared in a 2.3.x kernel version, and first appeared in a stable kernel with 2.4.0. (Development of the 2.4 kernel was initi- ated from a branch of kernel 2.2.8 via the 2.3.x unstable kernel series.) * Where a system call is marked "2.6" this means the system call prob- ably appeared in a 2.5.x kernel version, and first appeared in a stable kernel with 2.6.0. (Development of kernel 2.6 was initiated from a branch of kernel 2.4.15 via the 2.5.x unstable kernel series.) * Starting with kernel 2.6.0, the development model changed, and new system calls may appear in each 2.6.x release. In this case, the exact version number where the system call appeared is shown. * In some cases, a system call was added to a stable kernel series after it branched from the previous stable kernel series, and then backported into the earlier stable kernel series. For example some system calls that appeared in 2.6.x were also backported into a 2.4.x release after 2.4.15. When this is so, the version where the system call appeared in both of the major kernel series is listed. The list of system calls that are available as at kernel 2.6.28 (or in a few cases only on older kernels) is as follows: System call Kernel Notes ----------------------------------------------------------------------- _llseek(2) 1.2 _newselect(2) _sysctl(2) accept(2) accept4(2) 2.6.28 access(2) acct(2) add_key(2) 2.6.11 adjtimex(2) afs_syscall(2) Not implemented alarm(2) alloc_hugepages(2) 2.5.36 Removed in 2.5.44 bdflush(2) Deprecated (does nothing) since 2.6 bind(2) break(2) Not implemented brk(2) cacheflush(2) 1.2 Not on i386 capget(2) 2.2 capset(2) 2.2 chdir(2) chmod(2) chown(2) chown32(2) 2.4 chroot(2) clock_getres(2) 2.6 clock_gettime(2) 2.6 clock_nanosleep(2) 2.6 clock_settime(2) 2.6 clone(2) close(2) connect(2) creat(2) create_module(2) delete_module(2) dup(2) dup2(2) dup3(2) 2.6.27 epoll_create(2) 2.6 epoll_create1(2) 2.6.27 epoll_ctl(2) 2.6 epoll_pwait(2) 2.6.19 epoll_wait(2) 2.6 eventfd(2) 2.6.22 eventfd2(2) 2.6.27 execve(2) exit(2) exit_group(2) 2.6 faccessat(2) 2.6.16 fadvise64(2) 2.6 fadvise64_64(2) 2.6 fallocate(2) 2.6.23 fchdir(2) fchmod(2) fchmodat(2) 2.6.16 fchown(2) fchown32(2) 2.4 fchownat(2) 2.6.16 fcntl(2) fcntl64(2) 2.4 fdatasync(2) fgetxattr(2) 2.6; 2.4.18 flistxattr(2) 2.6; 2.4.18 flock(2) 2.0 fork(2) free_hugepages(2) 2.5.36 Removed in 2.5.44 fremovexattr(2) 2.6; 2.4.18 fsetxattr(2) 2.6; 2.4.18 fstat(2) fstat64(2) 2.4 fstatat64(2) 2.6.16 fstatfs(2) fstatfs64(2) 2.6 fsync(2) ftime(2) Not implemented ftruncate(2) ftruncate64(2) 2.4 futex(2) 2.6 futimesat(2) 2.6.16 get_kernel_syms(2) get_mempolicy(2) 2.6.6 get_robust_list(2) 2.6.17 get_thread_area(2) 2.6 getcpu(2) 2.6.19 getcwd(2) 2.2 getdents(2) 2.0 getdents64(2) 2.4 getegid(2) getegid32(2) 2.4 geteuid(2) geteuid32(2) 2.4 getgid(2) getgid32(2) 2.4 getgroups(2) getgroups32(2) 2.4 getitimer(2) getpeername(2) getpagesize(2) 2.0 Not on i386 getpgid(2) getpgrp(2) getpid(2) getpmsg(2) Not implemented getppid(2) getpriority(2) getresgid(2) 2.2 getresgid32(2) 2.4 getresuid(2) 2.2 getresuid32(2) 2.4 getrlimit(2) getrusage(2) getsid(2) 2.0 getsockname(2) getsockopt(2) gettid(2) 2.4.11 gettimeofday(2) getuid(2) getuid32(2) 2.4 getxattr(2) 2.6; 2.4.18 gtty(2) Not implemented idle(2) Not implemented init_module(2) inotify_add_watch(2) 2.6.13 inotify_init(2) 2.6.13 inotify_init1(2) 2.6.27 inotify_rm_watch(2) 2.6.13 io_cancel(2) 2.6 io_destroy(2) 2.6 io_getevents(2) 2.6 io_setup(2) 2.6 io_submit(2) 2.6 ioctl(2) ioperm(2) iopl(2) ioprio_get(2) 2.6.13 ioprio_set(2) 2.6.13 ipc(2) kexec_load(2) 2.6.7 keyctl(2) 2.6.11 kill(2) lchown(2) 2.2 lchown32(2) 2.4 lgetxattr(2) 2.6; 2.4.18 link(2) linkat(2) 2.6.16 listen(2) listxattr(2) 2.6; 2.4.18 llistxattr(2) 2.6; 2.4.18 lock(2) Not implemented lookup_dcookie(2) 2.6 lremovexattr(2) 2.6; 2.4.18 lseek(2) lsetxattr(2) 2.6; 2.4.18 lstat(2) lstat64(2) 2.4 madvise(2) 2.4 madvise1(2) 2.4 mbind(2) 2.6.6 migrate_pages(2) 2.6.16 mincore(2) 2.4 mkdir(2) mkdirat(2) 2.6.16 mknod(2) mknodat(2) 2.6.16 mlock(2) mlockall(2) mmap(2) mmap2(2) 2.4 modify_ldt(2) mount(2) move_pages(2) 2.6.18 mprotect(2) mpx(2) Not implemented mq_getsetattr(2) 2.6.6 mq_notify(2) 2.6.6 mq_open(2) 2.6.6 mq_timedreceive(2) 2.6.6 mq_timedsend(2) 2.6.6 mq_unlink(2) mremap(2) 2.0 msgctl(2) msgget(2) msgrcv(2) msgsnd(2) msync(2) 2.0 munlock(2) munlockall(2) munmap(2) nanosleep(2) 2.0 nfsservctl(2) 2.2 nice(2) oldfstat(2) oldlstat(2) oldolduname(2) oldstat(2) olduname(2) open(2) openat(2) 2.6.16 pause(2) pciconfig_iobase(2) 2.2.15; 2.4 Not on i386 pciconfig_read(2) 2.0.26; 2.2 Not on i386 pciconfig_write(2) 2.0.26; 2.2 Not on i386 personality(2) 1.2 phys(2) Not implemented pipe(2) pipe2(2) 2.6.27 pivot_root(2) 2.4 poll(2) 2.2 ppoll(2) 2.6.16 prctl(2) 2.2 pread64(2) Added as "pread" in 2.2; renamed "pread64" in 2.6 preadv(2) 2.6.30 prof(2) Not implemented profil(2) Not implemented pselect6(2) 2.6.16 ptrace(2) putpmsg(2) Not implemented pwrite64(2) Added as "pwrite" in 2.2; renamed "pwrite64" in 2.6 pwritev(2) 2.6.30 query_module(2) 2.2 quotactl(2) read(2) readahead(2) 2.4.13 readdir(2) readlink(2) readlinkat(2) 2.6.16 readv(2) 2.0 reboot(2) recv(2) recvfrom(2) recvmsg(2) remap_file_pages(2) 2.6 removexattr(2) 2.6; 2.4.18 rename(2) renameat(2) 2.6.16 request_key(2) 2.6.11 restart_syscall(2) 2.6 rmdir(2) rt_sigaction(2) 2.2 rt_sigpending(2) 2.2 rt_sigprocmask(2) 2.2 rt_sigqueueinfo(2) 2.2 rt_sigreturn(2) 2.2 rt_sigsuspend(2) 2.2 rt_sigtimedwait(2) 2.2 sched_get_priority_max(2) 2.0 sched_get_priority_min(2) 2.0 sched_getaffinity(2) 2.6 sched_getparam(2) 2.0 sched_getscheduler(2) 2.0 sched_rr_get_interval(2) 2.0 sched_setaffinity(2) 2.6 sched_setparam(2) 2.0 sched_setscheduler(2) 2.0 sched_yield(2) 2.0 security(2) Not implemented select(2) semctl(2) semget(2) semop(2) semtimedop(2) 2.6; 2.4.22 send(2) sendfile(2) 2.2 sendfile64(2) 2.6; 2.4.19 sendmsg(2) sendto(2) set_mempolicy(2) 2.6.6 set_robust_list(2) 2.6.17 set_thread_area(2) 2.6 set_tid_address(2) 2.6 set_zone_reclaim(2) 2.6.13 Removed in 2.6.16 (was never available to userspace) setdomainname(2) setfsgid(2) 1.2 setfsgid32(2) 2.4 setfsuid(2) 1.2 setfsuid32(2) 2.4 setgid(2) setgid32(2) 2.4 setgroups(2) setgroups32(2) 2.4 sethostname(2) setitimer(2) setpgid(2) setpriority(2) setregid(2) setregid32(2) 2.4 setresgid(2) 2.2 setresgid32(2) 2.4 setresuid(2) 2.2 setresuid32(2) 2.4 setreuid(2) setreuid32(2) 2.4 setrlimit(2) setsid(2) setsockopt(2) settimeofday(2) setuid(2) setuid32(2) 2.4 setup(2) Removed in 2.2 setxattr(2) 2.6; 2.4.18 sgetmask(2) shmat(2) shmctl(2) shmdt(2) shmget(2) shutdown(2) sigaction(2) sigaltstack(2) 2.2 signal(2) signalfd(2) 2.6.22 signalfd4(2) 2.6.27 sigpending(2) sigprocmask(2) sigreturn(2) sigsuspend(2) socket(2) socketcall(2) socketpair(2) splice(2) 2.6.17 spu_create(2) 2.6.16 PowerPC only spu_run(2) 2.6.16 PowerPC only ssetmask(2) stat(2) stat64(2) 2.4 statfs(2) statfs64(2) 2.6 stime(2) stty(2) Not implemented swapoff(2) swapon(2) symlink(2) symlinkat(2) 2.6.16 sync(2) sync_file_range(2) 2.6.17 sysfs(2) 1.2 sysinfo(2) syslog(2) tee(2) 2.6.17 tgkill(2) 2.6 time(2) timer_create(2) 2.6 timer_delete(2) 2.6 timer_getoverrun(2) 2.6 timer_gettime(2) 2.6 timer_settime(2) 2.6 timerfd_create(2) 2.6.25 timerfd_gettime(2) 2.6.25 timerfd_settime(2) 2.6.25 times(2) tkill(2) 2.6; 2.4.22 truncate(2) truncate64(2) 2.4 tuxcall(2) Not implemented ugetrlimit(2) 2.4 ulimit(2) Not implemented umask(2) umount(2) umount2(2) 2.2 uname(2) unlink(2) unlinkat(2) 2.6.16 unshare(2) 2.6.16 uselib(2) ustat(2) utime(2) utimensat(2) 2.6.22 utimes(2) 2.6 vfork(2) vhangup(2) vm86old(2) vmsplice(2) 2.6.17 vserver(2) Not implemented wait4(2) waitid(2) 2.6.10 waitpid(2) write(2) writev(2) 2.0 On many platforms, including i386, socket calls are all multiplexed (via glibc wrapper functions) through socketcall(2) and similarly Sys- tem V IPC calls are multiplexed through ipc(2). NOTES Note the following points: * Although slots are reserved for them in the system call table, the following system calls are not implemented in the standard kernel: afs_syscall(2), break(2), ftime(2), getpmsg(2), gtty(2), idle(2), lock(2), madvise1(2), mpx(2), phys(2), prof(2), profil(2), putpmsg(2), security(2), stty(2), tuxcall(2), ulimit(2), and vserver(2) (see also unimplemented(2)). However, ftime(3), pro- fil(3) and ulimit(3) exist as library routines. The slot for phys(2) is in use since kernel 2.1.116 for umount(2); phys(2) will never be implemented. * The getpmsg(2) and putpmsg(2) calls are for kernels patched to sup- port STREAMS, and may never be in the standard kernel. Roughly speaking, the code belonging to the system call with number __NR_xxx defined in /usr/include/asm/unistd.h can be found in the ker- nel source in the routine sys_xxx(). (The dispatch table for i386 can be found in /usr/src/linux/arch/i386/kernel/entry.S.) There are many exceptions, however, mostly because older system calls were superseded by newer ones, and this has been treated somewhat unsystematically. On platforms with proprietary OS emulation, such as parisc, sparc, sparc64 and alpha, there are many additional system calls; mips64 also contains a full set of 32-bit system calls. Over time, changes to the interfaces of some system calls have been necessary. One reason for such changes was the need to increase the size of structures or scalar values passed to the system call. Because of these changes, there are now various groups of related system calls (e.g., truncate(2) and truncate64(2)) which perform similar tasks, but which vary in details such as the size of their arguments. (As noted earlier, applications are generally unaware of this: the glibc wrapper functions do some work to ensure that the right system call is invoked, and that ABI compatibility is preserved for old binaries.) Examples of systems calls that exist in multiple versions are the following: * By now there are three different versions of stat(2): sys_stat() (slot __NR_oldstat), sys_newstat() (slot __NR_stat), and sys_stat64() (slot __NR_stat64), with the last being the most cur- rent. A similar story applies for lstat(2) and fstat(2). * Similarly, the defines __NR_oldolduname, __NR_olduname, and __NR_uname refer to the routines sys_olduname(), sys_uname() and sys_newuname(). * In Linux 2.0, a new version of vm86(2) appeared, with the old and the new kernel routines being named sys_vm86old() and sys_vm86(). * In Linux 2.4, a new version of getrlimit(2) appeared, with the old and the new kernel routines being named sys_old_getrlimit() (slot __NR_getrlimit) and sys_getrlimit() (slot __NR_ugetrlimit). * Linux 2.4 increased the size of user and group IDs from 16 to 32 bits. To support this change, a range of system calls were added (e.g., chown32(2), getuid32(2), getgroups32(2), setresuid32(2)), superseding earlier calls of the same name without the "32" suffix. * Linux 2.4 added support for applications on 32-bit architectures to access large files (i.e., files for which the sizes and file offsets can’t be represented in 32 bits.) To support this change, replace- ments were required for system calls that deal with file offsets and sizes. Thus the following system calls were added: fcntl64(2), ftruncate64(2), getdents64(2), stat64(2), statfs64(2), and their analogs that work with file descriptors or symbolic links. These system calls supersede the older system calls which, except in the case of the "stat" calls, have the same name without the "64" suf- fix. On newer platforms that only have 64-bit file access and 32-bit uids (e.g., alpha, ia64, s390x) there are no *64 or *32 calls. Where the *64 and *32 calls exist, the other versions are obsolete. * The rt_sig* calls were added in kernel 2.2 to support the addition of real-time signals (see signal(7)). These system calls supersede the older system calls of the same name without the "rt_" prefix. * The select(2) and mmap(2) system calls use five or more arguments, which caused problems the way argument passing on the i386 used to be set up. Thus, while other architectures have sys_select() and sys_mmap() corresponding to __NR_select and __NR_mmap, on i386 one finds old_select() and old_mmap() (routines that use a pointer to a argument block) instead. These days passing five arguments is not a problem any more, and there is a __NR__newselect that corresponds directly to sys_select() and similarly __NR_mmap2. SEE ALSO syscall(2), unimplemented(2), libc(7) COLOPHON This page is part of release 3.22 of the Linux man-pages project. A description of the project, and information about reporting bugs, can be found at http://www.kernel.org/doc/man-pages/. Linux 2009-05-06 SYSCALLS(2)
Copyright(C) linux-cmd.com All Rights Reserved. Author Takayuki Yukawa