1SOCKETCALL(2)              Linux Programmer's Manual             SOCKETCALL(2)
2
3
4

NAME

6       socketcall - socket system calls
7

SYNOPSIS

9       #include <linux/net.h>        /* Definition of SYS_* constants */
10       #include <sys/syscall.h>      /* Definition of SYS_socketcall */
11       #include <unistd.h>
12
13       int syscall(SYS_socketcall, int call, unsigned long *args);
14
15       Note: glibc provides no wrapper for socketcall(), necessitating the use
16       of syscall(2).
17

DESCRIPTION

19       socketcall() is a common kernel  entry  point  for  the  socket  system
20       calls.   call  determines which socket function to invoke.  args points
21       to a block containing the actual arguments, which are passed through to
22       the appropriate call.
23
24       User  programs  should  call  the  appropriate functions by their usual
25       names.  Only standard library implementors and kernel hackers  need  to
26       know about socketcall().
27
28       call              Man page
29       SYS_SOCKET        socket(2)
30       SYS_BIND          bind(2)
31       SYS_CONNECT       connect(2)
32       SYS_LISTEN        listen(2)
33       SYS_ACCEPT        accept(2)
34       SYS_GETSOCKNAME   getsockname(2)
35       SYS_GETPEERNAME   getpeername(2)
36       SYS_SOCKETPAIR    socketpair(2)
37       SYS_SEND          send(2)
38       SYS_RECV          recv(2)
39       SYS_SENDTO        sendto(2)
40       SYS_RECVFROM      recvfrom(2)
41       SYS_SHUTDOWN      shutdown(2)
42       SYS_SETSOCKOPT    setsockopt(2)
43       SYS_GETSOCKOPT    getsockopt(2)
44       SYS_SENDMSG       sendmsg(2)
45       SYS_RECVMSG       recvmsg(2)
46       SYS_ACCEPT4       accept4(2)
47       SYS_RECVMMSG      recvmmsg(2)
48       SYS_SENDMMSG      sendmmsg(2)
49

CONFORMING TO

51       This  call is specific to Linux, and should not be used in programs in‐
52       tended to be portable.
53

NOTES

55       On some architectures—for example, x86-64 and ARM—there is  no  socket‐
56       call()  system  call;  instead socket(2), accept(2), bind(2), and so on
57       really are implemented as separate system calls.
58
59       On x86-32, socketcall() was historically the only entry point  for  the
60       sockets  API.   However, starting in Linux 4.3, direct system calls are
61       provided on x86-32 for the sockets API.  This facilitates the  creation
62       of  seccomp(2)  filters that filter sockets system calls (for new user-
63       space binaries that are compiled to use the new entry points) and  also
64       provides a (very) small performance improvement.
65

SEE ALSO

67       accept(2),  bind(2),  connect(2),  getpeername(2), getsockname(2), get‐
68       sockopt(2),  listen(2),  recv(2),  recvfrom(2),  recvmsg(2),   send(2),
69       sendmsg(2),  sendto(2),  setsockopt(2), shutdown(2), socket(2), socket‐
70       pair(2)
71

COLOPHON

73       This page is part of release 5.12 of the Linux  man-pages  project.   A
74       description  of  the project, information about reporting bugs, and the
75       latest    version    of    this    page,    can     be     found     at
76       https://www.kernel.org/doc/man-pages/.
77
78
79
80Linux                             2021-03-22                     SOCKETCALL(2)
Impressum