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