Movatterモバイル変換


[0]ホーム

URL:


man7.org > Linux >man-pages

Linux/UNIX system programming training


syscalls(2) — Linux manual page

NAME |SYNOPSIS |DESCRIPTION |NOTES |SEE ALSO |COLOPHON

syscalls(2)                System Calls Manualsyscalls(2)

NAME        top

       syscalls - Linux system calls

SYNOPSIS        top

       Linux system calls.

DESCRIPTION        top

       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, seeintro(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 functionchdir() which invokes the underlying       "chdir" system call.       Often the glibc wrapper function is quite thin, doing little work       other than copying arguments to the right registers before       invoking the system call, and then settingerrno appropriately       after the system call has returned.  (These are the same steps       that are performed bysyscall(2), which can be used to invoke       system calls for which no wrapper function is provided.)  Note:       system calls indicate a failure by returning a negative error       number to the caller on architectures without a separate error       register/flag, as noted insyscall(2); when this happens, the       wrapper function negates the returned error number (to make it       positive), copies it toerrno, 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) andtruncate64(2), and the glibctruncate() 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 the Linux system calls.  In the list, theKernel 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 Linux 1.0 or earlier.       •  Where a system call is marked "1.2" this means the system call          probably appeared in a Linux 1.1.x kernel version, and first          appeared in a stable kernel with 1.2.  (Development of the          Linux 1.2 kernel was initiated from a branch of Linux 1.0.6 via          the Linux 1.1.x unstable kernel series.)       •  Where a system call is marked "2.0" this means the system call          probably appeared in a Linux 1.3.x kernel version, and first          appeared in a stable kernel with Linux 2.0.  (Development of          the Linux 2.0 kernel was initiated from a branch of Linux          1.2.x, somewhere around Linux 1.2.10, via the Linux 1.3.x          unstable kernel series.)       •  Where a system call is marked "2.2" this means the system call          probably appeared in a Linux 2.1.x kernel version, and first          appeared in a stable kernel with Linux 2.2.0.  (Development of          the Linux 2.2 kernel was initiated from a branch of Linux          2.0.21 via the Linux 2.1.x unstable kernel series.)       •  Where a system call is marked "2.4" this means the system call          probably appeared in a Linux 2.3.x kernel version, and first          appeared in a stable kernel with Linux 2.4.0.  (Development of          the Linux 2.4 kernel was initiated from a branch of Linux 2.2.8          via the Linux 2.3.x unstable kernel series.)       •  Where a system call is marked "2.6" this means the system call          probably appeared in a Linux 2.5.x kernel version, and first          appeared in a stable kernel with Linux 2.6.0.  (Development of          Linux 2.6 was initiated from a branch of Linux 2.4.15 via the          Linux 2.5.x unstable kernel series.)       •  Starting with Linux 2.6.0, the development model changed, and          new system calls may appear in each Linux 2.6.x release.  In          this case, the exact version number where the system call          appeared is shown.  This convention continues with the Linux          3.x kernel series, which followed on from Linux 2.6.39; and the          Linux 4.x kernel series, which followed on from Linux 3.19; and          the Linux 5.x kernel series, which followed on from Linux 4.20;          and the Linux 6.x kernel series, which followed on from Linux          5.19.       •  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 Linux          2.6.x were also backported into a Linux 2.4.x release after          Linux 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 Linux 5.14 (or       in a few cases only on older kernels) is as follows:System call                 Kernel        Notes       ──────────────────────────────────────────────────────────────────────_llseek(2)                  1.2_newselect(2)               2.0_sysctl(2)                  2.0           Removed in 5.5accept(2)                   2.0           See notes onsocketcall(2)accept4(2)                  2.6.28access(2)                   1.0acct(2)                     1.0add_key(2)                  2.6.10adjtimex(2)                 1.0alarm(2)                    1.0alloc_hugepages(2)          2.5.36        Removed in 2.5.44arc_gettls(2)               3.9           ARC onlyarc_settls(2)               3.9           ARC onlyarc_usr_cmpxchg(2)          4.9           ARC onlyarch_prctl(2)               2.6           x86_64, x86 since 4.12atomic_barrier(2)           2.6.34        m68k onlyatomic_cmpxchg_32(2)        2.6.34        m68k onlybdflush(2)                  1.2           Deprecated (does nothing)                                                 since 2.6, removed in 5.15bind(2)                     2.0           See notes onsocketcall(2)bpf(2)                      3.18brk(2)                      1.0breakpoint(2)               2.2           ARM OABI only, defined with__ARM_NRprefixcacheflush(2)               1.2           Not on x86capget(2)                   2.2capset(2)                   2.2chdir(2)                    1.0chmod(2)                    1.0chown(2)                    2.2           Seechown(2) for version                                                 detailschown32(2)                  2.4chroot(2)                   1.0clock_adjtime(2)            2.6.39clock_getres(2)             2.6clock_gettime(2)            2.6clock_nanosleep(2)          2.6clock_settime(2)            2.6clone2(2)                   2.4           IA-64 onlyclone(2)                    1.0clone3(2)                   5.3close(2)                    1.0close_range(2)              5.9connect(2)                  2.0           See notes onsocketcall(2)copy_file_range(2)          4.5creat(2)                    1.0create_module(2)            1.0           Removed in 2.6delete_module(2)            1.0dup(2)                      1.0dup2(2)                     1.0dup3(2)                     2.6.27epoll_create(2)             2.6epoll_create1(2)            2.6.27epoll_ctl(2)                2.6epoll_pwait(2)              2.6.19epoll_pwait2(2)             5.11epoll_wait(2)               2.6eventfd(2)                  2.6.22eventfd2(2)                 2.6.27execv(2)                    2.0           SPARC/SPARC64 only, for                                                 compatibility with SunOSexecve(2)                   1.0execveat(2)                 3.19exit(2)                     1.0exit_group(2)               2.6faccessat(2)                2.6.16faccessat2(2)               5.8fadvise64(2)                2.6fadvise64_64(2)             2.6fallocate(2)                2.6.23fanotify_init(2)            2.6.37fanotify_mark(2)            2.6.37fchdir(2)                   1.0fchmod(2)                   1.0fchmodat(2)                 2.6.16fchown(2)                   1.0fchown32(2)                 2.4fchownat(2)                 2.6.16fcntl(2)                    1.0fcntl64(2)                  2.4fdatasync(2)                2.0fgetxattr(2)                2.6; 2.4.18finit_module(2)             3.8flistxattr(2)               2.6; 2.4.18flock(2)                    2.0fork(2)                     1.0free_hugepages(2)           2.5.36        Removed in 2.5.44fremovexattr(2)             2.6; 2.4.18fsconfig(2)                 5.2fsetxattr(2)                2.6; 2.4.18fsmount(2)                  5.2fsopen(2)                   5.2fspick(2)                   5.2fstat(2)                    1.0fstat64(2)                  2.4fstatat64(2)                2.6.16fstatfs(2)                  1.0fstatfs64(2)                2.6fsync(2)                    1.0ftruncate(2)                1.0ftruncate64(2)              2.4futex(2)                    2.6futimesat(2)                2.6.16get_kernel_syms(2)          1.0           Removed in 2.6get_mempolicy(2)            2.6.6get_robust_list(2)          2.6.17get_thread_area(2)          2.6get_tls(2)                  4.15          ARM OABI only, has__ARM_NR                                                 prefixgetcpu(2)                   2.6.19getcwd(2)                   2.2getdents(2)                 2.0getdents64(2)               2.4getdomainname(2)            2.2           SPARC, SPARC64; available                                                 asosf_getdomainname(2) on                                                 Alpha since Linux 2.0getdtablesize(2)            2.0           SPARC (removed in 2.6.26),                                                 available on Alpha asosf_getdtablesize(2)getegid(2)                  1.0getegid32(2)                2.4geteuid(2)                  1.0geteuid32(2)                2.4getgid(2)                   1.0getgid32(2)                 2.4getgroups(2)                1.0getgroups32(2)              2.4gethostname(2)              2.0           Alpha, was available on                                                 SPARC up to Linux 2.6.26getitimer(2)                1.0getpeername(2)              2.0           See notes onsocketcall(2)getpagesize(2)              2.0           Alpha, SPARC/SPARC64 onlygetpgid(2)                  1.0getpgrp(2)                  1.0getpid(2)                   1.0getppid(2)                  1.0getpriority(2)              1.0getrandom(2)                3.17getresgid(2)                2.2getresgid32(2)              2.4getresuid(2)                2.2getresuid32(2)              2.4getrlimit(2)                1.0getrusage(2)                1.0getsid(2)                   2.0getsockname(2)              2.0           See notes onsocketcall(2)getsockopt(2)               2.0           See notes onsocketcall(2)gettid(2)                   2.4.11gettimeofday(2)             1.0getuid(2)                   1.0getuid32(2)                 2.4getunwind(2)                2.4.8         IA-64 only; deprecatedgetxattr(2)                 2.6; 2.4.18getxgid(2)                  2.0           Alpha only; see NOTESgetxpid(2)                  2.0           Alpha only; see NOTESgetxuid(2)                  2.0           Alpha only; see NOTESinit_module(2)              1.0inotify_add_watch(2)        2.6.13inotify_init(2)             2.6.13inotify_init1(2)            2.6.27inotify_rm_watch(2)         2.6.13io_cancel(2)                2.6io_destroy(2)               2.6io_getevents(2)             2.6io_pgetevents(2)            4.18io_setup(2)                 2.6io_submit(2)                2.6io_uring_enter(2)           5.1io_uring_register(2)        5.1io_uring_setup(2)           5.1ioctl(2)                    1.0ioperm(2)                   1.0iopl(2)                     1.0ioprio_get(2)               2.6.13ioprio_set(2)               2.6.13ipc(2)                      1.0kcmp(2)                     3.5kern_features(2)            3.7           SPARC64 onlykexec_file_load(2)          3.17kexec_load(2)               2.6.13keyctl(2)                   2.6.10kill(2)                     1.0landlock_add_rule(2)        5.13landlock_create_ruleset(2)  5.13landlock_restrict_self(2)   5.13lchown(2)                   1.0           Seechown(2) for version                                                 detailslchown32(2)                 2.4lgetxattr(2)                2.6; 2.4.18link(2)                     1.0linkat(2)                   2.6.16listen(2)                   2.0           See notes onsocketcall(2)listxattr(2)                2.6; 2.4.18llistxattr(2)               2.6; 2.4.18lookup_dcookie(2)           2.6lremovexattr(2)             2.6; 2.4.18lseek(2)                    1.0lsetxattr(2)                2.6; 2.4.18lstat(2)                    1.0lstat64(2)                  2.4madvise(2)                  2.4mbind(2)                    2.6.6memory_ordering(2)          2.2           SPARC64 onlymembarrier(2)               3.17memfd_create(2)             3.17memfd_secret(2)             5.14migrate_pages(2)            2.6.16mincore(2)                  2.4mkdir(2)                    1.0mkdirat(2)                  2.6.16mknod(2)                    1.0mknodat(2)                  2.6.16mlock(2)                    2.0mlock2(2)                   4.4mlockall(2)                 2.0mmap(2)                     1.0mmap2(2)                    2.4modify_ldt(2)               1.0mount(2)                    1.0move_mount(2)               5.2move_pages(2)               2.6.18mprotect(2)                 1.0mq_getsetattr(2)            2.6.6mq_notify(2)                2.6.6mq_open(2)                  2.6.6mq_timedreceive(2)          2.6.6mq_timedsend(2)             2.6.6mq_unlink(2)                2.6.6mremap(2)                   2.0msgctl(2)                   2.0           See notes onipc(2)msgget(2)                   2.0           See notes onipc(2)msgrcv(2)                   2.0           See notes onipc(2)msgsnd(2)                   2.0           See notes onipc(2)msync(2)                    2.0munlock(2)                  2.0munlockall(2)               2.0munmap(2)                   1.0name_to_handle_at(2)        2.6.39nanosleep(2)                2.0newfstatat(2)               2.6.16        Seestat(2)nfsservctl(2)               2.2           Removed in 3.1nice(2)                     1.0old_adjtimex(2)             2.0           Alpha only; see NOTESold_getrlimit(2)            2.4           Old variant ofgetrlimit(2)                                                 that used a different value                                                 forRLIM_INFINITYoldfstat(2)                 1.0oldlstat(2)                 1.0oldolduname(2)              1.0oldstat(2)                  1.0oldumount(2)                2.4.116       Name of the oldumount(2)                                                 syscall on Alphaolduname(2)                 1.0open(2)                     1.0open_by_handle_at(2)        2.6.39open_tree(2)                5.2openat(2)                   2.6.16openat2(2)                  5.6or1k_atomic(2)              3.1           OpenRISC 1000 onlypause(2)                    1.0pciconfig_iobase(2)         2.2.15; 2.4   Not on x86pciconfig_read(2)           2.0.26; 2.2   Not on x86pciconfig_write(2)          2.0.26; 2.2   Not on x86perf_event_open(2)          2.6.31        Was perf_counter_open() in                                                 2.6.31; renamed in 2.6.32personality(2)              1.2perfctr(2)                  2.2           SPARC only; removed in                                                 2.6.34perfmonctl(2)               2.4           IA-64 only; removed in 5.10pidfd_getfd(2)              5.6pidfd_send_signal(2)        5.1pidfd_open(2)               5.3pipe(2)                     1.0pipe2(2)                    2.6.27pivot_root(2)               2.4pkey_alloc(2)               4.8pkey_free(2)                4.8pkey_mprotect(2)            4.8poll(2)                     2.0.36; 2.2ppoll(2)                    2.6.16prctl(2)                    2.2pread64(2)                                Added as "pread" in 2.2;                                                 renamed "pread64" in 2.6preadv(2)                   2.6.30preadv2(2)                  4.6prlimit64(2)                2.6.36process_madvise(2)          5.10process_vm_readv(2)         3.2process_vm_writev(2)        3.2pselect6(2)                 2.6.16ptrace(2)                   1.0pwrite64(2)                               Added as "pwrite" in 2.2;                                                 renamed "pwrite64" in 2.6pwritev(2)                  2.6.30pwritev2(2)                 4.6query_module(2)             2.2           Removed in 2.6quotactl(2)                 1.0quotactl_fd(2)              5.14read(2)                     1.0readahead(2)                2.4.13readdir(2)                  1.0readlink(2)                 1.0readlinkat(2)               2.6.16readv(2)                    2.0reboot(2)                   1.0recv(2)                     2.0           See notes onsocketcall(2)recvfrom(2)                 2.0           See notes onsocketcall(2)recvmsg(2)                  2.0           See notes onsocketcall(2)recvmmsg(2)                 2.6.33remap_file_pages(2)         2.6           Deprecated since 3.16removexattr(2)              2.6; 2.4.18rename(2)                   1.0renameat(2)                 2.6.16renameat2(2)                3.15request_key(2)              2.6.10restart_syscall(2)          2.6riscv_flush_icache(2)       4.15          RISC-V onlyrmdir(2)                    1.0rseq(2)                     4.18rt_sigaction(2)             2.2rt_sigpending(2)            2.2rt_sigprocmask(2)           2.2rt_sigqueueinfo(2)          2.2rt_sigreturn(2)             2.2rt_sigsuspend(2)            2.2rt_sigtimedwait(2)          2.2rt_tgsigqueueinfo(2)        2.6.31rtas(2)                     2.6.2         PowerPC/PowerPC64 onlys390_runtime_instr(2)       3.7           s390 onlys390_pci_mmio_read(2)       3.19          s390 onlys390_pci_mmio_write(2)      3.19          s390 onlys390_sthyi(2)               4.15          s390 onlys390_guarded_storage(2)     4.12          s390 onlysched_get_affinity(2)       2.6           Name ofsched_getaffinity(2) on                                                 SPARC and SPARC64sched_get_priority_max(2)   2.0sched_get_priority_min(2)   2.0sched_getaffinity(2)        2.6sched_getattr(2)            3.14sched_getparam(2)           2.0sched_getscheduler(2)       2.0sched_rr_get_interval(2)    2.0sched_set_affinity(2)       2.6           Name ofsched_setaffinity(2) on                                                 SPARC and SPARC64sched_setaffinity(2)        2.6sched_setattr(2)            3.14sched_setparam(2)           2.0sched_setscheduler(2)       2.0sched_yield(2)              2.0seccomp(2)                  3.17select(2)                   1.0semctl(2)                   2.0           See notes onipc(2)semget(2)                   2.0           See notes onipc(2)semop(2)                    2.0           See notes onipc(2)semtimedop(2)               2.6; 2.4.22send(2)                     2.0           See notes onsocketcall(2)sendfile(2)                 2.2sendfile64(2)               2.6; 2.4.19sendmmsg(2)                 3.0sendmsg(2)                  2.0           See notes onsocketcall(2)sendto(2)                   2.0           See notes onsocketcall(2)set_mempolicy(2)            2.6.6set_robust_list(2)          2.6.17set_thread_area(2)          2.6set_tid_address(2)          2.6set_tls(2)                  2.6.11        ARM OABI/EABI only                                                 (constant has__ARM_NR                                                 prefix)setdomainname(2)            1.0setfsgid(2)                 1.2setfsgid32(2)               2.4setfsuid(2)                 1.2setfsuid32(2)               2.4setgid(2)                   1.0setgid32(2)                 2.4setgroups(2)                1.0setgroups32(2)              2.4sethae(2)                   2.0           Alpha only; see NOTESsethostname(2)              1.0setitimer(2)                1.0setns(2)                    3.0setpgid(2)                  1.0setpgrp(2)                  2.0           Alternative name forsetpgid(2) on Alphasetpriority(2)              1.0setregid(2)                 1.0setregid32(2)               2.4setresgid(2)                2.2setresgid32(2)              2.4setresuid(2)                2.2setresuid32(2)              2.4setreuid(2)                 1.0setreuid32(2)               2.4setrlimit(2)                1.0setsid(2)                   1.0setsockopt(2)               2.0           See notes onsocketcall(2)settimeofday(2)             1.0setuid(2)                   1.0setuid32(2)                 2.4setup(2)                    1.0           Removed in 2.2setxattr(2)                 2.6; 2.4.18sgetmask(2)                 1.0shmat(2)                    2.0           See notes onipc(2)shmctl(2)                   2.0           See notes onipc(2)shmdt(2)                    2.0           See notes onipc(2)shmget(2)                   2.0           See notes onipc(2)shutdown(2)                 2.0           See notes onsocketcall(2)sigaction(2)                1.0sigaltstack(2)              2.2signal(2)                   1.0signalfd(2)                 2.6.22signalfd4(2)                2.6.27sigpending(2)               1.0sigprocmask(2)              1.0sigreturn(2)                1.0sigsuspend(2)               1.0socket(2)                   2.0           See notes onsocketcall(2)socketcall(2)               1.0socketpair(2)               2.0           See notes onsocketcall(2)spill(2)                    2.6.13        Xtensa onlysplice(2)                   2.6.17spu_create(2)               2.6.16        PowerPC/PowerPC64 onlyspu_run(2)                  2.6.16        PowerPC/PowerPC64 onlyssetmask(2)                 1.0stat(2)                     1.0stat64(2)                   2.4statfs(2)                   1.0statfs64(2)                 2.6statx(2)                    4.11stime(2)                    1.0subpage_prot(2)             2.6.25        PowerPC/PowerPC64 onlyswapcontext(2)              2.6.3         PowerPC/PowerPC64 onlyswitch_endian(2)            4.1           PowerPC64 onlyswapoff(2)                  1.0swapon(2)                   1.0symlink(2)                  1.0symlinkat(2)                2.6.16sync(2)                     1.0sync_file_range(2)          2.6.17sync_file_range2(2)         2.6.22syncfs(2)                   2.6.39sys_debug_setcontext(2)     2.6.11        PowerPC onlysyscall(2)                  1.0           Still available on ARM OABI                                                 and MIPS O32 ABIsysfs(2)                    1.2sysinfo(2)                  1.0syslog(2)                   1.0sysmips(2)                  2.6.0         MIPS onlytee(2)                      2.6.17tgkill(2)                   2.6time(2)                     1.0timer_create(2)             2.6timer_delete(2)             2.6timer_getoverrun(2)         2.6timer_gettime(2)            2.6timer_settime(2)            2.6timerfd_create(2)           2.6.25timerfd_gettime(2)          2.6.25timerfd_settime(2)          2.6.25times(2)                    1.0tkill(2)                    2.6; 2.4.22truncate(2)                 1.0truncate64(2)               2.4ugetrlimit(2)               2.4umask(2)                    1.0umount(2)                   1.0umount2(2)                  2.2uname(2)                    1.0unlink(2)                   1.0unlinkat(2)                 2.6.16unshare(2)                  2.6.16uselib(2)                   1.0ustat(2)                    1.0userfaultfd(2)              4.3usr26(2)                    2.4.8.1       ARM OABI onlyusr32(2)                    2.4.8.1       ARM OABI onlyutime(2)                    1.0utimensat(2)                2.6.22utimes(2)                   2.2utrap_install(2)            2.2           SPARC64 onlyvfork(2)                    2.2vhangup(2)                  1.0vm86old(2)                  1.0           Was "vm86"; renamed in                                                 2.0.28/2.2vm86(2)                     2.0.28; 2.2vmsplice(2)                 2.6.17wait4(2)                    1.0waitid(2)                   2.6.10waitpid(2)                  1.0write(2)                    1.0writev(2)                   2.0xtensa(2)                   2.6.13        Xtensa only       On many platforms, including x86-32, socket calls are all       multiplexed (via glibc wrapper functions) throughsocketcall(2)       and similarly System V IPC calls are multiplexed throughipc(2).       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), andvserver(2) (see alsounimplemented(2)).  However,ftime(3),profil(3), andulimit(3) exist as library routines.  The slot forphys(2) is in use since Linux 2.1.116 forumount(2);phys(2) will       never be implemented.  Thegetpmsg(2) andputpmsg(2) calls are for       kernels patched to support STREAMS, and may never be in the       standard kernel.       There was brieflyset_zone_reclaim(2), added in Linux 2.6.13, and       removed in Linux 2.6.16; this system call was never available to       user space.System calls on removed ports       Some system calls only ever existed on Linux architectures that       have since been removed from the kernel:       AVR32 (port removed in Linux 4.12)              •pread(2)pwrite(2)       Blackfin (port removed in Linux 4.17)              •bfin_spinlock(2) (added in Linux 2.6.22)              •dma_memcpy(2) (added in Linux 2.6.22)              •pread(2) (added in Linux 2.6.22)              •pwrite(2) (added in Linux 2.6.22)              •sram_alloc(2) (added in Linux 2.6.22)              •sram_free(2) (added in Linux 2.6.22)       Metag (port removed in Linux 4.17)              •metag_get_tls(2) (add in Linux 3.9)              •metag_set_fpu_flags(2) (add in Linux 3.9)              •metag_set_tls(2) (add in Linux 3.9)              •metag_setglobalbit(2) (add in Linux 3.9)       Tile (port removed in Linux 4.17)              •cmpxchg_badaddr(2) (added in Linux 2.6.36)

