diff options
Diffstat (limited to 'include/uapi/linux/socket.h')
-rw-r--r-- | include/uapi/linux/socket.h | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/include/uapi/linux/socket.h b/include/uapi/linux/socket.h index 8eb96021709c..c3409c8ec0dd 100644 --- a/include/uapi/linux/socket.h +++ b/include/uapi/linux/socket.h | |||
@@ -6,17 +6,24 @@ | |||
6 | * Desired design of maximum size and alignment (see RFC2553) | 6 | * Desired design of maximum size and alignment (see RFC2553) |
7 | */ | 7 | */ |
8 | #define _K_SS_MAXSIZE 128 /* Implementation specific max size */ | 8 | #define _K_SS_MAXSIZE 128 /* Implementation specific max size */ |
9 | #define _K_SS_ALIGNSIZE (__alignof__ (struct sockaddr *)) | ||
10 | /* Implementation specific desired alignment */ | ||
11 | 9 | ||
12 | typedef unsigned short __kernel_sa_family_t; | 10 | typedef unsigned short __kernel_sa_family_t; |
13 | 11 | ||
12 | /* | ||
13 | * The definition uses anonymous union and struct in order to control the | ||
14 | * default alignment. | ||
15 | */ | ||
14 | struct __kernel_sockaddr_storage { | 16 | struct __kernel_sockaddr_storage { |
15 | __kernel_sa_family_t ss_family; /* address family */ | 17 | union { |
16 | /* Following field(s) are implementation specific */ | 18 | struct { |
17 | char __data[_K_SS_MAXSIZE - sizeof(unsigned short)]; | 19 | __kernel_sa_family_t ss_family; /* address family */ |
20 | /* Following field(s) are implementation specific */ | ||
21 | char __data[_K_SS_MAXSIZE - sizeof(unsigned short)]; | ||
18 | /* space to achieve desired size, */ | 22 | /* space to achieve desired size, */ |
19 | /* _SS_MAXSIZE value minus size of ss_family */ | 23 | /* _SS_MAXSIZE value minus size of ss_family */ |
20 | } __attribute__ ((aligned(_K_SS_ALIGNSIZE))); /* force desired alignment */ | 24 | }; |
25 | void *__align; /* implementation specific desired alignment */ | ||
26 | }; | ||
27 | }; | ||
21 | 28 | ||
22 | #endif /* _UAPI_LINUX_SOCKET_H */ | 29 | #endif /* _UAPI_LINUX_SOCKET_H */ |