lnlidawei

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

[os]:  linux 系统调用(syscalls)

 

 

 

 

 一、基本说明:

 

  1、操作系统:rockylinux8.5

 

  2、此处系统调用的使用形式: c/cpp的库函数

  1 wit@fedora tmp]$ man syscalls        // 【系统调用使用方式:c语言的函数库形式】查看系统调用名称
  2 
  3 
  4 [wit@fedora tmp]$ man brk        // 查看某个系统调用的使用方法
  5 
  6 
  7 [wit@fedora tmp]$ man brk >> brk.txt
  8 [wit@fedora tmp]$ 
  9 [wit@fedora tmp]$ 
 10 [wit@fedora tmp]$ cat brk.txt
 11 brk(2)                                                      System Calls Manual                                                      brk(2)
 12 
 13 NAME
 14        brk, sbrk - change data segment size
 15 
 16 LIBRARY
 17        Standard C library (libc, -lc)
 18 
 19 SYNOPSIS
 20        #include <unistd.h>
 21 
 22        int brk(void *addr);
 23        void *sbrk(intptr_t increment);
 24 
 25    Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
 26 
 27        brk(), sbrk():
 28            Since glibc 2.19:
 29                _DEFAULT_SOURCE
 30                    || ((_XOPEN_SOURCE >= 500) &&
 31                        ! (_POSIX_C_SOURCE >= 200112L))
 32            From glibc 2.12 to glibc 2.19:
 33                _BSD_SOURCE || _SVID_SOURCE
 34                    || ((_XOPEN_SOURCE >= 500) &&
 35                        ! (_POSIX_C_SOURCE >= 200112L))
 36            Before glibc 2.12:
 37                _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE >= 500
 38 
 39 DESCRIPTION
 40        brk()  and  sbrk()  change the location of the program break, which defines the end of the process's data segment (i.e., the program
 41        break is the first location after the end of the uninitialized data segment).  Increasing the program break has the effect of  allo‐
 42        cating memory to the process; decreasing the break deallocates memory.
 43 
 44        brk()  sets the end of the data segment to the value specified by addr, when that value is reasonable, the system has enough memory,
 45        and the process does not exceed its maximum data size (see setrlimit(2)).
 46 
 47        sbrk() increments the program's data space by increment bytes.  Calling sbrk() with an increment of 0 can be used to find  the  cur‐
 48        rent location of the program break.
 49 
 50 RETURN VALUE
 51        On success, brk() returns zero.  On error, -1 is returned, and errno is set to ENOMEM.
 52 
 53        On  success,  sbrk()  returns the previous program break.  (If the break was increased, then this value is a pointer to the start of
 54        the newly allocated memory).  On error, (void *) -1 is returned, and errno is set to ENOMEM.
 55 
 56 STANDARDS
 57        None.
 58 
 59 HISTORY
 60        4.3BSD; SUSv1, marked LEGACY in SUSv2, removed in POSIX.1-2001.
 61 
 62 NOTES
 63        Avoid using brk() and sbrk(): the malloc(3) memory allocation package is the portable and comfortable way of allocating memory.
 64 
 65        Various systems use various types for the argument of sbrk().  Common are int, ssize_t, ptrdiff_t, intptr_t.
 66 
 67    C library/kernel differences
 68        The return value described above for brk() is the behavior provided by the glibc wrapper function for the Linux brk()  system  call.
 69        (On  most  other implementations, the return value from brk() is the same; this return value was also specified in SUSv2.)  However,
 70        the actual Linux system call returns the new program break on success.  On failure, the system call returns the current break.   The
 71        glibc  wrapper  function does some work (i.e., checks whether the new break is less than addr) to provide the 0 and -1 return values
 72        described above.
 73 
 74        On Linux, sbrk() is implemented as a library function that uses the brk() system call, and does some internal bookkeeping so that it
 75        can return the old break value.
 76 
 77 SEE ALSO
 78        execve(2), getrlimit(2), end(3), malloc(3)
 79 
 80 Linux man-pages 6.04                                             2023-03-30                                                          brk(2)
 81 brk(2)                                                      System Calls Manual                                                      brk(2)
 82 
 83 NAME
 84        brk, sbrk - change data segment size
 85 
 86 LIBRARY
 87        Standard C library (libc, -lc)
 88 
 89 SYNOPSIS
 90        #include <unistd.h>
 91 
 92        int brk(void *addr);
 93        void *sbrk(intptr_t increment);
 94 
 95    Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
 96 
 97        brk(), sbrk():
 98            Since glibc 2.19:
 99                _DEFAULT_SOURCE
