xref: /titanic_51/usr/src/uts/common/sys/socket.h (revision 34de876298c5177ddeb98f3af7e4e3012f16e2a7)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 /*	Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T	*/
27 /*	  All Rights Reserved	*/
28 
29 /*
30  * University Copyright- Copyright (c) 1982, 1986, 1988
31  * The Regents of the University of California
32  * All Rights Reserved
33  *
34  * University Acknowledgment- Portions of this document are derived from
35  * software developed by the University of California, Berkeley, and its
36  * contributors.
37  */
38 
39 #ifndef	_SYS_SOCKET_H
40 #define	_SYS_SOCKET_H
41 
42 #include <sys/types.h>
43 #include <sys/uio.h>
44 #include <sys/feature_tests.h>
45 #include <sys/socket_impl.h>
46 #if !defined(_XPG4_2) || defined(__EXTENSIONS__)
47 #ifndef	_KERNEL
48 #include <sys/netconfig.h>
49 #endif	/* !_KERNEL */
50 #include <netinet/in.h>
51 #endif	/* !defined(_XPG4_2) || defined(__EXTENSIONS__) */
52 
53 #ifdef	__cplusplus
54 extern "C" {
55 #endif
56 
57 #ifndef	_SOCKLEN_T
58 #define	_SOCKLEN_T
59 
60 /*
61  * The socklen definitions are reproduced in netinet/in.h for the inet6_
62  * functions.  Exposing all of sys/socket.h via netinet/in.h breaks existing
63  * applications and is not required by austin.
64  */
65 #if defined(_XPG4_2) && !defined(_XPG5) && !defined(_LP64)
66 typedef	size_t		socklen_t;
67 #else
68 typedef	uint32_t	socklen_t;
69 #endif	/* defined(_XPG4_2) && !defined(_XPG5) && !defined(_LP64) */
70 
71 #if defined(_XPG4_2) || defined(_BOOT)
72 typedef	socklen_t	*_RESTRICT_KYWD Psocklen_t;
73 #else
74 typedef	void		*_RESTRICT_KYWD Psocklen_t;
75 #endif	/* defined(_XPG4_2) || defined(_BOOT) */
76 
77 #endif	/* _SOCKLEN_T */
78 
79 /*
80  * Definitions related to sockets: types, address families, options.
81  */
82 #if !defined(_XPG4_2) || defined(__EXTENSIONS__)
83 #ifndef	NC_TPI_CLTS
84 #define	NC_TPI_CLTS	1		/* must agree with netconfig.h */
85 #define	NC_TPI_COTS	2		/* must agree with netconfig.h */
86 #define	NC_TPI_COTS_ORD	3		/* must agree with netconfig.h */
87 #define	NC_TPI_RAW	4		/* must agree with netconfig.h */
88 #endif	/* !NC_TPI_CLTS */
89 #endif	/* !defined(_XPG4_2) || defined(__EXTENSIONS__) */
90 
91 /*
92  * Types
93  */
94 #if !defined(_XPG4_2) || defined(__EXTENSIONS__)
95 #define	SOCK_STREAM	NC_TPI_COTS	/* stream socket */
96 #define	SOCK_DGRAM	NC_TPI_CLTS	/* datagram socket */
97 #define	SOCK_RAW	NC_TPI_RAW	/* raw-protocol interface */
98 #else
99 #define	SOCK_STREAM	2		/* stream socket */
100 #define	SOCK_DGRAM	1		/* datagram socket */
101 #define	SOCK_RAW	4		/* raw-protocol interface */
102 #endif	/* !defined(_XPG4_2) || defined(__EXTENSIONS__) */
103 #define	SOCK_RDM	5		/* reliably-delivered message */
104 #define	SOCK_SEQPACKET	6		/* sequenced packet stream */
105 
106 /*
107  * Option flags per-socket.
108  */
109 #define	SO_DEBUG	0x0001		/* turn on debugging info recording */
110 #define	SO_ACCEPTCONN	0x0002		/* socket has had listen() */
111 #define	SO_REUSEADDR	0x0004		/* allow local address reuse */
112 #define	SO_KEEPALIVE	0x0008		/* keep connections alive */
113 #define	SO_DONTROUTE	0x0010		/* just use interface addresses */
114 #define	SO_BROADCAST	0x0020		/* permit sending of broadcast msgs */
115 #define	SO_USELOOPBACK	0x0040		/* bypass hardware when possible */
116 #define	SO_LINGER	0x0080		/* linger on close if data present */
117 #define	SO_OOBINLINE	0x0100		/* leave received OOB data in line */
118 #define	SO_DGRAM_ERRIND	0x0200		/* Application wants delayed error */
119 #define	SO_RECVUCRED	0x0400		/* Application wants ucred of sender */
120 
121 /*
122  * Socket options are passed using a signed integer, but it is also rare
123  * for more than one to ever be passed at the same time with setsockopt
124  * and only one at a time can be retrieved with getsockopt.
125  *
126  * Since the lower numbers cannot be renumbered for compatibility reasons,
127  * it would seem that we need to start a new number space (0x40000000 -
128  * 0x7fffffff) for those that don't need to be stored as a bit flag
129  * somewhere. This limits the flag options to 30 but that seems to be
130  * plenty, anyway. 0x40000000 is reserved for future use.
131  */
132 #define	SO_ATTACH_FILTER	0x40000001
133 #define	SO_DETACH_FILTER	0x40000002
134 
135 #ifdef _KERNEL
136 #define	SO_SND_COPYAVOID 0x0800		/* Internal: use zero-copy */
137 #define	SO_SND_BUFINFO	0x1000		/* Internal: get buffer info */
138 					/* when doing zero-copy */
139 
140 struct so_snd_bufinfo {
141 	ushort_t	sbi_wroff; 	/* Write offset */
142 	ssize_t		sbi_maxblk;	/* Max size of a single mblk */
143 	ssize_t		sbi_maxpsz;	/* Max total size of a mblk chain */
144 	ushort_t	sbi_tail;	/* Extra space available at the end */
145 };
146 #endif /* _KERNEL */
147 
148 /*
149  * N.B.: The following definition is present only for compatibility
150  * with release 3.0.  It will disappear in later releases.
151  */
152 #define	SO_DONTLINGER	(~SO_LINGER)	/* ~SO_LINGER */
153 
154 /*
155  * Additional options, not kept in so_options.
156  */
157 #define	SO_SNDBUF	0x1001		/* send buffer size */
158 #define	SO_RCVBUF	0x1002		/* receive buffer size */
159 #define	SO_SNDLOWAT	0x1003		/* send low-water mark */
160 #define	SO_RCVLOWAT	0x1004		/* receive low-water mark */
161 #define	SO_SNDTIMEO	0x1005		/* send timeout */
162 #define	SO_RCVTIMEO	0x1006		/* receive timeout */
163 #define	SO_ERROR	0x1007		/* get error status and clear */
164 #define	SO_TYPE		0x1008		/* get socket type */
165 #define	SO_PROTOTYPE	0x1009		/* get/set protocol type */
166 #define	SO_ANON_MLP	0x100a		/* create MLP on anonymous bind */
167 #define	SO_MAC_EXEMPT	0x100b		/* allow dominated unlabeled peers */
168 #define	SO_DOMAIN	0x100c		/* get socket domain */
169 #define	SO_RCVPSH	0x100d		/* receive interval to push data */
170 
171 /* "Socket"-level control message types: */
172 #define	SCM_RIGHTS	0x1010		/* access rights (array of int) */
173 #define	SO_SECATTR	0x1011		/* socket's security attributes */
174 #define	SCM_UCRED	0x1012		/* sender's ucred */
175 #define	SO_TIMESTAMP	0x1013		/* socket-level timestamp option */
176 #define	SCM_TIMESTAMP	SO_TIMESTAMP	/* socket control message timestamp */
177 #define	SO_ALLZONES	0x1014		/* bind in all zones */
178 #define	SO_EXCLBIND	0x1015		/* exclusive binding */
179 #define	SO_MAC_IMPLICIT	0x1016		/* hide mac labels on wire */
180 #define	SO_VRRP		0x1017		/* VRRP control socket */
181 
182 #ifdef	_KERNEL
183 #define	SO_SRCADDR	0x2001		/* Internal: AF_UNIX source address */
184 #define	SO_FILEP	0x2002		/* Internal: AF_UNIX file pointer */
185 #define	SO_UNIX_CLOSE	0x2003		/* Internal: AF_UNIX peer closed */
186 #endif	/* _KERNEL */
187 
188 #ifdef	_KERNEL
189 /*
190  * new socket open flags to identify socket and acceptor streams
191  */
192 #define	SO_ACCEPTOR	0x20000		/* acceptor socket */
193 #define	SO_SOCKSTR	0x40000		/* normal socket stream */
194 #define	SO_FALLBACK	0x80000		/* fallback to TPI socket */
195 
196 /*
197  * Flags for socket_create() and socket_newconn()
198  */
199 #define	SOCKET_SLEEP	KM_SLEEP
200 #define	SOCKET_NOSLEEP	KM_NOSLEEP
201 
202 
203 /*
204  * flags used by sockfs when falling back to tpi socket
205  */
206 #define	SO_FB_START	0x1
207 #define	SO_FB_FINISH	0x2
208 
209 #endif	/* _KERNEL */
210 
211 /*
212  * Structure used for manipulating linger option.
213  */
214 struct	linger {
215 	int	l_onoff;		/* option on/off */
216 	int	l_linger;		/* linger time */
217 };
218 
219 /*
220  * Levels for (get/set)sockopt() that don't apply to a specific protocol.
221  */
222 #define	SOL_SOCKET	0xffff		/* options for socket level */
223 #if !defined(_XPG4_2) || defined(__EXTENSIONS__)
224 #define	SOL_ROUTE	0xfffe		/* options for routing socket level */
225 #endif
226 #define	SOL_PACKET	0xfffd		/* options for packet level */
227 
228 /*
229  * Address families.
230  *
231  * Some of these constant names are copied for the DTrace IP provider in
232  * usr/src/lib/libdtrace/common/{ip.d.in, ip.sed.in}, which should be kept
233  * in sync.
234  */
235 #define	AF_UNSPEC	0		/* unspecified */
236 #define	AF_UNIX		1		/* local to host (pipes, portals) */
237 #define	AF_LOCAL	AF_UNIX		/* Synonym for AF_UNIX */
238 #define	AF_FILE		AF_UNIX		/* Synonym for AF_UNIX */
239 #define	AF_INET		2		/* internetwork: UDP, TCP, etc. */
240 #define	AF_IMPLINK	3		/* arpanet imp addresses */
241 #define	AF_PUP		4		/* pup protocols: e.g. BSP */
242 #define	AF_CHAOS	5		/* mit CHAOS protocols */
243 #define	AF_NS		6		/* XEROX NS protocols */
244 #define	AF_NBS		7		/* nbs protocols */
245 #define	AF_ECMA		8		/* european computer manufacturers */
246 #define	AF_DATAKIT	9		/* datakit protocols */
247 #define	AF_CCITT	10		/* CCITT protocols, X.25 etc */
248 #define	AF_SNA		11		/* IBM SNA */
249 #define	AF_DECnet	12		/* DECnet */
250 #define	AF_DLI		13		/* Direct data link interface */
251 #define	AF_LAT		14		/* LAT */
252 #define	AF_HYLINK	15		/* NSC Hyperchannel */
253 #define	AF_APPLETALK	16		/* Apple Talk */
254 #define	AF_NIT		17		/* Network Interface Tap */
255 #define	AF_802		18		/* IEEE 802.2, also ISO 8802 */
256 #define	AF_OSI		19		/* umbrella for all families used */
257 #define	AF_X25		20		/* CCITT X.25 in particular */
258 #define	AF_OSINET	21		/* AFI = 47, IDI = 4 */
259 #define	AF_GOSIP	22		/* U.S. Government OSI */
260 #define	AF_IPX		23		/* Novell Internet Protocol */
261 #define	AF_ROUTE	24		/* Internal Routing Protocol */
262 #define	AF_LINK		25		/* Link-layer interface */
263 #define	AF_INET6	26		/* Internet Protocol, Version 6 */
264 #define	AF_KEY		27		/* Security Association DB socket */
265 #define	AF_NCA		28		/* NCA socket */
266 #define	AF_POLICY	29		/* Security Policy DB socket */
267 #define	AF_INET_OFFLOAD	30		/* Sun private; do not use */
268 #define	AF_TRILL	31		/* TRILL interface */
269 #define	AF_PACKET	32		/* PF_PACKET Linux socket interface */
270 
271 #define	AF_MAX		32
272 
273 /*
274  * Protocol families, same as address families for now.
275  */
276 #define	PF_UNSPEC	AF_UNSPEC
277 #define	PF_UNIX		AF_UNIX
278 #define	PF_LOCAL	PF_UNIX
279 #define	PF_FILE		PF_UNIX
280 #define	PF_INET		AF_INET
281 #define	PF_IMPLINK	AF_IMPLINK
282 #define	PF_PUP		AF_PUP
283 #define	PF_CHAOS	AF_CHAOS
284 #define	PF_NS		AF_NS
285 #define	PF_NBS		AF_NBS
286 #define	PF_ECMA		AF_ECMA
287 #define	PF_DATAKIT	AF_DATAKIT
288 #define	PF_CCITT	AF_CCITT
289 #define	PF_SNA		AF_SNA
290 #define	PF_DECnet	AF_DECnet
291 #define	PF_DLI		AF_DLI
292 #define	PF_LAT		AF_LAT
293 #define	PF_HYLINK	AF_HYLINK
294 #define	PF_APPLETALK	AF_APPLETALK
295 #define	PF_NIT		AF_NIT
296 #define	PF_802		AF_802
297 #define	PF_OSI		AF_OSI
298 #define	PF_X25		AF_X25
299 #define	PF_OSINET	AF_OSINET
300 #define	PF_GOSIP	AF_GOSIP
301 #define	PF_IPX		AF_IPX
302 #define	PF_ROUTE	AF_ROUTE
303 #define	PF_LINK		AF_LINK
304 #define	PF_INET6	AF_INET6
305 #define	PF_KEY		AF_KEY
306 #define	PF_NCA		AF_NCA
307 #define	PF_POLICY	AF_POLICY
308 #define	PF_INET_OFFLOAD	AF_INET_OFFLOAD	/* Sun private; do not use */
309 #define	PF_TRILL	AF_TRILL
310 #define	PF_PACKET	AF_PACKET
311 
312 #define	PF_MAX		AF_MAX
313 
314 /*
315  * Maximum queue length specifiable by listen.
316  */
317 #define	SOMAXCONN	128
318 
319 /*
320  * Message header for recvmsg and sendmsg calls.
321  */
322 struct msghdr {
323 	void		*msg_name;		/* optional address */
324 	socklen_t	msg_namelen;		/* size of address */
325 	struct iovec	*msg_iov;		/* scatter/gather array */
326 	int		msg_iovlen;		/* # elements in msg_iov */
327 
328 #if defined(_XPG4_2) || defined(_KERNEL)
329 	void		*msg_control;		/* ancillary data */
330 	socklen_t	msg_controllen;		/* ancillary data buffer len */
331 	int		msg_flags;		/* flags on received message */
332 #else
333 	caddr_t		msg_accrights;	/* access rights sent/received */
334 	int		msg_accrightslen;
335 #endif	/* defined(_XPG4_2) || defined(_KERNEL) */
336 };
337 
338 #if	defined(_KERNEL)
339 
340 /*
341  *	N.B.:  we assume that omsghdr and nmsghdr are isomorphic, with
342  *	the sole exception that nmsghdr has the additional msg_flags
343  *	field at the end.
344  */
345 struct omsghdr {
346 	void		*msg_name;	/* optional address */
347 	socklen_t	msg_namelen;	/* size of address */
348 	struct	iovec	*msg_iov;	/* scatter/gather array */
349 	int		msg_iovlen;	/* # elements in msg_iov */
350 	caddr_t		msg_accrights;	/* access rights sent/received */
351 	int		msg_accrightslen;
352 };
353 
354 #define	nmsghdr		msghdr
355 
356 #if defined(_SYSCALL32)
357 
358 struct omsghdr32 {
359 	caddr32_t	msg_name;	/* optional address */
360 	uint32_t	msg_namelen;	/* size of address */
361 	caddr32_t	msg_iov;	/* scatter/gather array */
362 	int32_t		msg_iovlen;	/* # elements in msg_iov */
363 	caddr32_t	msg_accrights;	/* access rights sent/received */
364 	uint32_t	msg_accrightslen;
365 };
366 
367 struct msghdr32 {
368 	caddr32_t	msg_name;	/* optional address */
369 	uint32_t	msg_namelen;	/* size of address */
370 	caddr32_t	msg_iov;	/* scatter/gather array */
371 	int32_t		msg_iovlen;	/* # elements in msg_iov */
372 	caddr32_t	msg_control;	/* ancillary data */
373 	uint32_t	msg_controllen;	/* ancillary data buffer len */
374 	int32_t		msg_flags;	/* flags on received message */
375 };
376 
377 #define	nmsghdr32	msghdr32
378 
379 #endif	/* _SYSCALL32 */
380 #endif	/* _KERNEL */
381 
382 #define	MSG_OOB		0x1		/* process out-of-band data */
383 #define	MSG_PEEK	0x2		/* peek at incoming message */
384 #define	MSG_DONTROUTE	0x4		/* send without using routing tables */
385 /* Added for XPGv2 compliance */
386 #define	MSG_EOR		0x8		/* Terminates a record */
387 #define	MSG_CTRUNC	0x10		/* Control data truncated */
388 #define	MSG_TRUNC	0x20		/* Normal data truncated */
389 #define	MSG_WAITALL	0x40		/* Wait for complete recv or error */
390 #define	MSG_DUPCTRL	0x800		/* Save control message for use with */
391 					/* with left over data */
392 /* End of XPGv2 compliance */
393 #define	MSG_DONTWAIT	0x80		/* Don't block for this recv */
394 #define	MSG_NOTIFICATION 0x100		/* Notification, not data */
395 #define	MSG_XPG4_2	0x8000		/* Private: XPG4.2 flag */
396 
397 #define	MSG_MAXIOVLEN	16
398 
399 #ifdef _KERNEL
400 
401 /*
402  * for kernel socket only
403  */
404 #define	MSG_MBLK_QUICKRELE	0x10000000	/* free mblk chain */
405 						/* in timely manner */
406 #define	MSG_USERSPACE		0x20000000	/* buffer from user space */
407 
408 #endif /* _KERNEL */
409 
410 
411 /* Added for XPGv2 compliance */
412 #define	SHUT_RD		0
413 #define	SHUT_WR		1
414 #define	SHUT_RDWR	2
415 
416 struct cmsghdr {
417 	socklen_t	cmsg_len;	/* data byte count, including hdr */
418 	int		cmsg_level;	/* originating protocol */
419 	int		cmsg_type;	/* protocol-specific type */
420 };
421 
422 #if defined(_XPG4_2) || defined(_KERNEL)
423 #if defined(__sparc)
424 /* To maintain backward compatibility, alignment needs to be 8 on sparc. */
425 #define	_CMSG_HDR_ALIGNMENT	8
426 #else
427 /* for __i386 (and other future architectures) */
428 #define	_CMSG_HDR_ALIGNMENT	4
429 #endif	/* defined(__sparc) */
430 #endif	/* defined(_XPG4_2) || defined(_KERNEL) */
431 
432 #if defined(_XPG4_2)
433 /*
434  * The cmsg headers (and macros dealing with them) were made available as
435  * part of UNIX95 and hence need to be protected with a _XPG4_2 define.
436  */
437 #define	_CMSG_DATA_ALIGNMENT	(sizeof (int))
438 #define	_CMSG_HDR_ALIGN(x)	(((uintptr_t)(x) + _CMSG_HDR_ALIGNMENT - 1) & \
439 				    ~(_CMSG_HDR_ALIGNMENT - 1))
440 #define	_CMSG_DATA_ALIGN(x)	(((uintptr_t)(x) + _CMSG_DATA_ALIGNMENT - 1) & \
441 				    ~(_CMSG_DATA_ALIGNMENT - 1))
442 #define	CMSG_DATA(c)							\
443 	((unsigned char *)_CMSG_DATA_ALIGN((struct cmsghdr *)(c) + 1))
444 
445 #define	CMSG_FIRSTHDR(m)						\
446 	(((m)->msg_controllen < sizeof (struct cmsghdr)) ?		\
447 	    (struct cmsghdr *)0 : (struct cmsghdr *)((m)->msg_control))
448 
449 #define	CMSG_NXTHDR(m, c)						\
450 	(((c) == 0) ? CMSG_FIRSTHDR(m) :			\
451 	((((uintptr_t)_CMSG_HDR_ALIGN((char *)(c) +			\
452 	((struct cmsghdr *)(c))->cmsg_len) + sizeof (struct cmsghdr)) >	\
453 	(((uintptr_t)((struct msghdr *)(m))->msg_control) +		\
454 	((uintptr_t)((struct msghdr *)(m))->msg_controllen))) ?		\
455 	((struct cmsghdr *)0) :						\
456 	((struct cmsghdr *)_CMSG_HDR_ALIGN((char *)(c) +		\
457 	    ((struct cmsghdr *)(c))->cmsg_len))))
458 
459 /* Amount of space + padding needed for a message of length l */
460 #define	CMSG_SPACE(l)							\
461 	((unsigned int)_CMSG_HDR_ALIGN(sizeof (struct cmsghdr) + (l)))
462 
463 /* Value to be used in cmsg_len, does not include trailing padding */
464 #define	CMSG_LEN(l)							\
465 	((unsigned int)_CMSG_DATA_ALIGN(sizeof (struct cmsghdr)) + (l))
466 
467 #endif	/* _XPG4_2 */
468 
469 #ifdef	_XPG4_2
470 #ifdef	__PRAGMA_REDEFINE_EXTNAME
471 #pragma redefine_extname bind __xnet_bind
472 #pragma redefine_extname connect __xnet_connect
473 #pragma redefine_extname recvmsg __xnet_recvmsg
474 #pragma redefine_extname sendmsg __xnet_sendmsg
475 #pragma redefine_extname sendto __xnet_sendto
476 #pragma redefine_extname socket __xnet_socket
477 #pragma redefine_extname socketpair __xnet_socketpair
478 #pragma redefine_extname getsockopt __xnet_getsockopt
479 #else	/* __PRAGMA_REDEFINE_EXTNAME */
480 #define	bind	__xnet_bind
481 #define	connect	__xnet_connect
482 #define	recvmsg	__xnet_recvmsg
483 #define	sendmsg	__xnet_sendmsg
484 #define	sendto	__xnet_sendto
485 #define	socket	__xnet_socket
486 #define	socketpair	__xnet_socketpair
487 #define	getsockopt	__xnet_getsockopt
488 #endif	/* __PRAGMA_REDEFINE_EXTNAME */
489 
490 #endif	/* _XPG4_2 */
491 
492 #if defined(_XPG4_2) && !defined(_XPG5)
493 #ifdef	__PRAGMA_REDEFINE_EXTNAME
494 #pragma redefine_extname listen __xnet_listen
495 #else	/* __PRAGMA_REDEFINE_EXTNAME */
496 #define	listen	__xnet_listen
497 #endif	/* __PRAGMA_REDEFINE_EXTNAME */
498 #endif /* (_XPG4_2) && !defined(_XPG5) */
499 
500 #if !defined(_KERNEL) || defined(_BOOT)
501 #ifdef	__STDC__
502 extern int accept(int, struct sockaddr *_RESTRICT_KYWD, Psocklen_t);
503 extern int bind(int, const struct sockaddr *, socklen_t);
504 extern int connect(int, const struct sockaddr *, socklen_t);
505 extern int getpeername(int, struct sockaddr *_RESTRICT_KYWD, Psocklen_t);
506 extern int getsockname(int, struct sockaddr *_RESTRICT_KYWD, Psocklen_t);
507 extern int getsockopt(int, int, int, void *_RESTRICT_KYWD, Psocklen_t);
508 extern int listen(int, int);	/* XXX - fixme???  where do I go */
509 extern int socketpair(int, int, int, int *);
510 extern ssize_t recv(int, void *, size_t, int);
511 extern ssize_t recvfrom(int, void *_RESTRICT_KYWD, size_t, int,
512 	struct sockaddr *_RESTRICT_KYWD, Psocklen_t);
513 extern ssize_t recvmsg(int, struct msghdr *, int);
514 extern ssize_t send(int, const void *, size_t, int);
515 extern ssize_t sendmsg(int, const struct msghdr *, int);
516 extern ssize_t sendto(int, const void *, size_t, int, const struct sockaddr *,
517 	socklen_t);
518 extern int setsockopt(int, int, int, const void *, socklen_t);
519 extern int shutdown(int, int);
520 extern int socket(int, int, int);
521 
522 #if !defined(_XPG4_2) || defined(_XPG6) || defined(__EXTENSIONS__)
523 extern int sockatmark(int);
524 #endif /* !defined(_XPG4_2) || defined(_XPG6) || defined(__EXTENSIONS__) */
525 #else	/* __STDC__ */
526 extern int accept();
527 extern int bind();
528 extern int connect();
529 extern int getpeername();
530 extern int getsockname();
531 extern int getsockopt();
532 extern int listen();
533 extern int recv();
534 extern int recvfrom();
535 extern int send();
536 extern int sendto();
537 extern int setsockopt();
538 extern int sockatmark();
539 extern int socket();
540 extern int recvmsg();
541 extern int sendmsg();
542 extern int shutdown();
543 extern int socketpair();
544 #endif	/* __STDC__ */
545 #endif	/* !defined(_KERNEL) || defined(_BOOT) */
546 
547 #ifdef	__cplusplus
548 }
549 #endif
550 
551 #endif	/* _SYS_SOCKET_H */
552