~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/linux/socket.h

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /include/linux/socket.h (Version linux-6.12-rc7) and /include/linux/socket.h (Version unix-v6-master)


  1 /* SPDX-License-Identifier: GPL-2.0 */              1 
  2 #ifndef _LINUX_SOCKET_H                           
  3 #define _LINUX_SOCKET_H                           
  4                                                   
  5                                                   
  6 #include <asm/socket.h>                 /* arc    
  7 #include <linux/sockios.h>              /* the    
  8 #include <linux/uio.h>                  /* iov    
  9 #include <linux/types.h>                /* pid    
 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                                                   
 29 typedef __kernel_sa_family_t    sa_family_t;      
 30                                                   
 31 /*                                                
 32  *      1003.1g requires sa_family_t and that     
 33  */                                               
 34                                                   
 35 struct sockaddr {                                 
 36         sa_family_t     sa_family;      /* add    
 37         union {                                   
 38                 char sa_data_min[14];             
 39                 DECLARE_FLEX_ARRAY(char, sa_da    
 40         };                                        
 41 };                                                
 42                                                   
 43 struct linger {                                   
 44         int             l_onoff;        /* Lin    
 45         int             l_linger;       /* How    
 46 };                                                
 47                                                   
 48 #define sockaddr_storage __kernel_sockaddr_sto    
 49                                                   
 50 /*                                                
 51  *      As we do 4.4BSD message passing we use    
 52  *      system, not 4.3. Thus msg_accrights(le    
 53  *      belong in an obscure libc emulation or    
 54  */                                               
 55                                                   
 56 struct msghdr {                                   
 57         void            *msg_name;      /* ptr    
 58         int             msg_namelen;    /* siz    
 59                                                   
 60         int             msg_inq;        /* out    
 61                                                   
 62         struct iov_iter msg_iter;       /* dat    
 63                                                   
 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 };                                                
 98                                                   
 99 /*                                                
100  *      POSIX 1003.1g - ancillary data object     
101  *      Ancillary data consists of a sequence     
102  *      (cmsghdr, cmsg_data[])                    
103  */                                               
104                                                   
105 struct cmsghdr {                                  
106         __kernel_size_t cmsg_len;       /* dat    
107         int             cmsg_level;     /* ori    
108         int             cmsg_type;      /* pro    
109 };                                                
110                                                   
111 /*                                                
112  *      Ancillary data object information MACR    
113  *      Table 5-14 of POSIX 1003.1g               
114  */                                               
115                                                   
116 #define __CMSG_NXTHDR(ctl, len, cmsg) __cmsg_n    
117 #define CMSG_NXTHDR(mhdr, cmsg) cmsg_nxthdr((m    
118                                                   
119 #define CMSG_ALIGN(len) ( ((len)+sizeof(long)-    
120                                                   
121 #define CMSG_DATA(cmsg) \                         
122         ((void *)(cmsg) + sizeof(struct cmsghd    
123 #define CMSG_USER_DATA(cmsg) \                    
124         ((void __user *)(cmsg) + sizeof(struct    
125 #define CMSG_SPACE(len) (sizeof(struct cmsghdr    
126 #define CMSG_LEN(len) (sizeof(struct cmsghdr)     
127                                                   
128 #define __CMSG_FIRSTHDR(ctl,len) ((len) >= siz    
129                                   (struct cmsg    
130                                   (struct cmsg    
131 #define CMSG_FIRSTHDR(msg)      __CMSG_FIRSTHD    
132 #define CMSG_OK(mhdr, cmsg) ((cmsg)->cmsg_len     
133                              (cmsg)->cmsg_len     
134                              ((mhdr)->msg_cont    
135                               ((char *)(cmsg)     
136 #define for_each_cmsghdr(cmsg, msg) \             
137         for (cmsg = CMSG_FIRSTHDR(msg); \         
138              cmsg; \                              
139              cmsg = CMSG_NXTHDR(msg, cmsg))       
140                                                   
141 /*                                                
142  *      Get the next cmsg header                  
143  *                                                
144  *      PLEASE, do not touch this function. If    
145  *      incorrect, grep kernel sources and thi    
146  *      before trying to improve it.              
147  *                                                
148  *      Now it always returns valid, not trunc    
149  *      HEADER. But caller still MUST check, t    
150  *      inside range, given by msg->msg_contro    
151  *      ancillary object DATA.                    
152  */                                               
153                                                   
154 static inline struct cmsghdr * __cmsg_nxthdr(v    
155                                                   
156 {                                                 
157         struct cmsghdr * __ptr;                   
158                                                   
159         __ptr = (struct cmsghdr*)(((unsigned c    
160         if ((unsigned long)((char*)(__ptr+1) -    
161                 return (struct cmsghdr *)0;       
162                                                   
163         return __ptr;                             
164 }                                                 
165                                                   
166 static inline struct cmsghdr * cmsg_nxthdr (st    
167 {                                                 
168         return __cmsg_nxthdr(__msg->msg_contro    
169 }                                                 
170                                                   
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: */       
177                                                   
178 #define SCM_RIGHTS      0x01            /* rw:    
179 #define SCM_CREDENTIALS 0x02            /* rw:    
180 #define SCM_SECURITY    0x03            /* rw:    
181 #define SCM_PIDFD       0x04            /* ro:    
182                                                   
183 struct ucred {                                    
184         __u32   pid;                              
185         __u32   uid;                              
186         __u32   gid;                              
187 };                                                
188                                                   
189 /* Supported address families. */                 
190 #define AF_UNSPEC       0                         
191 #define AF_UNIX         1       /* Unix domain    
192 #define AF_LOCAL        1       /* POSIX name     
193 #define AF_INET         2       /* Internet IP    
194 #define AF_AX25         3       /* Amateur Rad    
195 #define AF_IPX          4       /* Novell IPX     
196 #define AF_APPLETALK    5       /* AppleTalk D    
197 #define AF_NETROM       6       /* Amateur Rad    
198 #define AF_BRIDGE       7       /* Multiprotoc    
199 #define AF_ATMPVC       8       /* ATM PVCs       
200 #define AF_X25          9       /* Reserved fo    
201 #define AF_INET6        10      /* IP version     
202 #define AF_ROSE         11      /* Amateur Rad    
203 #define AF_DECnet       12      /* Reserved fo    
204 #define AF_NETBEUI      13      /* Reserved fo    
205 #define AF_SECURITY     14      /* Security ca    
206 #define AF_KEY          15      /* PF_KEY key     
207 #define AF_NETLINK      16                        
208 #define AF_ROUTE        AF_NETLINK /* Alias to    
209 #define AF_PACKET       17      /* Packet fami    
210 #define AF_ASH          18      /* Ash            
211 #define AF_ECONET       19      /* Acorn Econe    
212 #define AF_ATMSVC       20      /* ATM SVCs       
213 #define AF_RDS          21      /* RDS sockets    
214 #define AF_SNA          22      /* Linux SNA P    
215 #define AF_IRDA         23      /* IRDA socket    
216 #define AF_PPPOX        24      /* PPPoX socke    
217 #define AF_WANPIPE      25      /* Wanpipe API    
218 #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    
224 #define AF_IUCV         32      /* IUCV socket    
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                                                   
246 /* Protocol families, same as address families    
247 #define PF_UNSPEC       AF_UNSPEC                 
248 #define PF_UNIX         AF_UNIX                   
249 #define PF_LOCAL        AF_LOCAL                  
250 #define PF_INET         AF_INET                   
251 #define PF_AX25         AF_AX25                   
252 #define PF_IPX          AF_IPX                    
253 #define PF_APPLETALK    AF_APPLETALK              
254 #define PF_NETROM       AF_NETROM                 
255 #define PF_BRIDGE       AF_BRIDGE                 
256 #define PF_ATMPVC       AF_ATMPVC                 
257 #define PF_X25          AF_X25                    
258 #define PF_INET6        AF_INET6                  
259 #define PF_ROSE         AF_ROSE                   
260 #define PF_DECnet       AF_DECnet                 
261 #define PF_NETBEUI      AF_NETBEUI                
262 #define PF_SECURITY     AF_SECURITY               
263 #define PF_KEY          AF_KEY                    
264 #define PF_NETLINK      AF_NETLINK                
265 #define PF_ROUTE        AF_ROUTE                  
266 #define PF_PACKET       AF_PACKET                 
267 #define PF_ASH          AF_ASH                    
268 #define PF_ECONET       AF_ECONET                 
269 #define PF_ATMSVC       AF_ATMSVC                 
270 #define PF_RDS          AF_RDS                    
271 #define PF_SNA          AF_SNA                    
272 #define PF_IRDA         AF_IRDA                   
273 #define PF_PPPOX        AF_PPPOX                  
274 #define PF_WANPIPE      AF_WANPIPE                
275 #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              
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                    
296                                                   
297 /* Maximum queue length specifiable by listen.    
298 #define SOMAXCONN       4096                      
299                                                   
300 /* Flags we can use with send/ and recv.          
301    Added those for 1003.1g not all are support    
302  */                                               
303                                                   
304 #define MSG_OOB         1                         
305 #define MSG_PEEK        2                         
306 #define MSG_DONTROUTE   4                         
307 #define MSG_TRYHARD     4       /* Synonym for    
308 #define MSG_CTRUNC      8                         
309 #define MSG_PROBE       0x10    /* Do not send    
310 #define MSG_TRUNC       0x20                      
311 #define MSG_DONTWAIT    0x40    /* Nonblocking    
312 #define MSG_EOR         0x80    /* End of reco    
313 #define MSG_WAITALL     0x100   /* Wait for a     
314 #define MSG_FIN         0x200                     
315 #define MSG_SYN         0x400                     
316 #define MSG_CONFIRM     0x800   /* Confirm pat    
317 #define MSG_RST         0x1000                    
318 #define MSG_ERRQUEUE    0x2000  /* Fetch messa    
319 #define MSG_NOSIGNAL    0x4000  /* Do not gene    
320 #define MSG_MORE        0x8000  /* Sender will    
321 #define MSG_WAITFORONE  0x10000 /* recvmmsg():    
322 #define MSG_SENDPAGE_NOPOLICY 0x10000 /* sendp    
323 #define MSG_BATCH       0x40000 /* sendmmsg():    
324 #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                                                   
343 /* Flags to be cleared on entry by sendmsg and    
344 #define MSG_INTERNAL_SENDMSG_FLAGS \              
345         (MSG_SPLICE_PAGES | MSG_SENDPAGE_NOPOL    
346                                                   
347 /* Setsockoptions(2) level. Thanks to BSD thes    
348 #define SOL_IP          0                         
349 /* #define SOL_ICMP     1       No-no-no! Due     
350 #define SOL_TCP         6                         
351 #define SOL_UDP         17                        
352 #define SOL_IPV6        41                        
353 #define SOL_ICMPV6      58                        
354 #define SOL_SCTP        132                       
355 #define SOL_UDPLITE     136     /* UDP-Lite (R    
356 #define SOL_RAW         255                       
357 #define SOL_IPX         256                       
358 #define SOL_AX25        257                       
359 #define SOL_ATALK       258                       
360 #define SOL_NETROM      259                       
361 #define SOL_ROSE        260                       
362 #define SOL_DECNET      261                       
363 #define SOL_X25         262                       
364 #define SOL_PACKET      263                       
365 #define SOL_ATM         264     /* ATM layer (    
366 #define SOL_AAL         265     /* ATM Adaptio    
367 #define SOL_IRDA        266                       
368 #define SOL_NETBEUI     267                       
369 #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                                                   
390 /* IPX options */                                 
391 #define IPX_TYPE        1                         
392                                                   
393 extern int move_addr_to_kernel(void __user *ua    
394 extern int put_cmsg(struct msghdr*, int level,    
395                                                   
396 struct timespec64;                                
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 */                      
463                                                   

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php