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