100                    || ((_XOPEN_SOURCE >= 500) &&
101                        ! (_POSIX_C_SOURCE >= 200112L))
102            From glibc 2.12 to glibc 2.19:
103                _BSD_SOURCE || _SVID_SOURCE
104                    || ((_XOPEN_SOURCE >= 500) &&
105                        ! (_POSIX_C_SOURCE >= 200112L))
106            Before glibc 2.12:
107                _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE >= 500
108 
109 DESCRIPTION
110        brk()  and  sbrk()  change the location of the program break, which defines the end of the process's data segment (i.e., the program
111        break is the first location after the end of the uninitialized data segment).  Increasing the program break has the effect of  allo‐
112        cating memory to the process; decreasing the break deallocates memory.
113 
114        brk()  sets the end of the data segment to the value specified by addr, when that value is reasonable, the system has enough memory,
115        and the process does not exceed its maximum data size (see setrlimit(2)).
116 
117        sbrk() increments the program's data space by increment bytes.  Calling sbrk() with an increment of 0 can be used to find  the  cur‐
118        rent location of the program break.
119 
120 RETURN VALUE
121        On success, brk() returns zero.  On error, -1 is returned, and errno is set to ENOMEM.
122 
123        On  success,  sbrk()  returns the previous program break.  (If the break was increased, then this value is a pointer to the start of
124        the newly allocated memory).  On error, (void *) -1 is returned, and errno is set to ENOMEM.
125 
126 STANDARDS
127        None.
128 
129 HISTORY
130        4.3BSD; SUSv1, marked LEGACY in SUSv2, removed in POSIX.1-2001.
131 
132 NOTES
133        Avoid using brk() and sbrk(): the malloc(3) memory allocation package is the portable and comfortable way of allocating memory.
134 
135        Various systems use various types for the argument of sbrk().  Common are int, ssize_t, ptrdiff_t, intptr_t.
136 
137    C library/kernel differences
138        The return value described above for brk() is the behavior provided by the glibc wrapper function for the Linux brk()  system  call.
139        (On  most  other implementations, the return value from brk() is the same; this return value was also specified in SUSv2.)  However,
140        the actual Linux system call returns the new program break on success.  On failure, the system call returns the current break.   The
141        glibc  wrapper  function does some work (i.e., checks whether the new break is less than addr) to provide the 0 and -1 return values
142        described above.
143 
144        On Linux, sbrk() is implemented as a library function that uses the brk() system call, and does some internal bookkeeping so that it
145        can return the old break value.
146 
147 SEE ALSO
148        execve(2), getrlimit(2), end(3), malloc(3)
149 
150 Linux man-pages 6.04                                             2023-03-30                                                          brk(2)
151 [wit@fedora tmp]$ 
152 [wit@fedora tmp]$ 

 

