xref: /linux-6.15/include/uapi/linux/socket.h (revision 607ca46e)
1*607ca46eSDavid Howells #ifndef _UAPI_LINUX_SOCKET_H
2*607ca46eSDavid Howells #define _UAPI_LINUX_SOCKET_H
3*607ca46eSDavid Howells 
4*607ca46eSDavid Howells /*
5*607ca46eSDavid Howells  * Desired design of maximum size and alignment (see RFC2553)
6*607ca46eSDavid Howells  */
7*607ca46eSDavid Howells #define _K_SS_MAXSIZE	128	/* Implementation specific max size */
8*607ca46eSDavid Howells #define _K_SS_ALIGNSIZE	(__alignof__ (struct sockaddr *))
9*607ca46eSDavid Howells 				/* Implementation specific desired alignment */
10*607ca46eSDavid Howells 
11*607ca46eSDavid Howells typedef unsigned short __kernel_sa_family_t;
12*607ca46eSDavid Howells 
13*607ca46eSDavid Howells struct __kernel_sockaddr_storage {
14*607ca46eSDavid Howells 	__kernel_sa_family_t	ss_family;		/* address family */
15*607ca46eSDavid Howells 	/* Following field(s) are implementation specific */
16*607ca46eSDavid Howells 	char		__data[_K_SS_MAXSIZE - sizeof(unsigned short)];
17*607ca46eSDavid Howells 				/* space to achieve desired size, */
18*607ca46eSDavid Howells 				/* _SS_MAXSIZE value minus size of ss_family */
19*607ca46eSDavid Howells } __attribute__ ((aligned(_K_SS_ALIGNSIZE)));	/* force desired alignment */
20*607ca46eSDavid Howells 
21*607ca46eSDavid Howells #endif /* _UAPI_LINUX_SOCKET_H */
22