| 1 |
'\" t |
| 2 |
.\" Copyright 1995, Michael Chastain <[email protected]> |
| 3 |
.\" Copyright, the authors of the Linux man-pages project |
| 4 |
.\" |
| 5 |
.\" SPDX-License-Identifier: GPL-2.0-or-later |
| 6 |
.\" |
| 7 |
.TH socketcall 2 2026-02-08 "Linux man-pages 6.18" |
| 8 |
.SH NAME |
| 9 |
socketcall \- socket system calls |
| 10 |
.SH LIBRARY |
| 11 |
Standard C library |
| 12 |
.RI ( libc ,\~ \-lc ) |
| 13 |
.SH SYNOPSIS |
| 14 |
.nf |
| 15 |
.BR "#include <linux/net.h>" " /* Definition of " SYS_* " constants */" |
| 16 |
.BR "#include <sys/syscall.h>" " /* Definition of " SYS_socketcall " */" |
| 17 |
.B #include <unistd.h> |
| 18 |
.P |
| 19 |
.BI "int syscall(SYS_socketcall, int " call ", unsigned long *" args ); |
| 20 |
.fi |
| 21 |
.P |
| 22 |
.IR Note : |
| 23 |
glibc provides no wrapper for |
| 24 |
.BR socketcall (), |
| 25 |
necessitating the use of |
| 26 |
.BR syscall (2). |
| 27 |
.SH DESCRIPTION |
| 28 |
.BR socketcall () |
| 29 |
is a common kernel entry point for the socket system calls. |
| 30 |
.I call |
| 31 |
determines which socket function to invoke. |
| 32 |
.I args |
| 33 |
points to a block containing the actual arguments, |
| 34 |
which are passed through to the appropriate call. |
| 35 |
.P |
| 36 |
User programs should call the appropriate functions by their usual names. |
| 37 |
Only standard library implementors and kernel hackers need to know about |
| 38 |
.BR socketcall (). |
| 39 |
.P |
| 40 |
.TS |
| 41 |
tab(:); |
| 42 |
l l. |
| 43 |
\f[I]call\f[]:Man page |
| 44 |
T{ |
| 45 |
.B SYS_SOCKET |
| 46 |
T}:T{ |
| 47 |
.BR socket (2) |
| 48 |
T} |
| 49 |
T{ |
| 50 |
.B SYS_BIND |
| 51 |
T}:T{ |
| 52 |
.BR bind (2) |
| 53 |
T} |
| 54 |
T{ |
| 55 |
.B SYS_CONNECT |
| 56 |
T}:T{ |
| 57 |
.BR connect (2) |
| 58 |
T} |
| 59 |
T{ |
| 60 |
.B SYS_LISTEN |
| 61 |
T}:T{ |
| 62 |
.BR listen (2) |
| 63 |
T} |
| 64 |
T{ |
| 65 |
.B SYS_ACCEPT |
| 66 |
T}:T{ |
| 67 |
.BR accept (2) |
| 68 |
T} |
| 69 |
T{ |
| 70 |
.B SYS_GETSOCKNAME |
| 71 |
T}:T{ |
| 72 |
.BR getsockname (2) |
| 73 |
T} |
| 74 |
T{ |
| 75 |
.B SYS_GETPEERNAME |
| 76 |
T}:T{ |
| 77 |
.BR getpeername (2) |
| 78 |
T} |
| 79 |
T{ |
| 80 |
.B SYS_SOCKETPAIR |
| 81 |
T}:T{ |
| 82 |
.BR socketpair (2) |
| 83 |
T} |
| 84 |
T{ |
| 85 |
.B SYS_SEND |
| 86 |
T}:T{ |
| 87 |
.BR send (2) |
| 88 |
T} |
| 89 |
T{ |
| 90 |
.B SYS_RECV |
| 91 |
T}:T{ |
| 92 |
.BR recv (2) |
| 93 |
T} |
| 94 |
T{ |
| 95 |
.B SYS_SENDTO |
| 96 |
T}:T{ |
| 97 |
.BR sendto (2) |
| 98 |
T} |
| 99 |
T{ |
| 100 |
.B SYS_RECVFROM |
| 101 |
T}:T{ |
| 102 |
.BR recvfrom (2) |
| 103 |
T} |
| 104 |
T{ |
| 105 |
.B SYS_SHUTDOWN |
| 106 |
T}:T{ |
| 107 |
.BR shutdown (2) |
| 108 |
T} |
| 109 |
T{ |
| 110 |
.B SYS_SETSOCKOPT |
| 111 |
T}:T{ |
| 112 |
.BR setsockopt (2) |
| 113 |
T} |
| 114 |
T{ |
| 115 |
.B SYS_GETSOCKOPT |
| 116 |
T}:T{ |
| 117 |
.BR getsockopt (2) |
| 118 |
T} |
| 119 |
T{ |
| 120 |
.B SYS_SENDMSG |
| 121 |
T}:T{ |
| 122 |
.BR sendmsg (2) |
| 123 |
T} |
| 124 |
T{ |
| 125 |
.B SYS_RECVMSG |
| 126 |
T}:T{ |
| 127 |
.BR recvmsg (2) |
| 128 |
T} |
| 129 |
T{ |
| 130 |
.B SYS_ACCEPT4 |
| 131 |
T}:T{ |
| 132 |
.BR accept4 (2) |
| 133 |
T} |
| 134 |
T{ |
| 135 |
.B SYS_RECVMMSG |
| 136 |
T}:T{ |
| 137 |
.BR recvmmsg (2) |
| 138 |
T} |
| 139 |
T{ |
| 140 |
.B SYS_SENDMMSG |
| 141 |
T}:T{ |
| 142 |
.BR sendmmsg (2) |
| 143 |
T} |
| 144 |
.TE |
| 145 |
.SH VERSIONS |
| 146 |
On some architectures |
| 147 |
\[em]for example, x86-64 and ARM\[em] |
| 148 |
there is no |
| 149 |
.BR socketcall () |
| 150 |
system call; |
| 151 |
instead |
| 152 |
.BR socket (2), |
| 153 |
.BR accept (2), |
| 154 |
.BR bind (2), |
| 155 |
and so on really are implemented as separate system calls. |
| 156 |
.SH STANDARDS |
| 157 |
Linux. |
| 158 |
.P |
| 159 |
On x86-32, |
| 160 |
.BR socketcall () |
| 161 |
was historically the only entry point for the sockets API. |
| 162 |
However, starting in Linux 4.3, |
| 163 |
.\" commit 9dea5dc921b5f4045a18c63eb92e84dc274d17eb |
| 164 |
direct system calls are provided on x86-32 for the sockets API. |
| 165 |
This facilitates the creation of |
| 166 |
.BR seccomp (2) |
| 167 |
filters that filter sockets system calls |
| 168 |
(for new user-space binaries that are compiled |
| 169 |
to use the new entry points) |
| 170 |
and also provides a (very) small performance improvement. |
| 171 |
.SH SEE ALSO |
| 172 |
.BR accept (2), |
| 173 |
.BR bind (2), |
| 174 |
.BR connect (2), |
| 175 |
.BR getpeername (2), |
| 176 |
.BR getsockname (2), |
| 177 |
.BR getsockopt (2), |
| 178 |
.BR listen (2), |
| 179 |
.BR recv (2), |
| 180 |
.BR recvfrom (2), |
| 181 |
.BR recvmsg (2), |
| 182 |
.BR send (2), |
| 183 |
.BR sendmsg (2), |
| 184 |
.BR sendto (2), |
| 185 |
.BR setsockopt (2), |
| 186 |
.BR shutdown (2), |
| 187 |
.BR socket (2), |
| 188 |
.BR socketpair (2) |