NOTES        top

       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 Linux kernel source in the routinesys_xxx().  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 operating-system       emulation, such as 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, certain architectures       (notably, longstanding 32-bit architectures such as i386) now have       various groups of related system calls (e.g.,truncate(2) andtruncate64(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 system calls that exist in multiple       versions are the following:       •  By now there are three different versions ofstat(2):sys_stat() (slot__NR_oldstat),sys_newstat() (slot__NR_stat),          andsys_stat64() (slot__NR_stat64), with the last being the          most current.  A similar story applies forlstat(2) andfstat(2).       •  Similarly, the defines__NR_oldolduname,__NR_olduname, and__NR_uname refer to the routinessys_olduname(),sys_uname(),          andsys_newuname().       •  In Linux 2.0, a new version ofvm86(2) appeared, with the old          and the new kernel routines being namedsys_vm86old() andsys_vm86().       •  In Linux 2.4, a new version ofgetrlimit(2) appeared, with the          old and the new kernel routines being namedsys_old_getrlimit()          (slot__NR_getrlimit) andsys_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, replacements were required for system          calls that deal with file offsets and sizes.  Thus the          following system calls were added:fcntl64(2),getdents64(2),stat64(2),statfs64(2),truncate64(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"          suffix.          On newer platforms that only have 64-bit file access and 32-bit          UIDs/GIDs (e.g., alpha, ia64, s390x, x86-64), there is just a          single version of the UID/GID and file access system calls.  On          platforms (typically, 32-bit platforms) where the *64 and *32          calls exist, the other versions are obsolete.       •  Thert_sig* calls were added in Linux 2.2 to support the          addition of real-time signals (seesignal(7)).  These system          calls supersede the older system calls of the same name without          the "rt_" prefix.       •  Theselect(2) andmmap(2) system calls use five or more          arguments, which caused problems in the way argument passing on          the i386 used to be set up.  Thus, while other architectures          havesys_select() andsys_mmap() corresponding to__NR_select          and__NR_mmap, on i386 one findsold_select() andold_mmap()          (routines that use a pointer to an argument block) instead.          These days passing five arguments is not a problem any more,          and there is a__NR__newselect that corresponds directly tosys_select() and similarly__NR_mmap2.  s390x is the only          64-bit architecture that hasold_mmap().Architecture-specific details: Alphagetxgid(2)              returns a pair of GID and effective GID via registersr0              andr20; it is provided instead ofgetgid(2) andgetegid(2).getxpid(2)              returns a pair of PID and parent PID via registersr0andr20; it is provided instead ofgetpid(2) andgetppid(2).old_adjtimex(2)              is a variant ofadjtimex(2) that usesstruct timeval32, for              compatibility with OSF/1.getxuid(2)              returns a pair of GID and effective GID via registersr0              andr20; it is provided instead ofgetuid(2) andgeteuid(2).sethae(2)              is used for configuring the Host Address Extension register              on low-cost Alphas in order to access address space beyond              first 27 bits.

SEE ALSO        top

intro(2),syscall(2),unimplemented(2),errno(3),libc(7),vdso(7),ausyscall(8)

COLOPHON        top

       This page is part of theman-pages (Linux kernel and C library       user-space interface documentation) project.  Information about       the project can be found at        ⟨https://www.kernel.org/doc/man-pages/⟩.  If you have a bug report       for this manual page, see       ⟨https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/tree/CONTRIBUTING⟩.       This page was obtained from the tarball man-pages-6.15.tar.gz       fetched from       ⟨https://mirrors.edge.kernel.org/pub/linux/docs/man-pages/⟩ on       2025-08-11.  If you discover any rendering problems in this HTML       version of the page, or you believe there is a better or more up-       to-date source for the page, or you have corrections or       improvements to the information in this COLOPHON (which isnot       part of the original manual page), send a mail to       man-pages@man7.orgLinux man-pages 6.15            2025-05-17syscalls(2)

Pages that refer to this page:strace(1)intro(2)syscall(2)unimplemented(2)stapprobes(3stap)libc(7)man-pages(7)vdso(7)



HTML rendering created 2025-09-06 byMichael Kerrisk, author ofThe Linux Programming Interface.

For details of in-depthLinux/UNIX system programming training courses that I teach, lookhere.

Hosting byjambit GmbH.

Cover of TLPI


[8]ページ先頭

©2009-2025 Movatter.jp