1socketcall(2) System Calls Manual socketcall(2)
2
3
4
6 socketcall - socket system calls
7
9 Standard C library (libc, -lc)
10
12 #include <linux/net.h> /* Definition of SYS_* constants */
13 #include <sys/syscall.h> /* Definition of SYS_socketcall */
14 #include <unistd.h>
15
16 int syscall(SYS_socketcall, int call, unsigned long *args);
17
18 Note: glibc provides no wrapper for socketcall(), necessitating the use
19 of syscall(2).
20
22 socketcall() is a common kernel entry point for the socket system
23 calls. call determines which socket function to invoke. args points
24 to a block containing the actual arguments, which are passed through to
25 the appropriate call.
26
27 User programs should call the appropriate functions by their usual
28 names. Only standard library implementors and kernel hackers need to
29 know about socketcall().
30
31 call Man page
32 SYS_SOCKET socket(2)
33 SYS_BIND bind(2)
34 SYS_CONNECT connect(2)
35 SYS_LISTEN listen(2)
36 SYS_ACCEPT accept(2)
37 SYS_GETSOCKNAME getsockname(2)
38 SYS_GETPEERNAME getpeername(2)
39 SYS_SOCKETPAIR socketpair(2)
40 SYS_SEND send(2)
41 SYS_RECV recv(2)
42 SYS_SENDTO sendto(2)
43 SYS_RECVFROM recvfrom(2)
44 SYS_SHUTDOWN shutdown(2)
45 SYS_SETSOCKOPT setsockopt(2)
46 SYS_GETSOCKOPT getsockopt(2)
47 SYS_SENDMSG sendmsg(2)
48 SYS_RECVMSG recvmsg(2)
49 SYS_ACCEPT4 accept4(2)
50 SYS_RECVMMSG recvmmsg(2)
51 SYS_SENDMMSG sendmmsg(2)
52
54 On some architectures—for example, x86-64 and ARM—there is no socket‐
55 call() system call; instead socket(2), accept(2), bind(2), and so on
56 really are implemented as separate system calls.
57
59 Linux.
60
61 On x86-32, socketcall() was historically the only entry point for the
62 sockets API. However, starting in Linux 4.3, direct system calls are
63 provided on x86-32 for the sockets API. This facilitates the creation
64 of seccomp(2) filters that filter sockets system calls (for new user-
65 space binaries that are compiled to use the new entry points) and also
66 provides a (very) small performance improvement.
67
69 accept(2), bind(2), connect(2), getpeername(2), getsockname(2), get‐
70 sockopt(2), listen(2), recv(2), recvfrom(2), recvmsg(2), send(2),
71 sendmsg(2), sendto(2), setsockopt(2), shutdown(2), socket(2), socket‐
72 pair(2)
73
74
75
76Linux man-pages 6.04 2023-03-30 socketcall(2)