二、源代码

  1 [root@rockylinux tmp]# uname -a
  2 Linux rockylinux 4.18.0-372.26.1.el8_6.x86_64 #1 SMP Tue Sep 13 18:09:48 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
  3 [root@rockylinux tmp]#
  4 [root@rockylinux tmp]# man syscalls
  5 [root@rockylinux tmp]#
  6 
  7 
  8 SYSCALLS(2)                                              Linux Programmer's Manual                                              SYSCALLS(2)
  9 
 10 NAME
 11        syscalls - Linux system calls
 12 
 13 SYNOPSIS
 14        Linux system calls.
 15 
 16 DESCRIPTION
 17        The system call is the fundamental interface between an application and the Linux kernel.
 18 
 19    System calls and library wrapper functions
 20        System  calls  are  generally  not invoked directly, but rather via wrapper functions in glibc (or perhaps some other library).  For
 21        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
 22        the  name of the system call that it invokes.  For example, glibc contains a function truncate() which invokes the underlying "trun‐
 23        cate" system call.
 24 
 25        Often the glibc wrapper function is quite thin, doing little work other than copying arguments to the right registers before  invok‐
 26        ing  the  system  call, and then setting errno appropriately after the system call has returned.  (These are the same steps that are
 27        performed by syscall(2), which can be used to invoke system calls for which no wrapper function is provided.)   Note:  system  calls
 28        indicate  a failure by returning a negative error number to the caller; when this happens, the wrapper function negates the returned
 29        error number (to make it positive), copies it to errno, and returns -1 to the caller of the wrapper.
 30 
 31        Sometimes, however, the wrapper function does some extra work before invoking the system call.  For example, nowadays there are (for
 32        reasons  described  below) two related system calls, truncate(2) and truncate64(2), and the glibc truncate() wrapper function checks
 33        which of those system calls are provided by the kernel and determines which should be employed.
 34 
 35    System call list
 36        Below is a list of the Linux system calls.  In the list, the Kernel column indicates the kernel version for those system calls  that
 37        were new in Linux 2.2, or have appeared since that kernel version.  Note the following points:
 38 
 39        *  Where no kernel version is indicated, the system call appeared in kernel 1.0 or earlier.
 40 
 41        *  Where a system call is marked "1.2" this means the system call probably appeared in a 1.1.x kernel version, and first appeared in
 42           a stable kernel with 1.2.  (Development of the 1.2 kernel was initiated from a branch of kernel 1.0.6 via the 1.1.x unstable ker‐
 43           nel series.)
 44 
 45        *  Where a system call is marked "2.0" this means the system call probably appeared in a 1.3.x kernel version, and first appeared in
 46           a stable kernel with 2.0.  (Development of the 2.0 kernel was initiated from a branch of kernel 1.2.x, somewhere  around  1.2.10,
 47           via the 1.3.x unstable kernel series.)
 48 
 49        *  Where a system call is marked "2.2" this means the system call probably appeared in a 2.1.x kernel version, and first appeared in
 50           a stable kernel with 2.2.0.  (Development of the 2.2 kernel was initiated from a branch of kernel 2.0.21 via the  2.1.x  unstable
 51           kernel series.)
 52 
 53        *  Where a system call is marked "2.4" this means the system call probably appeared in a 2.3.x kernel version, and first appeared in
 54           a stable kernel with 2.4.0.  (Development of the 2.4 kernel was initiated from a branch of kernel 2.2.8 via  the  2.3.x  unstable
 55           kernel series.)
 56 
 57        *  Where a system call is marked "2.6" this means the system call probably appeared in a 2.5.x kernel version, and first appeared in
 58           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  ker‐
 59           nel series.)
 60 
 61        *  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,
 62           the exact version number where the system call appeared is shown.  This convention continues with the 3.x  kernel  series,  which
 63           followed on from kernel 2.6.39, and the 4.x kernel series, which followed on from kernel 3.19.
 64 
 65        *  In  some  cases,  a system call was added to a stable kernel series after it branched from the previous stable kernel series, and
 66           then backported into the earlier stable kernel series.  For example some system calls that appeared in 2.6.x were also backported
 67           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
 68           series is listed.
 69 
 70        The list of system calls that are available as at kernel 4.11 (or in a few cases only on older kernels) is as follows:
 71 
 72        System call                Kernel        Notes
 73        ───────────────────────────────────────────────────────────────────────────
 74 
 75        _llseek(2)                 1.2
 76        _newselect(2)              2.0
 77        _sysctl(2)                 2.0
 78        accept(2)                  2.0           See notes on socketcall(2)
 79        accept4(2)                 2.6.28
 80        access(2)                  1.0
 81        acct(2)                    1.0
 82        add_key(2)                 2.6.10
 83        adjtimex(2)                1.0
 84        alarm(2)                   1.0
 85        alloc_hugepages(2)         2.5.36        Removed in 2.5.44
 86        bdflush(2)                 1.2           Deprecated (does nothing)
 87                                                 since 2.6
 88        bind(2)                    2.0           See notes on socketcall(2)
 89        bpf(2)                     3.18
 90        brk(2)                     1.0
 91        cacheflush(2)              1.2           Not on x86
 92        capget(2)                  2.2
 93        capset(2)                  2.2
 94        chdir(2)                   1.0
 95        chmod(2)                   1.0
 96        chown(2)                   2.2           See chown(2) for
 97                                                 version details
 98        chown32(2)                 2.4
 99        chroot(2)                  1.0
