readv2: Note preadv2(..., RWF_NOWAIT) bug in BUGS section
[man-pages.git] / man2 / socketcall.2
blobb39f61039be446803a6631f9e5e2c97a0ebc697e
1 .\" Copyright (c) 1995 Michael Chastain (mec@shell.portal.com), 15 April 1995.
2 .\"
3 .\" %%%LICENSE_START(GPLv2+_DOC_FULL)
4 .\" This is free documentation; you can redistribute it and/or
5 .\" modify it under the terms of the GNU General Public License as
6 .\" published by the Free Software Foundation; either version 2 of
7 .\" the License, or (at your option) any later version.
8 .\"
9 .\" The GNU General Public License's references to "object code"
10 .\" and "executables" are to be interpreted as the output of any
11 .\" document formatting or typesetting system, including
12 .\" intermediate and printed output.
13 .\"
14 .\" This manual is distributed in the hope that it will be useful,
15 .\" but WITHOUT ANY WARRANTY; without even the implied warranty of
16 .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 .\" GNU General Public License for more details.
18 .\"
19 .\" You should have received a copy of the GNU General Public
20 .\" License along with this manual; if not, see
21 .\" <http://www.gnu.org/licenses/>.
22 .\" %%%LICENSE_END
23 .\"
24 .\" Modified Tue Oct 22 22:11:53 1996 by Eric S. Raymond <esr@thyrsus.com>
25 .TH SOCKETCALL 2 2021-03-22 "Linux" "Linux Programmer's Manual"
26 .SH NAME
27 socketcall \- socket system calls
28 .SH SYNOPSIS
29 .nf
30 .BR "#include <linux/net.h>" "        /* Definition of " SYS_* " constants */"
31 .BR "#include <sys/syscall.h>" "      /* Definition of " SYS_socketcall " */"
32 .B #include <unistd.h>
33 .PP
34 .BI "int syscall(SYS_socketcall, int " call ", unsigned long *" args );
35 .fi
36 .PP
37 .IR Note :
38 glibc provides no wrapper for
39 .BR socketcall (),
40 necessitating the use of
41 .BR syscall (2).
42 .SH DESCRIPTION
43 .BR socketcall ()
44 is a common kernel entry point for the socket system calls.
45 .I call
46 determines which socket function to invoke.
47 .I args
48 points to a block containing the actual arguments,
49 which are passed through to the appropriate call.
50 .PP
51 User programs should call the appropriate functions by their usual names.
52 Only standard library implementors and kernel hackers need to know about
53 .BR socketcall ().
54 .PP
55 .TS
56 tab(:);
57 l l.
58 \fIcall\fR:Man page
60 .B SYS_SOCKET
61 T}:T{
62 .BR socket (2)
65 .B SYS_BIND
66 T}:T{
67 .BR bind (2)
70 .B SYS_CONNECT
71 T}:T{
72 .BR connect (2)
75 .B SYS_LISTEN
76 T}:T{
77 .BR listen (2)
80 .B SYS_ACCEPT
81 T}:T{
82 .BR accept (2)
85 .B SYS_GETSOCKNAME
86 T}:T{
87 .BR getsockname (2)
90 .B SYS_GETPEERNAME
91 T}:T{
92 .BR getpeername (2)
95 .B SYS_SOCKETPAIR
96 T}:T{
97 .BR socketpair (2)
100 .B SYS_SEND
101 T}:T{
102 .BR send (2)
105 .B SYS_RECV
106 T}:T{
107 .BR recv (2)
110 .B SYS_SENDTO
111 T}:T{
112 .BR sendto (2)
115 .B SYS_RECVFROM
116 T}:T{
117 .BR recvfrom (2)
120 .B SYS_SHUTDOWN
121 T}:T{
122 .BR shutdown (2)
125 .B SYS_SETSOCKOPT
126 T}:T{
127 .BR setsockopt (2)
130 .B SYS_GETSOCKOPT
131 T}:T{
132 .BR getsockopt (2)
135 .B SYS_SENDMSG
136 T}:T{
137 .BR sendmsg (2)
140 .B SYS_RECVMSG
141 T}:T{
142 .BR recvmsg (2)
145 .B SYS_ACCEPT4
146 T}:T{
147 .BR accept4 (2)
150 .B SYS_RECVMMSG
151 T}:T{
152 .BR recvmmsg (2)
155 .B SYS_SENDMMSG
156 T}:T{
157 .BR sendmmsg (2)
160 .SH CONFORMING TO
161 This call is specific to Linux, and should not be used in programs
162 intended to be portable.
163 .SH NOTES
164 On some architectures\(emfor example, x86-64 and ARM\(emthere is no
165 .BR socketcall ()
166 system call; instead
167 .BR socket (2),
168 .BR accept (2),
169 .BR bind (2),
170 and so on really are implemented as separate system calls.
172 On x86-32,
173 .BR socketcall ()
174 was historically the only entry point for the sockets API.
175 However, starting in Linux 4.3,
176 .\" commit 9dea5dc921b5f4045a18c63eb92e84dc274d17eb
177 direct system calls are provided on x86-32 for the sockets API.
178 This facilitates the creation of
179 .BR seccomp (2)
180 filters that filter sockets system calls
181 (for new user-space binaries that are compiled
182 to use the new entry points)
183 and also provides a (very) small performance improvement.
184 .SH SEE ALSO
185 .BR accept (2),
186 .BR bind (2),
187 .BR connect (2),
188 .BR getpeername (2),
189 .BR getsockname (2),
190 .BR getsockopt (2),
191 .BR listen (2),
192 .BR recv (2),
193 .BR recvfrom (2),
194 .BR recvmsg (2),
195 .BR send (2),
196 .BR sendmsg (2),
197 .BR sendto (2),
198 .BR setsockopt (2),
199 .BR shutdown (2),
200 .BR socket (2),
201 .BR socketpair (2)