1 /* SPDX-License-Identifier: GPL-2.0 */ << 2 #ifndef _LINUX_SOCKET_H 1 #ifndef _LINUX_SOCKET_H 3 #define _LINUX_SOCKET_H 2 #define _LINUX_SOCKET_H 4 3 >> 4 /* >> 5 * Desired design of maximum size and alignment (see RFC2553) >> 6 */ >> 7 #define _K_SS_MAXSIZE 128 /* Implementation specific max size */ >> 8 #define _K_SS_ALIGNSIZE (__alignof__ (struct sockaddr *)) >> 9 /* Implementation specific desired alignment */ >> 10 >> 11 struct __kernel_sockaddr_storage { >> 12 unsigned short ss_family; /* address family */ >> 13 /* Following field(s) are implementation specific */ >> 14 char __data[_K_SS_MAXSIZE - sizeof(unsigned short)]; >> 15 /* space to achieve desired size, */ >> 16 /* _SS_MAXSIZE value minus size of ss_family */ >> 17 } __attribute__ ((aligned(_K_SS_ALIGNSIZE))); /* force desired alignment */ >> 18 >> 19 #if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2) 5 20 6 #include <asm/socket.h> /* arc 21 #include <asm/socket.h> /* arch-dependent defines */ 7 #include <linux/sockios.h> /* the 22 #include <linux/sockios.h> /* the SIOCxxx I/O controls */ 8 #include <linux/uio.h> /* iov 23 #include <linux/uio.h> /* iovec support */ 9 #include <linux/types.h> /* pid 24 #include <linux/types.h> /* pid_t */ 10 #include <linux/compiler.h> /* __u << 11 #include <uapi/linux/socket.h> << 12 << 13 struct file; << 14 struct pid; << 15 struct cred; << 16 struct socket; << 17 struct sock; << 18 struct sk_buff; << 19 struct proto_accept_arg; << 20 << 21 #define __sockaddr_check_size(size) \ << 22 BUILD_BUG_ON(((size) > sizeof(struct _ << 23 << 24 #ifdef CONFIG_PROC_FS << 25 struct seq_file; << 26 extern void socket_seq_show(struct seq_file *s << 27 #endif << 28 25 29 typedef __kernel_sa_family_t sa_family_t; !! 26 typedef unsigned short sa_family_t; 30 27 31 /* 28 /* 32 * 1003.1g requires sa_family_t and that 29 * 1003.1g requires sa_family_t and that sa_data is char. 33 */ 30 */ 34 !! 31 35 struct sockaddr { 32 struct sockaddr { 36 sa_family_t sa_family; /* add 33 sa_family_t sa_family; /* address family, AF_xxx */ 37 union { !! 34 char sa_data[14]; /* 14 bytes of protocol address */ 38 char sa_data_min[14]; << 39 DECLARE_FLEX_ARRAY(char, sa_da << 40 }; << 41 }; 35 }; 42 36 43 struct linger { 37 struct linger { 44 int l_onoff; /* Lin 38 int l_onoff; /* Linger active */ 45 int l_linger; /* How 39 int l_linger; /* How long to linger for */ 46 }; 40 }; 47 41 48 #define sockaddr_storage __kernel_sockaddr_sto 42 #define sockaddr_storage __kernel_sockaddr_storage 49 43 50 /* 44 /* 51 * As we do 4.4BSD message passing we use 45 * As we do 4.4BSD message passing we use a 4.4BSD message passing 52 * system, not 4.3. Thus msg_accrights(le 46 * system, not 4.3. Thus msg_accrights(len) are now missing. They 53 * belong in an obscure libc emulation or 47 * belong in an obscure libc emulation or the bin. 54 */ 48 */ 55 !! 49 56 struct msghdr { 50 struct msghdr { 57 void *msg_name; /* ptr !! 51 void * msg_name; /* Socket name */ 58 int msg_namelen; /* siz !! 52 int msg_namelen; /* Length of name */ 59 !! 53 struct iovec * msg_iov; /* Data blocks */ 60 int msg_inq; /* out !! 54 __kernel_size_t msg_iovlen; /* Number of blocks */ 61 !! 55 void * msg_control; /* Per protocol magic (eg BSD file descriptor passing) */ 62 struct iov_iter msg_iter; /* dat !! 56 __kernel_size_t msg_controllen; /* Length of cmsg list */ 63 !! 57 unsigned msg_flags; 64 /* << 65 * Ancillary data. msg_control_user is << 66 * recv* side when msg_control_is_user << 67 * buffer used for all other cases. << 68 */ << 69 union { << 70 void *msg_control; << 71 void __user *msg_control_u << 72 }; << 73 bool msg_control_is_user : << 74 bool msg_get_inq : 1;/* ret << 75 unsigned int msg_flags; /* fla << 76 __kernel_size_t msg_controllen; /* anc << 77 struct kiocb *msg_iocb; /* ptr << 78 struct ubuf_info *msg_ubuf; << 79 int (*sg_from_iter)(struct sk_buff *sk << 80 struct iov_iter *f << 81 }; << 82 << 83 struct user_msghdr { << 84 void __user *msg_name; << 85 int msg_namelen; << 86 struct iovec __user *msg_iov; << 87 __kernel_size_t msg_iovlen; << 88 void __user *msg_control; << 89 __kernel_size_t msg_controllen; << 90 unsigned int msg_flags; << 91 }; << 92 << 93 /* For recvmmsg/sendmmsg */ << 94 struct mmsghdr { << 95 struct user_msghdr msg_hdr; << 96 unsigned int msg_len; << 97 }; 58 }; 98 59 99 /* 60 /* 100 * POSIX 1003.1g - ancillary data object 61 * POSIX 1003.1g - ancillary data object information 101 * Ancillary data consists of a sequence !! 62 * Ancillary data consits of a sequence of pairs of 102 * (cmsghdr, cmsg_data[]) 63 * (cmsghdr, cmsg_data[]) 103 */ 64 */ 104 65 105 struct cmsghdr { 66 struct cmsghdr { 106 __kernel_size_t cmsg_len; /* dat 67 __kernel_size_t cmsg_len; /* data byte count, including hdr */ 107 int cmsg_level; /* ori 68 int cmsg_level; /* originating protocol */ 108 int cmsg_type; /* pro 69 int cmsg_type; /* protocol-specific type */ 109 }; 70 }; 110 71 111 /* 72 /* 112 * Ancillary data object information MACR !! 73 * Ancilliary data object information MACROS 113 * Table 5-14 of POSIX 1003.1g 74 * Table 5-14 of POSIX 1003.1g 114 */ 75 */ 115 76 116 #define __CMSG_NXTHDR(ctl, len, cmsg) __cmsg_n 77 #define __CMSG_NXTHDR(ctl, len, cmsg) __cmsg_nxthdr((ctl),(len),(cmsg)) 117 #define CMSG_NXTHDR(mhdr, cmsg) cmsg_nxthdr((m 78 #define CMSG_NXTHDR(mhdr, cmsg) cmsg_nxthdr((mhdr), (cmsg)) 118 79 119 #define CMSG_ALIGN(len) ( ((len)+sizeof(long)- 80 #define CMSG_ALIGN(len) ( ((len)+sizeof(long)-1) & ~(sizeof(long)-1) ) 120 81 121 #define CMSG_DATA(cmsg) \ !! 82 #define CMSG_DATA(cmsg) ((void *)((char *)(cmsg) + CMSG_ALIGN(sizeof(struct cmsghdr)))) 122 ((void *)(cmsg) + sizeof(struct cmsghd !! 83 #define CMSG_SPACE(len) (CMSG_ALIGN(sizeof(struct cmsghdr)) + CMSG_ALIGN(len)) 123 #define CMSG_USER_DATA(cmsg) \ !! 84 #define CMSG_LEN(len) (CMSG_ALIGN(sizeof(struct cmsghdr)) + (len)) 124 ((void __user *)(cmsg) + sizeof(struct << 125 #define CMSG_SPACE(len) (sizeof(struct cmsghdr << 126 #define CMSG_LEN(len) (sizeof(struct cmsghdr) << 127 85 128 #define __CMSG_FIRSTHDR(ctl,len) ((len) >= siz 86 #define __CMSG_FIRSTHDR(ctl,len) ((len) >= sizeof(struct cmsghdr) ? \ 129 (struct cmsg 87 (struct cmsghdr *)(ctl) : \ 130 (struct cmsg 88 (struct cmsghdr *)NULL) 131 #define CMSG_FIRSTHDR(msg) __CMSG_FIRSTHD 89 #define CMSG_FIRSTHDR(msg) __CMSG_FIRSTHDR((msg)->msg_control, (msg)->msg_controllen) 132 #define CMSG_OK(mhdr, cmsg) ((cmsg)->cmsg_len 90 #define CMSG_OK(mhdr, cmsg) ((cmsg)->cmsg_len >= sizeof(struct cmsghdr) && \ 133 (cmsg)->cmsg_len 91 (cmsg)->cmsg_len <= (unsigned long) \ 134 ((mhdr)->msg_cont 92 ((mhdr)->msg_controllen - \ 135 ((char *)(cmsg) 93 ((char *)(cmsg) - (char *)(mhdr)->msg_control))) 136 #define for_each_cmsghdr(cmsg, msg) \ !! 94 137 for (cmsg = CMSG_FIRSTHDR(msg); \ !! 95 /* 138 cmsg; \ !! 96 * This mess will go away with glibc 139 cmsg = CMSG_NXTHDR(msg, cmsg)) !! 97 */ >> 98 >> 99 #ifdef __KERNEL__ >> 100 #define __KINLINE static inline >> 101 #elif defined(__GNUC__) >> 102 #define __KINLINE static __inline__ >> 103 #elif defined(__cplusplus) >> 104 #define __KINLINE static inline >> 105 #else >> 106 #define __KINLINE static >> 107 #endif >> 108 140 109 141 /* 110 /* 142 * Get the next cmsg header 111 * Get the next cmsg header 143 * 112 * 144 * PLEASE, do not touch this function. If 113 * PLEASE, do not touch this function. If you think, that it is 145 * incorrect, grep kernel sources and thi 114 * incorrect, grep kernel sources and think about consequences 146 * before trying to improve it. 115 * before trying to improve it. 147 * 116 * 148 * Now it always returns valid, not trunc 117 * Now it always returns valid, not truncated ancillary object 149 * HEADER. But caller still MUST check, t 118 * HEADER. But caller still MUST check, that cmsg->cmsg_len is 150 * inside range, given by msg->msg_contro 119 * inside range, given by msg->msg_controllen before using 151 * ancillary object DATA. !! 120 * ansillary object DATA. --ANK (980731) 152 */ 121 */ 153 !! 122 154 static inline struct cmsghdr * __cmsg_nxthdr(v !! 123 __KINLINE struct cmsghdr * __cmsg_nxthdr(void *__ctl, __kernel_size_t __size, 155 124 struct cmsghdr *__cmsg) 156 { 125 { 157 struct cmsghdr * __ptr; 126 struct cmsghdr * __ptr; 158 127 159 __ptr = (struct cmsghdr*)(((unsigned c 128 __ptr = (struct cmsghdr*)(((unsigned char *) __cmsg) + CMSG_ALIGN(__cmsg->cmsg_len)); 160 if ((unsigned long)((char*)(__ptr+1) - 129 if ((unsigned long)((char*)(__ptr+1) - (char *) __ctl) > __size) 161 return (struct cmsghdr *)0; 130 return (struct cmsghdr *)0; 162 131 163 return __ptr; 132 return __ptr; 164 } 133 } 165 134 166 static inline struct cmsghdr * cmsg_nxthdr (st !! 135 __KINLINE struct cmsghdr * cmsg_nxthdr (struct msghdr *__msg, struct cmsghdr *__cmsg) 167 { 136 { 168 return __cmsg_nxthdr(__msg->msg_contro 137 return __cmsg_nxthdr(__msg->msg_control, __msg->msg_controllen, __cmsg); 169 } 138 } 170 139 171 static inline size_t msg_data_left(struct msgh << 172 { << 173 return iov_iter_count(&msg->msg_iter); << 174 } << 175 << 176 /* "Socket"-level control message types: */ 140 /* "Socket"-level control message types: */ 177 141 178 #define SCM_RIGHTS 0x01 /* rw: 142 #define SCM_RIGHTS 0x01 /* rw: access rights (array of int) */ 179 #define SCM_CREDENTIALS 0x02 /* rw: 143 #define SCM_CREDENTIALS 0x02 /* rw: struct ucred */ 180 #define SCM_SECURITY 0x03 /* rw: << 181 #define SCM_PIDFD 0x04 /* ro: << 182 144 183 struct ucred { 145 struct ucred { 184 __u32 pid; 146 __u32 pid; 185 __u32 uid; 147 __u32 uid; 186 __u32 gid; 148 __u32 gid; 187 }; 149 }; 188 150 189 /* Supported address families. */ 151 /* Supported address families. */ 190 #define AF_UNSPEC 0 152 #define AF_UNSPEC 0 191 #define AF_UNIX 1 /* Unix domain 153 #define AF_UNIX 1 /* Unix domain sockets */ 192 #define AF_LOCAL 1 /* POSIX name 154 #define AF_LOCAL 1 /* POSIX name for AF_UNIX */ 193 #define AF_INET 2 /* Internet IP 155 #define AF_INET 2 /* Internet IP Protocol */ 194 #define AF_AX25 3 /* Amateur Rad 156 #define AF_AX25 3 /* Amateur Radio AX.25 */ 195 #define AF_IPX 4 /* Novell IPX 157 #define AF_IPX 4 /* Novell IPX */ 196 #define AF_APPLETALK 5 /* AppleTalk D 158 #define AF_APPLETALK 5 /* AppleTalk DDP */ 197 #define AF_NETROM 6 /* Amateur Rad 159 #define AF_NETROM 6 /* Amateur Radio NET/ROM */ 198 #define AF_BRIDGE 7 /* Multiprotoc 160 #define AF_BRIDGE 7 /* Multiprotocol bridge */ 199 #define AF_ATMPVC 8 /* ATM PVCs 161 #define AF_ATMPVC 8 /* ATM PVCs */ 200 #define AF_X25 9 /* Reserved fo 162 #define AF_X25 9 /* Reserved for X.25 project */ 201 #define AF_INET6 10 /* IP version 163 #define AF_INET6 10 /* IP version 6 */ 202 #define AF_ROSE 11 /* Amateur Rad 164 #define AF_ROSE 11 /* Amateur Radio X.25 PLP */ 203 #define AF_DECnet 12 /* Reserved fo 165 #define AF_DECnet 12 /* Reserved for DECnet project */ 204 #define AF_NETBEUI 13 /* Reserved fo 166 #define AF_NETBEUI 13 /* Reserved for 802.2LLC project*/ 205 #define AF_SECURITY 14 /* Security ca 167 #define AF_SECURITY 14 /* Security callback pseudo AF */ 206 #define AF_KEY 15 /* PF_KEY key 168 #define AF_KEY 15 /* PF_KEY key management API */ 207 #define AF_NETLINK 16 169 #define AF_NETLINK 16 208 #define AF_ROUTE AF_NETLINK /* Alias to 170 #define AF_ROUTE AF_NETLINK /* Alias to emulate 4.4BSD */ 209 #define AF_PACKET 17 /* Packet fami 171 #define AF_PACKET 17 /* Packet family */ 210 #define AF_ASH 18 /* Ash 172 #define AF_ASH 18 /* Ash */ 211 #define AF_ECONET 19 /* Acorn Econe 173 #define AF_ECONET 19 /* Acorn Econet */ 212 #define AF_ATMSVC 20 /* ATM SVCs 174 #define AF_ATMSVC 20 /* ATM SVCs */ 213 #define AF_RDS 21 /* RDS sockets << 214 #define AF_SNA 22 /* Linux SNA P 175 #define AF_SNA 22 /* Linux SNA Project (nutters!) */ 215 #define AF_IRDA 23 /* IRDA socket 176 #define AF_IRDA 23 /* IRDA sockets */ 216 #define AF_PPPOX 24 /* PPPoX socke 177 #define AF_PPPOX 24 /* PPPoX sockets */ 217 #define AF_WANPIPE 25 /* Wanpipe API 178 #define AF_WANPIPE 25 /* Wanpipe API Sockets */ 218 #define AF_LLC 26 /* Linux LLC 179 #define AF_LLC 26 /* Linux LLC */ 219 #define AF_IB 27 /* Native Infi << 220 #define AF_MPLS 28 /* MPLS */ << 221 #define AF_CAN 29 /* Controller << 222 #define AF_TIPC 30 /* TIPC socket << 223 #define AF_BLUETOOTH 31 /* Bluetooth s 180 #define AF_BLUETOOTH 31 /* Bluetooth sockets */ 224 #define AF_IUCV 32 /* IUCV socket !! 181 #define AF_MAX 32 /* For now.. */ 225 #define AF_RXRPC 33 /* RxRPC socke << 226 #define AF_ISDN 34 /* mISDN socke << 227 #define AF_PHONET 35 /* Phonet sock << 228 #define AF_IEEE802154 36 /* IEEE802154 << 229 #define AF_CAIF 37 /* CAIF socket << 230 #define AF_ALG 38 /* Algorithm s << 231 #define AF_NFC 39 /* NFC sockets << 232 #define AF_VSOCK 40 /* vSockets << 233 #define AF_KCM 41 /* Kernel Conn << 234 #define AF_QIPCRTR 42 /* Qualcomm IP << 235 #define AF_SMC 43 /* smc sockets << 236 * PF_SMC prot << 237 * reuses AF_I << 238 */ << 239 #define AF_XDP 44 /* XDP sockets << 240 #define AF_MCTP 45 /* Management << 241 * transport p << 242 */ << 243 << 244 #define AF_MAX 46 /* For now.. * << 245 182 246 /* Protocol families, same as address families 183 /* Protocol families, same as address families. */ 247 #define PF_UNSPEC AF_UNSPEC 184 #define PF_UNSPEC AF_UNSPEC 248 #define PF_UNIX AF_UNIX 185 #define PF_UNIX AF_UNIX 249 #define PF_LOCAL AF_LOCAL 186 #define PF_LOCAL AF_LOCAL 250 #define PF_INET AF_INET 187 #define PF_INET AF_INET 251 #define PF_AX25 AF_AX25 188 #define PF_AX25 AF_AX25 252 #define PF_IPX AF_IPX 189 #define PF_IPX AF_IPX 253 #define PF_APPLETALK AF_APPLETALK 190 #define PF_APPLETALK AF_APPLETALK 254 #define PF_NETROM AF_NETROM 191 #define PF_NETROM AF_NETROM 255 #define PF_BRIDGE AF_BRIDGE 192 #define PF_BRIDGE AF_BRIDGE 256 #define PF_ATMPVC AF_ATMPVC 193 #define PF_ATMPVC AF_ATMPVC 257 #define PF_X25 AF_X25 194 #define PF_X25 AF_X25 258 #define PF_INET6 AF_INET6 195 #define PF_INET6 AF_INET6 259 #define PF_ROSE AF_ROSE 196 #define PF_ROSE AF_ROSE 260 #define PF_DECnet AF_DECnet 197 #define PF_DECnet AF_DECnet 261 #define PF_NETBEUI AF_NETBEUI 198 #define PF_NETBEUI AF_NETBEUI 262 #define PF_SECURITY AF_SECURITY 199 #define PF_SECURITY AF_SECURITY 263 #define PF_KEY AF_KEY 200 #define PF_KEY AF_KEY 264 #define PF_NETLINK AF_NETLINK 201 #define PF_NETLINK AF_NETLINK 265 #define PF_ROUTE AF_ROUTE 202 #define PF_ROUTE AF_ROUTE 266 #define PF_PACKET AF_PACKET 203 #define PF_PACKET AF_PACKET 267 #define PF_ASH AF_ASH 204 #define PF_ASH AF_ASH 268 #define PF_ECONET AF_ECONET 205 #define PF_ECONET AF_ECONET 269 #define PF_ATMSVC AF_ATMSVC 206 #define PF_ATMSVC AF_ATMSVC 270 #define PF_RDS AF_RDS << 271 #define PF_SNA AF_SNA 207 #define PF_SNA AF_SNA 272 #define PF_IRDA AF_IRDA 208 #define PF_IRDA AF_IRDA 273 #define PF_PPPOX AF_PPPOX 209 #define PF_PPPOX AF_PPPOX 274 #define PF_WANPIPE AF_WANPIPE 210 #define PF_WANPIPE AF_WANPIPE 275 #define PF_LLC AF_LLC 211 #define PF_LLC AF_LLC 276 #define PF_IB AF_IB << 277 #define PF_MPLS AF_MPLS << 278 #define PF_CAN AF_CAN << 279 #define PF_TIPC AF_TIPC << 280 #define PF_BLUETOOTH AF_BLUETOOTH 212 #define PF_BLUETOOTH AF_BLUETOOTH 281 #define PF_IUCV AF_IUCV << 282 #define PF_RXRPC AF_RXRPC << 283 #define PF_ISDN AF_ISDN << 284 #define PF_PHONET AF_PHONET << 285 #define PF_IEEE802154 AF_IEEE802154 << 286 #define PF_CAIF AF_CAIF << 287 #define PF_ALG AF_ALG << 288 #define PF_NFC AF_NFC << 289 #define PF_VSOCK AF_VSOCK << 290 #define PF_KCM AF_KCM << 291 #define PF_QIPCRTR AF_QIPCRTR << 292 #define PF_SMC AF_SMC << 293 #define PF_XDP AF_XDP << 294 #define PF_MCTP AF_MCTP << 295 #define PF_MAX AF_MAX 213 #define PF_MAX AF_MAX 296 214 297 /* Maximum queue length specifiable by listen. 215 /* Maximum queue length specifiable by listen. */ 298 #define SOMAXCONN 4096 !! 216 #define SOMAXCONN 128 299 217 300 /* Flags we can use with send/ and recv. !! 218 /* Flags we can use with send/ and recv. 301 Added those for 1003.1g not all are support 219 Added those for 1003.1g not all are supported yet 302 */ 220 */ 303 !! 221 304 #define MSG_OOB 1 222 #define MSG_OOB 1 305 #define MSG_PEEK 2 223 #define MSG_PEEK 2 306 #define MSG_DONTROUTE 4 224 #define MSG_DONTROUTE 4 307 #define MSG_TRYHARD 4 /* Synonym for 225 #define MSG_TRYHARD 4 /* Synonym for MSG_DONTROUTE for DECnet */ 308 #define MSG_CTRUNC 8 226 #define MSG_CTRUNC 8 309 #define MSG_PROBE 0x10 /* Do not send 227 #define MSG_PROBE 0x10 /* Do not send. Only probe path f.e. for MTU */ 310 #define MSG_TRUNC 0x20 228 #define MSG_TRUNC 0x20 311 #define MSG_DONTWAIT 0x40 /* Nonblocking 229 #define MSG_DONTWAIT 0x40 /* Nonblocking io */ 312 #define MSG_EOR 0x80 /* End of reco 230 #define MSG_EOR 0x80 /* End of record */ 313 #define MSG_WAITALL 0x100 /* Wait for a 231 #define MSG_WAITALL 0x100 /* Wait for a full request */ 314 #define MSG_FIN 0x200 232 #define MSG_FIN 0x200 315 #define MSG_SYN 0x400 233 #define MSG_SYN 0x400 316 #define MSG_CONFIRM 0x800 /* Confirm pat 234 #define MSG_CONFIRM 0x800 /* Confirm path validity */ 317 #define MSG_RST 0x1000 235 #define MSG_RST 0x1000 318 #define MSG_ERRQUEUE 0x2000 /* Fetch messa 236 #define MSG_ERRQUEUE 0x2000 /* Fetch message from error queue */ 319 #define MSG_NOSIGNAL 0x4000 /* Do not gene 237 #define MSG_NOSIGNAL 0x4000 /* Do not generate SIGPIPE */ 320 #define MSG_MORE 0x8000 /* Sender will 238 #define MSG_MORE 0x8000 /* Sender will send more */ 321 #define MSG_WAITFORONE 0x10000 /* recvmmsg(): !! 239 322 #define MSG_SENDPAGE_NOPOLICY 0x10000 /* sendp << 323 #define MSG_BATCH 0x40000 /* sendmmsg(): << 324 #define MSG_EOF MSG_FIN 240 #define MSG_EOF MSG_FIN 325 #define MSG_NO_SHARED_FRAGS 0x80000 /* sendpag << 326 #define MSG_SENDPAGE_DECRYPTED 0x100000 /* se << 327 * pl << 328 */ << 329 << 330 #define MSG_SOCK_DEVMEM 0x2000000 /* Rec << 331 #define MSG_ZEROCOPY 0x4000000 /* Use << 332 #define MSG_SPLICE_PAGES 0x8000000 /* Spl << 333 #define MSG_FASTOPEN 0x20000000 /* Sen << 334 #define MSG_CMSG_CLOEXEC 0x40000000 /* Set << 335 des << 336 SCM << 337 #if defined(CONFIG_COMPAT) << 338 #define MSG_CMSG_COMPAT 0x80000000 /* Thi << 339 #else << 340 #define MSG_CMSG_COMPAT 0 /* We << 341 #endif << 342 241 343 /* Flags to be cleared on entry by sendmsg and << 344 #define MSG_INTERNAL_SENDMSG_FLAGS \ << 345 (MSG_SPLICE_PAGES | MSG_SENDPAGE_NOPOL << 346 242 347 /* Setsockoptions(2) level. Thanks to BSD thes 243 /* Setsockoptions(2) level. Thanks to BSD these must match IPPROTO_xxx */ 348 #define SOL_IP 0 244 #define SOL_IP 0 349 /* #define SOL_ICMP 1 No-no-no! Due 245 /* #define SOL_ICMP 1 No-no-no! Due to Linux :-) we cannot use SOL_ICMP=1 */ 350 #define SOL_TCP 6 246 #define SOL_TCP 6 351 #define SOL_UDP 17 247 #define SOL_UDP 17 352 #define SOL_IPV6 41 248 #define SOL_IPV6 41 353 #define SOL_ICMPV6 58 249 #define SOL_ICMPV6 58 354 #define SOL_SCTP 132 250 #define SOL_SCTP 132 355 #define SOL_UDPLITE 136 /* UDP-Lite (R << 356 #define SOL_RAW 255 251 #define SOL_RAW 255 357 #define SOL_IPX 256 252 #define SOL_IPX 256 358 #define SOL_AX25 257 253 #define SOL_AX25 257 359 #define SOL_ATALK 258 254 #define SOL_ATALK 258 360 #define SOL_NETROM 259 255 #define SOL_NETROM 259 361 #define SOL_ROSE 260 256 #define SOL_ROSE 260 362 #define SOL_DECNET 261 257 #define SOL_DECNET 261 363 #define SOL_X25 262 258 #define SOL_X25 262 364 #define SOL_PACKET 263 259 #define SOL_PACKET 263 365 #define SOL_ATM 264 /* ATM layer ( 260 #define SOL_ATM 264 /* ATM layer (cell level) */ 366 #define SOL_AAL 265 /* ATM Adaptio 261 #define SOL_AAL 265 /* ATM Adaption Layer (packet level) */ 367 #define SOL_IRDA 266 262 #define SOL_IRDA 266 368 #define SOL_NETBEUI 267 263 #define SOL_NETBEUI 267 369 #define SOL_LLC 268 264 #define SOL_LLC 268 370 #define SOL_DCCP 269 << 371 #define SOL_NETLINK 270 << 372 #define SOL_TIPC 271 << 373 #define SOL_RXRPC 272 << 374 #define SOL_PPPOL2TP 273 << 375 #define SOL_BLUETOOTH 274 << 376 #define SOL_PNPIPE 275 << 377 #define SOL_RDS 276 << 378 #define SOL_IUCV 277 << 379 #define SOL_CAIF 278 << 380 #define SOL_ALG 279 << 381 #define SOL_NFC 280 << 382 #define SOL_KCM 281 << 383 #define SOL_TLS 282 << 384 #define SOL_XDP 283 << 385 #define SOL_MPTCP 284 << 386 #define SOL_MCTP 285 << 387 #define SOL_SMC 286 << 388 #define SOL_VSOCK 287 << 389 265 390 /* IPX options */ 266 /* IPX options */ 391 #define IPX_TYPE 1 267 #define IPX_TYPE 1 392 268 393 extern int move_addr_to_kernel(void __user *ua !! 269 #ifdef __KERNEL__ >> 270 extern int memcpy_fromiovec(unsigned char *kdata, struct iovec *iov, int len); >> 271 extern int memcpy_fromiovecend(unsigned char *kdata, struct iovec *iov, >> 272 int offset, int len); >> 273 extern int csum_partial_copy_fromiovecend(unsigned char *kdata, >> 274 struct iovec *iov, >> 275 int offset, >> 276 unsigned int len, int *csump); >> 277 >> 278 extern int verify_iovec(struct msghdr *m, struct iovec *iov, char *address, int mode); >> 279 extern int memcpy_toiovec(struct iovec *v, unsigned char *kdata, int len); >> 280 extern void memcpy_tokerneliovec(struct iovec *iov, unsigned char *kdata, int len); >> 281 extern int move_addr_to_user(void *kaddr, int klen, void *uaddr, int *ulen); >> 282 extern int move_addr_to_kernel(void *uaddr, int ulen, void *kaddr); 394 extern int put_cmsg(struct msghdr*, int level, 283 extern int put_cmsg(struct msghdr*, int level, int type, int len, void *data); 395 !! 284 #endif 396 struct timespec64; !! 285 #endif /* not kernel and not glibc */ 397 struct __kernel_timespec; << 398 struct old_timespec32; << 399 << 400 struct scm_timestamping_internal { << 401 struct timespec64 ts[3]; << 402 }; << 403 << 404 extern void put_cmsg_scm_timestamping64(struct << 405 extern void put_cmsg_scm_timestamping(struct m << 406 << 407 /* The __sys_...msg variants allow MSG_CMSG_CO << 408 * forbid_cmsg_compat==false << 409 */ << 410 extern long __sys_recvmsg(int fd, struct user_ << 411 unsigned int flags, << 412 extern long __sys_sendmsg(int fd, struct user_ << 413 unsigned int flags, << 414 extern int __sys_recvmmsg(int fd, struct mmsgh << 415 unsigned int vlen, u << 416 struct __kernel_time << 417 struct old_timespec3 << 418 extern int __sys_sendmmsg(int fd, struct mmsgh << 419 unsigned int vlen, u << 420 bool forbid_cmsg_com << 421 extern long __sys_sendmsg_sock(struct socket * << 422 unsigned int fl << 423 extern long __sys_recvmsg_sock(struct socket * << 424 struct user_msg << 425 struct sockaddr << 426 unsigned int fl << 427 extern int __copy_msghdr(struct msghdr *kmsg, << 428 struct user_msghdr *u << 429 struct sockaddr __use << 430 << 431 /* helpers which do the actual work for syscal << 432 extern int __sys_recvfrom(int fd, void __user << 433 unsigned int flags, << 434 int __user *addr_len << 435 extern int __sys_sendto(int fd, void __user *b << 436 unsigned int flags, st << 437 int addr_len); << 438 extern struct file *do_accept(struct file *fil << 439 struct sockaddr << 440 int __user *upee << 441 extern int __sys_accept4(int fd, struct sockad << 442 int __user *upeer_add << 443 extern int __sys_socket(int family, int type, << 444 extern struct file *__sys_socket_file(int fami << 445 extern int __sys_bind(int fd, struct sockaddr << 446 extern int __sys_bind_socket(struct socket *so << 447 int addrlen); << 448 extern int __sys_connect_file(struct file *fil << 449 int addrlen, int << 450 extern int __sys_connect(int fd, struct sockad << 451 int addrlen); << 452 extern int __sys_listen(int fd, int backlog); << 453 extern int __sys_listen_socket(struct socket * << 454 extern int __sys_getsockname(int fd, struct so << 455 int __user *usock << 456 extern int __sys_getpeername(int fd, struct so << 457 int __user *usock << 458 extern int __sys_socketpair(int family, int ty << 459 int __user *usockv << 460 extern int __sys_shutdown_sock(struct socket * << 461 extern int __sys_shutdown(int fd, int how); << 462 #endif /* _LINUX_SOCKET_H */ 286 #endif /* _LINUX_SOCKET_H */ 463 287
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.