100        clock_adjtime(2)           2.6.39
101        clock_getres(2)            2.6
102        clock_gettime(2)           2.6
103        clock_nanosleep(2)         2.6
104        clock_settime(2)           2.6
105        clone(2)                   1.0
106        close(2)                   1.0
107        connect(2)                 2.0           See notes on socketcall(2)
108        copy_file_range(2)         4.5
109        creat(2)                   1.0
110        create_module(2)           1.0           Removed in 2.6
111        delete_module(2)           1.0
112        dup(2)                     1.0
113        dup2(2)                    1.0
114        dup3(2)                    2.6.27
115        epoll_create(2)            2.6
116        epoll_create1(2)           2.6.27
117        epoll_ctl(2)               2.6
118        epoll_pwait(2)             2.6.19
119        epoll_wait(2)              2.6
120        eventfd(2)                 2.6.22
121        eventfd2(2)                2.6.27
122        execve(2)                  1.0
123        execveat(2)                3.19
124        exit(2)                    1.0
125        exit_group(2)              2.6
126        faccessat(2)               2.6.16
127        fadvise64(2)               2.6
128        fadvise64_64(2)            2.6
129        fallocate(2)               2.6.23
130        fanotify_init(2)           2.6.37
131        fanotify_mark(2)           2.6.37
132        fchdir(2)                  1.0
133        fchmod(2)                  1.0
134        fchmodat(2)                2.6.16
135        fchown(2)                  1.0
136        fchown32(2)                2.4
137 
138        fchownat(2)                2.6.16
139        fcntl(2)                   1.0
140        fcntl64(2)                 2.4
141        fdatasync(2)               2.0
142        fgetxattr(2)               2.6; 2.4.18
143        finit_module(2)            3.8
144        flistxattr(2)              2.6; 2.4.18
145        flock(2)                   2.0
146        fork(2)                    1.0
147        free_hugepages(2)          2.5.36        Removed in 2.5.44
148        fremovexattr(2)            2.6; 2.4.18
149        fsetxattr(2)               2.6; 2.4.18
150        fstat(2)                   1.0
151        fstat64(2)                 2.4
152        fstatat64(2)               2.6.16
153        fstatfs(2)                 1.0
154        fstatfs64(2)               2.6
155        fsync(2)                   1.0
156        ftruncate(2)               1.0
157        ftruncate64(2)             2.4
158        futex(2)                   2.6
159        futimesat(2)               2.6.16
160        get_kernel_syms(2)         1.0           Removed in 2.6
161        get_mempolicy(2)           2.6.6
162        get_robust_list(2)         2.6.17
163        get_thread_area(2)         2.6
164        getcpu(2)                  2.6.19
165        getcwd(2)                  2.2
166        getdents(2)                2.0
167        getdents64(2)              2.4
168        getegid(2)                 1.0
169        getegid32(2)               2.4
170        geteuid(2)                 1.0
171        geteuid32(2)               2.4
172        getgid(2)                  1.0
173        getgid32(2)                2.4
174        getgroups(2)               1.0
175        getgroups32(2)             2.4
176        getitimer(2)               1.0
177        getpeername(2)             2.0           See notes on socketcall(2)
178        getpagesize(2)             2.0           Not on x86
179        getpgid(2)                 1.0
180        getpgrp(2)                 1.0
181        getpid(2)                  1.0
182        getppid(2)                 1.0
183        getpriority(2)             1.0
184        getrandom(2)               3.17
185        getresgid(2)               2.2
186        getresgid32(2)             2.4
187        getresuid(2)               2.2
188        getresuid32(2)             2.4
189        getrlimit(2)               1.0
190        getrusage(2)               1.0
191        getsid(2)                  2.0
192        getsockname(2)             2.0           See notes on socketcall(2)
193        getsockopt(2)              2.0           See notes on socketcall(2)
194        gettid(2)                  2.4.11
195        gettimeofday(2)            1.0
196        getuid(2)                  1.0
197        getuid32(2)                2.4
198        getunwind(2)               2.4.8         ia64; deprecated
199        getxattr(2)                2.6; 2.4.18
200        init_module(2)             1.0
201        inotify_add_watch(2)       2.6.13
202        inotify_init(2)            2.6.13
203 
204        inotify_init1(2)           2.6.27
205        inotify_rm_watch(2)        2.6.13
206        io_cancel(2)               2.6
207        io_destroy(2)              2.6
208        io_getevents(2)            2.6
209        io_setup(2)                2.6
210        io_submit(2)               2.6
211        ioctl(2)                   1.0
212        ioperm(2)                  1.0
213        iopl(2)                    1.0
214        ioprio_get(2)              2.6.13
215        ioprio_set(2)              2.6.13
216        ipc(2)                     1.0
217        kcmp(2)                    3.5
218        kern_features(2)           3.7           Sparc64
219        kexec_file_load(2)         3.17
220        kexec_load(2)              2.6.13
221        keyctl(2)                  2.6.10
222        kill(2)                    1.0
223        lchown(2)                  1.0           See chown(2) for
224                                                 version details
225        lchown32(2)                2.4
226        lgetxattr(2)               2.6; 2.4.18
227        link(2)                    1.0
228        linkat(2)                  2.6.16
229        listen(2)                  2.0           See notes on socketcall(2)
230        listxattr(2)               2.6; 2.4.18
231        llistxattr(2)              2.6; 2.4.18
232        lookup_dcookie(2)          2.6
233        lremovexattr(2)            2.6; 2.4.18
234        lseek(2)                   1.0
235        lsetxattr(2)               2.6; 2.4.18
236        lstat(2)                   1.0
237        lstat64(2)                 2.4
238        madvise(2)                 2.4
239        mbind(2)                   2.6.6
240        membarrier(2)              3.17
241        memfd_create(2)            3.17
242        migrate_pages(2)           2.6.16
243        mincore(2)                 2.4
244        mkdir(2)                   1.0
245        mkdirat(2)                 2.6.16
246        mknod(2)                   1.0
247        mknodat(2)                 2.6.16
248        mlock(2)                   2.0
249        mlock2(2)                  4.4
250        mlockall(2)                2.0
251        mmap(2)                    1.0
252        mmap2(2)                   2.4
253        modify_ldt(2)              1.0
254        mount(2)                   1.0
255        move_pages(2)              2.6.18
256        mprotect(2)                1.0
257        mq_getsetattr(2)           2.6.6
258        mq_notify(2)               2.6.6
259        mq_open(2)                 2.6.6
260        mq_timedreceive(2)         2.6.6
261        mq_timedsend(2)            2.6.6
262        mq_unlink(2)               2.6.6
263        mremap(2)                  2.0
264        msgctl(2)                  2.0           See notes on ipc(2)
265        msgget(2)                  2.0           See notes on ipc(2)
266        msgrcv(2)                  2.0           See notes on ipc(2)
267        msgsnd(2)                  2.0           See notes on ipc(2)
268        msync(2)                   2.0
269 
270        munlock(2)                 2.0
271        munlockall(2)              2.0
272        munmap(2)                  1.0
273        name_to_handle_at(2)       2.6.39
274        nanosleep(2)               2.0
275        nfsservctl(2)              2.2           Removed in 3.1
276        nice(2)                    1.0
277        oldfstat(2)                1.0
278        oldlstat(2)                1.0
279        oldolduname(2)             1.0
280        oldstat(2)                 1.0
281        olduname(2)                1.0
282        open(2)                    1.0
283        open_by_handle_at(2)       2.6.39
284        openat(2)                  2.6.16
285        pause(2)                   1.0
286        pciconfig_iobase(2)        2.2.15; 2.4   Not on x86
287        pciconfig_read(2)          2.0.26; 2.2   Not on x86
288        pciconfig_write(2)         2.0.26; 2.2   Not on x86
289        perf_event_open(2)         2.6.31        Was perf_counter_open() in
290                                                 2.6.31; renamed in 2.6.32
291        personality(2)             1.2
292        perfctr(2)                 2.2           Sparc; removed in 2.6.34
293        perfmonctl(2)              2.4           ia64
294        pipe(2)                    1.0
295        pipe2(2)                   2.6.27
296        pivot_root(2)              2.4
297        pkey_alloc(2)              4.8
298        pkey_free(2)               4.8
299        pkey_mprotect(2)           4.8
300        poll(2)                    2.0.36; 2.2
301        ppc_rtas(2)                2.6.2         PowerPC only
302        ppc_swapcontext(2)         2.6.3         PowerPC only
303        ppoll(2)                   2.6.16
304        prctl(2)                   2.2
305        pread64(2)                               Added as "pread" in 2.2;
306                                                 renamed "pread64" in 2.6
307        preadv(2)                  2.6.30
308        preadv2(2)                 4.6
309        prlimit64(2)               2.6.36
310        process_vm_readv(2)        3.2
311        process_vm_writev(2)       3.2
312        pselect6(2)                2.6.16
313        ptrace(2)                  1.0
314        pwrite64(2)                              Added as "pwrite" in 2.2;
315                                                 renamed "pwrite64" in 2.6
316        pwritev(2)                 2.6.30
317        pwritev2(2)                4.6
318        query_module(2)            2.2           Removed in 2.6
319        quotactl(2)                1.0
320        read(2)                    1.0
321        readahead(2)               2.4.13
322        readdir(2)                 1.0
323        readlink(2)                1.0
324        readlinkat(2)              2.6.16
325        readv(2)                   2.0
326        reboot(2)                  1.0
327        recv(2)                    2.0           See notes on socketcall(2)
328        recvfrom(2)                2.0           See notes on socketcall(2)
329        recvmsg(2)                 2.0           See notes on socketcall(2)
330        recvmmsg(2)                2.6.33
331        remap_file_pages(2)        2.6           Deprecated since 3.16
332        removexattr(2)             2.6; 2.4.18
333        rename(2)                  1.0
334        renameat(2)                2.6.16
335 
336        renameat2(2)               3.15
337        request_key(2)             2.6.10
338        restart_syscall(2)         2.6
339        rmdir(2)                   1.0
340        rt_sigaction(2)            2.2
341        rt_sigpending(2)           2.2
342        rt_sigprocmask(2)          2.2
343        rt_sigqueueinfo(2)         2.2
344        rt_sigreturn(2)            2.2
345        rt_sigsuspend(2)           2.2
346        rt_sigtimedwait(2)         2.2
347        rt_tgsigqueueinfo(2)       2.6.31
348        s390_runtime_instr(2)      3.7           s390 only
349        s390_pci_mmio_read(2)      3.19          s390 only
350        s390_pci_mmio_write(2)     3.19          s390 only
351        s390_sthyi(2)              4.15          s390 only
352        sched_get_priority_max(2)  2.0
353        sched_get_priority_min(2)  2.0
354        sched_getaffinity(2)       2.6
355        sched_getattr(2)           3.14
356        sched_getparam(2)          2.0
357        sched_getscheduler(2)      2.0
358        sched_rr_get_interval(2)   2.0
359        sched_setaffinity(2)       2.6
360        sched_setattr(2)           3.14
361        sched_setparam(2)          2.0
362        sched_setscheduler(2)      2.0
363        sched_yield(2)             2.0
364        seccomp(2)                 3.17
365        select(2)                  1.0
366        semctl(2)                  2.0           See notes on ipc(2)
367        semget(2)                  2.0           See notes on ipc(2)
368        semop(2)                   2.0           See notes on ipc(2)
369        semtimedop(2)              2.6; 2.4.22
370        send(2)                    2.0           See notes on socketcall(2)
371        sendfile(2)                2.2
372        sendfile64(2)              2.6; 2.4.19
373        sendmmsg(2)                3.0
374        sendmsg(2)                 2.0           See notes on socketcall(2)
375        sendto(2)                  2.0           See notes on socketcall(2)
376        set_mempolicy(2)           2.6.6
377        set_robust_list(2)         2.6.17
378        set_thread_area(2)         2.6
379        set_tid_address(2)         2.6
380        setdomainname(2)           1.0
381        setfsgid(2)                1.2
382        setfsgid32(2)              2.4
383        setfsuid(2)                1.2
384        setfsuid32(2)              2.4
385        setgid(2)                  1.0
386        setgid32(2)                2.4
387        setgroups(2)               1.0
388        setgroups32(2)             2.4
389        sethostname(2)             1.0
390        setitimer(2)               1.0
391        setns(2)                   3.0
392        setpgid(2)                 1.0
393        setpriority(2)             1.0
394        setregid(2)                1.0
395        setregid32(2)              2.4
396        setresgid(2)               2.2
397        setresgid32(2)             2.4
398        setresuid(2)               2.2
399        setresuid32(2)             2.4
400        setreuid(2)                1.0
401 
402        setreuid32(2)              2.4
403        setrlimit(2)               1.0
404        setsid(2)                  1.0
405        setsockopt(2)              2.0           See notes on socketcall(2)
406        settimeofday(2)            1.0
407        setuid(2)                  1.0
408        setuid32(2)                2.4
409        setup(2)                   1.0           Removed in 2.2
410        setxattr(2)                2.6; 2.4.18
411        sgetmask(2)                1.0
412        shmat(2)                   2.0           See notes on ipc(2)
413        shmctl(2)                  2.0           See notes on ipc(2)
414        shmdt(2)                   2.0           See notes on ipc(2)
415        shmget(2)                  2.0           See notes on ipc(2)
416        shutdown(2)                2.0           See notes on socketcall(2)
417        sigaction(2)               1.0
418        sigaltstack(2)             2.2
419        signal(2)                  1.0
420        signalfd(2)                2.6.22
421        signalfd4(2)               2.6.27
422        sigpending(2)              1.0
423        sigprocmask(2)             1.0
424        sigreturn(2)               1.0
425        sigsuspend(2)              1.0
426        socket(2)                  2.0           See notes on socketcall(2)
427        socketcall(2)              1.0
428        socketpair(2)              2.0           See notes on socketcall(2)
429        splice(2)                  2.6.17
430        spu_create(2)              2.6.16        PowerPC only
431        spu_run(2)                 2.6.16        PowerPC only
432        ssetmask(2)                1.0
433        stat(2)                    1.0
434        stat64(2)                  2.4
435        statfs(2)                  1.0
436        statfs64(2)                2.6
437        statx(2)                   4.11
438        stime(2)                   1.0
439        subpage_prot(2)            2.6.25        PowerPC only
440        swapoff(2)                 1.0
441        swapon(2)                  1.0
442        symlink(2)                 1.0
443        symlinkat(2)               2.6.16
444        sync(2)                    1.0
445        sync_file_range(2)         2.6.17
446        sync_file_range2(2)        2.6.22
447        syncfs(2)                  2.6.39
448        sysfs(2)                   1.2
449        sysinfo(2)                 1.0
450        syslog(2)                  1.0
451        tee(2)                     2.6.17
452        tgkill(2)                  2.6
453        time(2)                    1.0
454        timer_create(2)            2.6
455        timer_delete(2)            2.6
456        timer_getoverrun(2)        2.6
457        timer_gettime(2)           2.6
458        timer_settime(2)           2.6
459        timerfd_create(2)          2.6.25
460        timerfd_gettime(2)         2.6.25
461        timerfd_settime(2)         2.6.25
462        times(2)                   1.0
463        tkill(2)                   2.6; 2.4.22
464        truncate(2)                1.0
465        truncate64(2)              2.4
466        ugetrlimit(2)              2.4
467 
468        umask(2)                   1.0
469        umount(2)                  1.0
470        umount2(2)                 2.2
471        uname(2)                   1.0
472        unlink(2)                  1.0
473        unlinkat(2)                2.6.16
474        unshare(2)                 2.6.16
475        uselib(2)                  1.0
476        ustat(2)                   1.0
477        userfaultfd(2)             4.3
478        utime(2)                   1.0
479        utimensat(2)               2.6.22
480        utimes(2)                  2.2
481        utrap_install(2)           2.2           Sparc only
482        vfork(2)                   2.2
483        vhangup(2)                 1.0
484        vm86old(2)                 1.0           Was "vm86"; renamed in 2.0.28/2.2
485        vm86(2)                    2.0.28; 2.2
486        vmsplice(2)                2.6.17
487        wait4(2)                   1.0
488        waitid(2)                  2.6.10
489        waitpid(2)                 1.0
490        write(2)                   1.0
491        writev(2)                  2.0
492 
493        On many platforms, including x86-32, socket calls are all multiplexed (via glibc wrapper functions) through socketcall(2) and  simi‐
494        larly System V IPC calls are multiplexed through ipc(2).
495 
496        Although  slots  are reserved for them in the system call table, the following system calls are not implemented in the standard ker‐
497        nel: 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),
498        putpmsg(2),  security(2), stty(2), tuxcall(2), ulimit(2), and vserver(2) (see also unimplemented(2)).  However, ftime(3), profil(3),
499        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
500        implemented.   The getpmsg(2) and putpmsg(2) calls are for kernels patched to support STREAMS, and may never be in the standard ker‐
501        nel.
502 
503        There was briefly set_zone_reclaim(2), added in Linux 2.6.13, and removed in 2.6.16; this system call was never  available  to  user
504        space.
505 
506 NOTES
507        Roughly  speaking,  the  code belonging to the system call with number __NR_xxx defined in /usr/include/asm/unistd.h can be found in
508        the Linux kernel source in the routine sys_xxx().  (The dispatch table  for  i386  can  be  found  in  /usr/src/linux/arch/i386/ker‐
509        nel/entry.S.)   There  are  many  exceptions, however, mostly because older system calls were superseded by newer ones, and this has
510        been treated somewhat unsystematically.  On platforms with proprietary operating-system emulation, such as parisc,  sparc,  sparc64,
511        and alpha, there are many additional system calls; mips64 also contains a full set of 32-bit system calls.
512 
513        Over time, changes to the interfaces of some system calls have been necessary.  One reason for such changes was the need to increase
514        the size of structures or scalar values passed to the system call.  Because of these changes, certain architectures (notably,  long515        standing  32-bit  architectures  such as i386) now have various groups of related system calls (e.g., truncate(2) and truncate64(2))
516        which perform similar tasks, but which vary in details such as the size of their arguments.  (As  noted  earlier,  applications  are
517        generally  unaware  of  this: the glibc wrapper functions do some work to ensure that the right system call is invoked, and that ABI
518        compatibility is preserved for old binaries.)  Examples of systems calls that exist in multiple versions are the following:
519 
520        *  By now there are three different versions of  stat(2):  sys_stat()  (slot  __NR_oldstat),  sys_newstat()  (slot  __NR_stat),  and
521           sys_stat64() (slot __NR_stat64), with the last being the most current.  A similar story applies for lstat(2) and fstat(2).
522 
523        *  Similarly,  the  defines  __NR_oldolduname,  __NR_olduname,  and __NR_uname refer to the routines sys_olduname(), sys_uname() and
524           sys_newuname().
525 
526        *  In Linux 2.0, a new version of vm86(2) appeared, with the  old  and  the  new  kernel  routines  being  named  sys_vm86old()  and
527           sys_vm86().
528 
529        *  In  Linux  2.4,  a new version of getrlimit(2) appeared, with the old and the new kernel routines being named sys_old_getrlimit()
530           (slot __NR_getrlimit) and sys_getrlimit() (slot __NR_ugetrlimit).
531 
532        *  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
533           added  (e.g.,  chown32(2),  getuid32(2),  getgroups32(2), setresuid32(2)), superseding earlier calls of the same name without the
534           "32" suffix.
535 
536        *  Linux 2.4 added support for applications on 32-bit architectures to access large files (i.e., files for which the sizes and  file
537           offsets  can't  be  represented  in 32 bits.)  To support this change, replacements were required for system calls that deal with
538           file offsets and sizes.  Thus the following system calls were added: fcntl64(2),  getdents64(2),  stat64(2),  statfs64(2),  trun‐
539           cate64(2),  and  their  analogs that work with file descriptors or symbolic links.  These system calls supersede the older system
540           calls which, except in the case of the "stat" calls, have the same name without the "64" suffix.
541 
542           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
543           single  version  of  the  UID/GID and file access system calls.  On platforms (typically, 32-bit platforms) where the *64 and *32
544           calls exist, the other versions are obsolete.
545 
546        *  The rt_sig* calls were added in kernel 2.2 to support the addition of real-time signals  (see  signal(7)).   These  system  calls
547           supersede the older system calls of the same name without the "rt_" prefix.
548 
549        *  The  select(2) and mmap(2) system calls use five or more arguments, which caused problems in the way argument passing on the i386
550           used to be set up.  Thus, while other architectures have sys_select() and sys_mmap() corresponding to __NR_select and  __NR_mmap,
551           on  i386  one  finds  old_select() and old_mmap() (routines that use a pointer to an argument block) instead.  These days passing
552           five arguments is not a problem any more, and there is a __NR__newselect that corresponds directly to sys_select() and  similarly
553           __NR_mmap2.
554 
555 SEE ALSO
556        intro(2), syscall(2), unimplemented(2), errno(3), libc(7), vdso(7)
557 
558 COLOPHON
559        This  page  is part of release 4.15 of the Linux man-pages project.  A description of the project, information about reporting bugs,
560        and the latest version of this page, can be found at https://www.kernel.org/doc/man-pages/.
561 
562 Linux                                                            2018-02-02                                                     SYSCALLS(2)

 

三、参考资料:

 

  1、  linux rockylinux8.5 操作系统自带文档

 

posted on 2022-09-30 23:13  lnlidawei  阅读(191)  评论(0编辑  收藏  举报