| The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 1 | /* | 
|  | 2 | * Copyright (C) 2008 The Android Open Source Project | 
|  | 3 | * All rights reserved. | 
|  | 4 | * | 
|  | 5 | * Redistribution and use in source and binary forms, with or without | 
|  | 6 | * modification, are permitted provided that the following conditions | 
|  | 7 | * are met: | 
|  | 8 | *  * Redistributions of source code must retain the above copyright | 
|  | 9 | *    notice, this list of conditions and the following disclaimer. | 
|  | 10 | *  * Redistributions in binary form must reproduce the above copyright | 
|  | 11 | *    notice, this list of conditions and the following disclaimer in | 
|  | 12 | *    the documentation and/or other materials provided with the | 
|  | 13 | *    distribution. | 
|  | 14 | * | 
|  | 15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | 
|  | 16 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | 
|  | 17 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | 
|  | 18 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | 
|  | 19 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, | 
|  | 20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | 
|  | 21 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS | 
|  | 22 | * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED | 
|  | 23 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | 
|  | 24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT | 
|  | 25 | * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 
|  | 26 | * SUCH DAMAGE. | 
|  | 27 | */ | 
| Andrei Emeltchenko | 43d2137 | 2013-10-14 16:48:26 +0300 | [diff] [blame] | 28 |  | 
| The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 29 | #ifndef _SYS_SOCKET_H_ | 
|  | 30 | #define _SYS_SOCKET_H_ | 
|  | 31 |  | 
|  | 32 | #include <sys/cdefs.h> | 
|  | 33 | #include <sys/types.h> | 
| The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 34 |  | 
| Andrei Emeltchenko | 43d2137 | 2013-10-14 16:48:26 +0300 | [diff] [blame] | 35 | #include <asm/fcntl.h> | 
| Elliott Hughes | 86ec05a | 2012-09-11 19:03:02 -0700 | [diff] [blame] | 36 | #include <asm/socket.h> | 
|  | 37 | #include <linux/sockios.h> | 
|  | 38 | #include <linux/uio.h> | 
|  | 39 | #include <linux/types.h> | 
|  | 40 | #include <linux/compiler.h> | 
|  | 41 |  | 
| Elliott Hughes | 5850f6f | 2023-11-29 11:18:49 -0800 | [diff] [blame] | 42 | #include <bits/sockaddr_storage.h> | 
| Elliott Hughes | 508d292 | 2016-07-21 16:38:43 -0700 | [diff] [blame] | 43 | #include <bits/sa_family_t.h> | 
|  | 44 |  | 
| The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 45 | __BEGIN_DECLS | 
|  | 46 |  | 
| Elliott Hughes | a8b1eb3 | 2014-02-28 17:59:29 -0800 | [diff] [blame] | 47 | struct timespec; | 
|  | 48 |  | 
| Greg Hackmann | d75abb9 | 2015-08-25 17:45:46 -0700 | [diff] [blame] | 49 | #define SOCK_STREAM     1 | 
|  | 50 | #define SOCK_DGRAM      2 | 
| Raghu Gandham | 6437eac | 2012-08-02 16:50:10 -0700 | [diff] [blame] | 51 | #define SOCK_RAW        3 | 
|  | 52 | #define SOCK_RDM        4 | 
|  | 53 | #define SOCK_SEQPACKET  5 | 
|  | 54 | #define SOCK_DCCP       6 | 
|  | 55 | #define SOCK_PACKET     10 | 
| The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 56 |  | 
| Andrei Emeltchenko | 43d2137 | 2013-10-14 16:48:26 +0300 | [diff] [blame] | 57 | #define SOCK_CLOEXEC O_CLOEXEC | 
|  | 58 | #define SOCK_NONBLOCK O_NONBLOCK | 
|  | 59 |  | 
| The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 60 | enum { | 
| Andrei Emeltchenko | 43d2137 | 2013-10-14 16:48:26 +0300 | [diff] [blame] | 61 | SHUT_RD = 0, | 
| The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 62 | #define SHUT_RD         SHUT_RD | 
| Andrei Emeltchenko | 43d2137 | 2013-10-14 16:48:26 +0300 | [diff] [blame] | 63 | SHUT_WR, | 
| The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 64 | #define SHUT_WR         SHUT_WR | 
| Andrei Emeltchenko | 43d2137 | 2013-10-14 16:48:26 +0300 | [diff] [blame] | 65 | SHUT_RDWR | 
| The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 66 | #define SHUT_RDWR       SHUT_RDWR | 
|  | 67 | }; | 
|  | 68 |  | 
| Elliott Hughes | 86ec05a | 2012-09-11 19:03:02 -0700 | [diff] [blame] | 69 | struct sockaddr { | 
| Guillaume Ranquet | 6ff0c75 | 2014-02-10 13:11:29 +0100 | [diff] [blame] | 70 | sa_family_t sa_family; | 
|  | 71 | char sa_data[14]; | 
| Elliott Hughes | 86ec05a | 2012-09-11 19:03:02 -0700 | [diff] [blame] | 72 | }; | 
| The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 73 |  | 
| zijunzhao | 4e274fa | 2023-05-25 18:48:38 +0000 | [diff] [blame] | 74 | #pragma clang diagnostic push | 
|  | 75 | #pragma clang diagnostic ignored "-Wnullability-completeness" | 
| Colin Cross | d275067 | 2021-06-29 12:52:26 -0700 | [diff] [blame] | 76 |  | 
| Elliott Hughes | 86ec05a | 2012-09-11 19:03:02 -0700 | [diff] [blame] | 77 | struct linger { | 
| Guillaume Ranquet | 6ff0c75 | 2014-02-10 13:11:29 +0100 | [diff] [blame] | 78 | int l_onoff; | 
|  | 79 | int l_linger; | 
| Elliott Hughes | 86ec05a | 2012-09-11 19:03:02 -0700 | [diff] [blame] | 80 | }; | 
|  | 81 |  | 
|  | 82 | struct msghdr { | 
| Guillaume Ranquet | 6ff0c75 | 2014-02-10 13:11:29 +0100 | [diff] [blame] | 83 | void* msg_name; | 
|  | 84 | socklen_t msg_namelen; | 
|  | 85 | struct iovec* msg_iov; | 
|  | 86 | size_t msg_iovlen; | 
|  | 87 | void* msg_control; | 
|  | 88 | size_t msg_controllen; | 
|  | 89 | int msg_flags; | 
|  | 90 | }; | 
|  | 91 |  | 
|  | 92 | struct mmsghdr { | 
|  | 93 | struct msghdr msg_hdr; | 
|  | 94 | unsigned int msg_len; | 
| Elliott Hughes | 86ec05a | 2012-09-11 19:03:02 -0700 | [diff] [blame] | 95 | }; | 
|  | 96 |  | 
|  | 97 | struct cmsghdr { | 
| Guillaume Ranquet | 6ff0c75 | 2014-02-10 13:11:29 +0100 | [diff] [blame] | 98 | size_t cmsg_len; | 
|  | 99 | int cmsg_level; | 
|  | 100 | int cmsg_type; | 
| Elliott Hughes | 86ec05a | 2012-09-11 19:03:02 -0700 | [diff] [blame] | 101 | }; | 
|  | 102 |  | 
| zijunzhao | 4e274fa | 2023-05-25 18:48:38 +0000 | [diff] [blame] | 103 | #pragma clang diagnostic pop | 
|  | 104 |  | 
| Calin Juravle | 096b4eb | 2014-06-19 18:16:17 +0100 | [diff] [blame] | 105 | #define CMSG_NXTHDR(mhdr, cmsg) __cmsg_nxthdr((mhdr), (cmsg)) | 
| Elliott Hughes | 86ec05a | 2012-09-11 19:03:02 -0700 | [diff] [blame] | 106 | #define CMSG_ALIGN(len) ( ((len)+sizeof(long)-1) & ~(sizeof(long)-1) ) | 
| Dan Albert | 268af26 | 2015-09-11 09:47:27 -0700 | [diff] [blame] | 107 | #define CMSG_DATA(cmsg) (((unsigned char*)(cmsg) + CMSG_ALIGN(sizeof(struct cmsghdr)))) | 
| Elliott Hughes | 86ec05a | 2012-09-11 19:03:02 -0700 | [diff] [blame] | 108 | #define CMSG_SPACE(len) (CMSG_ALIGN(sizeof(struct cmsghdr)) + CMSG_ALIGN(len)) | 
|  | 109 | #define CMSG_LEN(len) (CMSG_ALIGN(sizeof(struct cmsghdr)) + (len)) | 
| Calin Juravle | f1de90b | 2014-03-19 17:40:23 +0000 | [diff] [blame] | 110 | #define CMSG_FIRSTHDR(msg) \ | 
|  | 111 | ((msg)->msg_controllen >= sizeof(struct cmsghdr) \ | 
|  | 112 | ? (struct cmsghdr*) (msg)->msg_control : (struct cmsghdr*) NULL) | 
| Guillaume Ranquet | 6ff0c75 | 2014-02-10 13:11:29 +0100 | [diff] [blame] | 113 | #define CMSG_OK(mhdr, cmsg) ((cmsg)->cmsg_len >= sizeof(struct cmsghdr) &&   (cmsg)->cmsg_len <= (unsigned long)   ((mhdr)->msg_controllen -   ((char*)(cmsg) - (char*)(mhdr)->msg_control))) | 
| Elliott Hughes | 86ec05a | 2012-09-11 19:03:02 -0700 | [diff] [blame] | 114 |  | 
| Elliott Hughes | 655e430 | 2023-06-16 12:39:33 -0700 | [diff] [blame] | 115 | struct cmsghdr* _Nullable __cmsg_nxthdr(struct msghdr* _Nonnull __msg, struct cmsghdr* _Nonnull __cmsg); | 
| Elliott Hughes | 86ec05a | 2012-09-11 19:03:02 -0700 | [diff] [blame] | 116 |  | 
| Elliott Hughes | 86ec05a | 2012-09-11 19:03:02 -0700 | [diff] [blame] | 117 | #define SCM_RIGHTS 0x01 | 
|  | 118 | #define SCM_CREDENTIALS 0x02 | 
|  | 119 | #define SCM_SECURITY 0x03 | 
|  | 120 |  | 
|  | 121 | struct ucred { | 
| Guillaume Ranquet | 6ff0c75 | 2014-02-10 13:11:29 +0100 | [diff] [blame] | 122 | pid_t pid; | 
|  | 123 | uid_t uid; | 
|  | 124 | gid_t gid; | 
| Elliott Hughes | 86ec05a | 2012-09-11 19:03:02 -0700 | [diff] [blame] | 125 | }; | 
|  | 126 |  | 
|  | 127 | #define AF_UNSPEC 0 | 
|  | 128 | #define AF_UNIX 1 | 
|  | 129 | #define AF_LOCAL 1 | 
|  | 130 | #define AF_INET 2 | 
|  | 131 | #define AF_AX25 3 | 
|  | 132 | #define AF_IPX 4 | 
|  | 133 | #define AF_APPLETALK 5 | 
|  | 134 | #define AF_NETROM 6 | 
|  | 135 | #define AF_BRIDGE 7 | 
|  | 136 | #define AF_ATMPVC 8 | 
|  | 137 | #define AF_X25 9 | 
|  | 138 | #define AF_INET6 10 | 
|  | 139 | #define AF_ROSE 11 | 
|  | 140 | #define AF_DECnet 12 | 
|  | 141 | #define AF_NETBEUI 13 | 
|  | 142 | #define AF_SECURITY 14 | 
|  | 143 | #define AF_KEY 15 | 
|  | 144 | #define AF_NETLINK 16 | 
|  | 145 | #define AF_ROUTE AF_NETLINK | 
|  | 146 | #define AF_PACKET 17 | 
|  | 147 | #define AF_ASH 18 | 
|  | 148 | #define AF_ECONET 19 | 
|  | 149 | #define AF_ATMSVC 20 | 
| Elliott Hughes | d73c0b3 | 2013-01-03 16:25:47 -0800 | [diff] [blame] | 150 | #define AF_RDS 21 | 
| Elliott Hughes | 86ec05a | 2012-09-11 19:03:02 -0700 | [diff] [blame] | 151 | #define AF_SNA 22 | 
|  | 152 | #define AF_IRDA 23 | 
|  | 153 | #define AF_PPPOX 24 | 
|  | 154 | #define AF_WANPIPE 25 | 
|  | 155 | #define AF_LLC 26 | 
| Elliott Hughes | d73c0b3 | 2013-01-03 16:25:47 -0800 | [diff] [blame] | 156 | #define AF_CAN 29 | 
| Elliott Hughes | 86ec05a | 2012-09-11 19:03:02 -0700 | [diff] [blame] | 157 | #define AF_TIPC 30 | 
|  | 158 | #define AF_BLUETOOTH 31 | 
| Elliott Hughes | d73c0b3 | 2013-01-03 16:25:47 -0800 | [diff] [blame] | 159 | #define AF_IUCV 32 | 
|  | 160 | #define AF_RXRPC 33 | 
|  | 161 | #define AF_ISDN 34 | 
|  | 162 | #define AF_PHONET 35 | 
|  | 163 | #define AF_IEEE802154 36 | 
|  | 164 | #define AF_CAIF 37 | 
|  | 165 | #define AF_ALG 38 | 
| Greg Hackmann | c7ca8f3 | 2016-01-28 11:07:26 -0800 | [diff] [blame] | 166 | #define AF_NFC 39 | 
|  | 167 | #define AF_VSOCK 40 | 
| Elliott Hughes | 8d76871 | 2016-12-13 15:29:58 -0800 | [diff] [blame] | 168 | #define AF_KCM 41 | 
|  | 169 | #define AF_QIPCRTR 42 | 
|  | 170 | #define AF_MAX 43 | 
| Elliott Hughes | 86ec05a | 2012-09-11 19:03:02 -0700 | [diff] [blame] | 171 |  | 
|  | 172 | #define PF_UNSPEC AF_UNSPEC | 
|  | 173 | #define PF_UNIX AF_UNIX | 
|  | 174 | #define PF_LOCAL AF_LOCAL | 
|  | 175 | #define PF_INET AF_INET | 
|  | 176 | #define PF_AX25 AF_AX25 | 
|  | 177 | #define PF_IPX AF_IPX | 
|  | 178 | #define PF_APPLETALK AF_APPLETALK | 
|  | 179 | #define PF_NETROM AF_NETROM | 
|  | 180 | #define PF_BRIDGE AF_BRIDGE | 
|  | 181 | #define PF_ATMPVC AF_ATMPVC | 
|  | 182 | #define PF_X25 AF_X25 | 
|  | 183 | #define PF_INET6 AF_INET6 | 
|  | 184 | #define PF_ROSE AF_ROSE | 
|  | 185 | #define PF_DECnet AF_DECnet | 
|  | 186 | #define PF_NETBEUI AF_NETBEUI | 
|  | 187 | #define PF_SECURITY AF_SECURITY | 
|  | 188 | #define PF_KEY AF_KEY | 
|  | 189 | #define PF_NETLINK AF_NETLINK | 
|  | 190 | #define PF_ROUTE AF_ROUTE | 
|  | 191 | #define PF_PACKET AF_PACKET | 
|  | 192 | #define PF_ASH AF_ASH | 
|  | 193 | #define PF_ECONET AF_ECONET | 
|  | 194 | #define PF_ATMSVC AF_ATMSVC | 
| Elliott Hughes | d73c0b3 | 2013-01-03 16:25:47 -0800 | [diff] [blame] | 195 | #define PF_RDS AF_RDS | 
| Elliott Hughes | 86ec05a | 2012-09-11 19:03:02 -0700 | [diff] [blame] | 196 | #define PF_SNA AF_SNA | 
|  | 197 | #define PF_IRDA AF_IRDA | 
|  | 198 | #define PF_PPPOX AF_PPPOX | 
|  | 199 | #define PF_WANPIPE AF_WANPIPE | 
|  | 200 | #define PF_LLC AF_LLC | 
| Elliott Hughes | d73c0b3 | 2013-01-03 16:25:47 -0800 | [diff] [blame] | 201 | #define PF_CAN AF_CAN | 
| Elliott Hughes | 86ec05a | 2012-09-11 19:03:02 -0700 | [diff] [blame] | 202 | #define PF_TIPC AF_TIPC | 
|  | 203 | #define PF_BLUETOOTH AF_BLUETOOTH | 
| Elliott Hughes | d73c0b3 | 2013-01-03 16:25:47 -0800 | [diff] [blame] | 204 | #define PF_IUCV AF_IUCV | 
|  | 205 | #define PF_RXRPC AF_RXRPC | 
|  | 206 | #define PF_ISDN AF_ISDN | 
|  | 207 | #define PF_PHONET AF_PHONET | 
|  | 208 | #define PF_IEEE802154 AF_IEEE802154 | 
| Elliott Hughes | 86ec05a | 2012-09-11 19:03:02 -0700 | [diff] [blame] | 209 | #define PF_CAIF AF_CAIF | 
| Elliott Hughes | d73c0b3 | 2013-01-03 16:25:47 -0800 | [diff] [blame] | 210 | #define PF_ALG AF_ALG | 
| Greg Hackmann | c7ca8f3 | 2016-01-28 11:07:26 -0800 | [diff] [blame] | 211 | #define PF_NFC AF_NFC | 
|  | 212 | #define PF_VSOCK AF_VSOCK | 
| Elliott Hughes | 8d76871 | 2016-12-13 15:29:58 -0800 | [diff] [blame] | 213 | #define PF_KCM AF_KCM | 
|  | 214 | #define PF_QIPCRTR AF_QIPCRTR | 
| Elliott Hughes | 86ec05a | 2012-09-11 19:03:02 -0700 | [diff] [blame] | 215 | #define PF_MAX AF_MAX | 
|  | 216 |  | 
|  | 217 | #define SOMAXCONN 128 | 
|  | 218 |  | 
|  | 219 | #define MSG_OOB 1 | 
|  | 220 | #define MSG_PEEK 2 | 
|  | 221 | #define MSG_DONTROUTE 4 | 
|  | 222 | #define MSG_TRYHARD 4 | 
|  | 223 | #define MSG_CTRUNC 8 | 
|  | 224 | #define MSG_PROBE 0x10 | 
|  | 225 | #define MSG_TRUNC 0x20 | 
|  | 226 | #define MSG_DONTWAIT 0x40 | 
|  | 227 | #define MSG_EOR 0x80 | 
|  | 228 | #define MSG_WAITALL 0x100 | 
|  | 229 | #define MSG_FIN 0x200 | 
|  | 230 | #define MSG_SYN 0x400 | 
|  | 231 | #define MSG_CONFIRM 0x800 | 
|  | 232 | #define MSG_RST 0x1000 | 
|  | 233 | #define MSG_ERRQUEUE 0x2000 | 
|  | 234 | #define MSG_NOSIGNAL 0x4000 | 
|  | 235 | #define MSG_MORE 0x8000 | 
| Guillaume Ranquet | 6ff0c75 | 2014-02-10 13:11:29 +0100 | [diff] [blame] | 236 | #define MSG_WAITFORONE 0x10000 | 
| Elliott Hughes | 8d76871 | 2016-12-13 15:29:58 -0800 | [diff] [blame] | 237 | #define MSG_BATCH 0x40000 | 
| Guillaume Ranquet | 6ff0c75 | 2014-02-10 13:11:29 +0100 | [diff] [blame] | 238 | #define MSG_FASTOPEN 0x20000000 | 
|  | 239 | #define MSG_CMSG_CLOEXEC 0x40000000 | 
| Elliott Hughes | 86ec05a | 2012-09-11 19:03:02 -0700 | [diff] [blame] | 240 | #define MSG_EOF MSG_FIN | 
|  | 241 | #define MSG_CMSG_COMPAT 0 | 
|  | 242 |  | 
|  | 243 | #define SOL_IP 0 | 
|  | 244 | #define SOL_TCP 6 | 
|  | 245 | #define SOL_UDP 17 | 
|  | 246 | #define SOL_IPV6 41 | 
|  | 247 | #define SOL_ICMPV6 58 | 
|  | 248 | #define SOL_SCTP 132 | 
|  | 249 | #define SOL_RAW 255 | 
|  | 250 | #define SOL_IPX 256 | 
|  | 251 | #define SOL_AX25 257 | 
|  | 252 | #define SOL_ATALK 258 | 
|  | 253 | #define SOL_NETROM 259 | 
|  | 254 | #define SOL_ROSE 260 | 
|  | 255 | #define SOL_DECNET 261 | 
|  | 256 | #define SOL_X25 262 | 
|  | 257 | #define SOL_PACKET 263 | 
|  | 258 | #define SOL_ATM 264 | 
|  | 259 | #define SOL_AAL 265 | 
|  | 260 | #define SOL_IRDA 266 | 
|  | 261 | #define SOL_NETBEUI 267 | 
|  | 262 | #define SOL_LLC 268 | 
|  | 263 | #define SOL_DCCP 269 | 
|  | 264 | #define SOL_NETLINK 270 | 
|  | 265 | #define SOL_TIPC 271 | 
| Elliott Hughes | 8d76871 | 2016-12-13 15:29:58 -0800 | [diff] [blame] | 266 | #define SOL_RXRPC 272 | 
|  | 267 | #define SOL_PPPOL2TP 273 | 
|  | 268 | #define SOL_BLUETOOTH 274 | 
|  | 269 | #define SOL_PNPIPE 275 | 
|  | 270 | #define SOL_RDS 276 | 
|  | 271 | #define SOL_IUCV 277 | 
|  | 272 | #define SOL_CAIF 278 | 
|  | 273 | #define SOL_ALG 279 | 
|  | 274 | #define SOL_NFC 280 | 
|  | 275 | #define SOL_KCM 281 | 
| Elliott Hughes | 062eac8 | 2018-08-27 11:27:06 -0700 | [diff] [blame] | 276 | #define SOL_TLS 282 | 
| Elliott Hughes | 86ec05a | 2012-09-11 19:03:02 -0700 | [diff] [blame] | 277 |  | 
|  | 278 | #define IPX_TYPE 1 | 
|  | 279 |  | 
|  | 280 | #ifdef __i386__ | 
|  | 281 | # define __socketcall extern __attribute__((__cdecl__)) | 
|  | 282 | #else | 
|  | 283 | # define __socketcall extern | 
|  | 284 | #endif | 
| The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 285 |  | 
| zijunzhao | 4e274fa | 2023-05-25 18:48:38 +0000 | [diff] [blame] | 286 | __socketcall int accept(int __fd, struct sockaddr* _Nullable __addr, socklen_t* _Nullable __addr_length); | 
| Elliott Hughes | 655e430 | 2023-06-16 12:39:33 -0700 | [diff] [blame] | 287 | __socketcall int accept4(int __fd, struct sockaddr* _Nullable __addr, socklen_t* _Nullable __addr_length, int __flags); | 
| zijunzhao | 4e274fa | 2023-05-25 18:48:38 +0000 | [diff] [blame] | 288 | __socketcall int bind(int __fd, const struct sockaddr* _Nonnull __addr, socklen_t __addr_length); | 
|  | 289 | __socketcall int connect(int __fd, const struct sockaddr* _Nonnull __addr, socklen_t __addr_length); | 
|  | 290 | __socketcall int getpeername(int __fd, struct sockaddr* _Nonnull __addr, socklen_t* _Nonnull __addr_length); | 
|  | 291 | __socketcall int getsockname(int __fd, struct sockaddr* _Nonnull __addr, socklen_t* _Nonnull __addr_length); | 
|  | 292 | __socketcall int getsockopt(int __fd, int __level, int __option, void* _Nullable __value, socklen_t* _Nonnull __value_length); | 
| Elliott Hughes | ff26a16 | 2017-08-17 22:34:21 +0000 | [diff] [blame] | 293 | __socketcall int listen(int __fd, int __backlog); | 
| Elliott Hughes | 655e430 | 2023-06-16 12:39:33 -0700 | [diff] [blame] | 294 | __socketcall int recvmmsg(int __fd, struct mmsghdr* _Nonnull __msgs, unsigned int __msg_count, int __flags, const struct timespec* _Nullable __timeout); | 
| zijunzhao | 4e274fa | 2023-05-25 18:48:38 +0000 | [diff] [blame] | 295 | __socketcall ssize_t recvmsg(int __fd, struct msghdr* _Nonnull __msg, int __flags); | 
| Elliott Hughes | 655e430 | 2023-06-16 12:39:33 -0700 | [diff] [blame] | 296 | __socketcall int sendmmsg(int __fd, const struct mmsghdr* _Nonnull __msgs, unsigned int __msg_count, int __flags); | 
| zijunzhao | 4e274fa | 2023-05-25 18:48:38 +0000 | [diff] [blame] | 297 | __socketcall ssize_t sendmsg(int __fd, const struct msghdr* _Nonnull __msg, int __flags); | 
|  | 298 | __socketcall int setsockopt(int __fd, int __level, int __option, const void* _Nullable __value, socklen_t __value_length); | 
| Elliott Hughes | ff26a16 | 2017-08-17 22:34:21 +0000 | [diff] [blame] | 299 | __socketcall int shutdown(int __fd, int __how); | 
|  | 300 | __socketcall int socket(int __af, int __type, int __protocol); | 
| zijunzhao | 4e274fa | 2023-05-25 18:48:38 +0000 | [diff] [blame] | 301 | __socketcall int socketpair(int __af, int __type, int __protocol, int __fds[_Nonnull 2]); | 
| The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 302 |  | 
| zijunzhao | 4e274fa | 2023-05-25 18:48:38 +0000 | [diff] [blame] | 303 | ssize_t recv(int __fd, void* _Nullable __buf, size_t __n, int __flags); | 
|  | 304 | ssize_t send(int __fd, const void* _Nonnull __buf, size_t __n, int __flags); | 
| The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 305 |  | 
| zijunzhao | 4e274fa | 2023-05-25 18:48:38 +0000 | [diff] [blame] | 306 | __socketcall ssize_t sendto(int __fd, const void* _Nonnull __buf, size_t __n, int __flags, const struct sockaddr* _Nullable __dst_addr, socklen_t __dst_addr_length); | 
|  | 307 | __socketcall ssize_t recvfrom(int __fd, void* _Nullable __buf, size_t __n, int __flags, struct sockaddr* _Nullable __src_addr, socklen_t* _Nullable __src_addr_length); | 
| The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 308 |  | 
| George Burgess IV | b97049c | 2017-07-24 15:05:05 -0700 | [diff] [blame] | 309 | #if defined(__BIONIC_INCLUDE_FORTIFY_HEADERS) | 
|  | 310 | #include <bits/fortify/socket.h> | 
|  | 311 | #endif | 
| Nick Kralevich | 60f4f9a | 2013-09-24 16:32:07 -0700 | [diff] [blame] | 312 |  | 
| The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 313 | #undef __socketcall | 
|  | 314 |  | 
|  | 315 | __END_DECLS | 
|  | 316 |  | 
| Elliott Hughes | ff26a16 | 2017-08-17 22:34:21 +0000 | [diff] [blame] | 317 | #endif |