mirror of
https://sourceware.org/git/glibc.git
synced 2025-08-07 06:43:00 +03:00
bits/socket.h: Update to recent BSD definition
The old BSD 4.4 definition (not used by Linux) was not 64b-proof: the cmsg_data field is supposed to CMSG_ALIGN'ed (as can be also seen in the CMSG_LEN macro). Suggested-by: Diego Nieto Cid <dnietoc@gmail.com>
This commit is contained in:
@@ -221,17 +221,13 @@ struct cmsghdr
|
|||||||
of cmsghdr structure. */
|
of cmsghdr structure. */
|
||||||
int cmsg_level; /* Originating protocol. */
|
int cmsg_level; /* Originating protocol. */
|
||||||
int cmsg_type; /* Protocol specific type. */
|
int cmsg_type; /* Protocol specific type. */
|
||||||
#if __glibc_c99_flexarr_available
|
/* This field is to be aligned with CMSG_ALIGN */
|
||||||
__extension__ unsigned char __cmsg_data __flexarr; /* Ancillary data. */
|
/* __extension__ unsigned char __cmsg_data __flexarr; */ /* Ancillary data. */
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Ancillary data object manipulation macros. */
|
/* Ancillary data object manipulation macros. */
|
||||||
#if __glibc_c99_flexarr_available
|
#define CMSG_DATA(cmsg) \
|
||||||
# define CMSG_DATA(cmsg) ((cmsg)->__cmsg_data)
|
((unsigned char *) (cmsg) + CMSG_ALIGN (sizeof (struct cmsghdr)))
|
||||||
#else
|
|
||||||
# define CMSG_DATA(cmsg) ((unsigned char *) ((struct cmsghdr *) (cmsg) + 1))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define CMSG_NXTHDR(mhdr, cmsg) __cmsg_nxthdr (mhdr, cmsg)
|
#define CMSG_NXTHDR(mhdr, cmsg) __cmsg_nxthdr (mhdr, cmsg)
|
||||||
|
|
||||||
|
@@ -228,17 +228,13 @@ struct cmsghdr
|
|||||||
of cmsghdr structure. */
|
of cmsghdr structure. */
|
||||||
int cmsg_level; /* Originating protocol. */
|
int cmsg_level; /* Originating protocol. */
|
||||||
int cmsg_type; /* Protocol specific type. */
|
int cmsg_type; /* Protocol specific type. */
|
||||||
#if __glibc_c99_flexarr_available
|
/* This field is to be aligned with CMSG_ALIGN */
|
||||||
__extension__ unsigned char __cmsg_data __flexarr; /* Ancillary data. */
|
/* __extension__ unsigned char __cmsg_data __flexarr; */ /* Ancillary data. */
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Ancillary data object manipulation macros. */
|
/* Ancillary data object manipulation macros. */
|
||||||
#if __glibc_c99_flexarr_available
|
#define CMSG_DATA(cmsg) \
|
||||||
# define CMSG_DATA(cmsg) ((cmsg)->__cmsg_data)
|
((unsigned char *) (cmsg) + CMSG_ALIGN (sizeof (struct cmsghdr)))
|
||||||
#else
|
|
||||||
# define CMSG_DATA(cmsg) ((unsigned char *) ((struct cmsghdr *) (cmsg) + 1))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define CMSG_NXTHDR(mhdr, cmsg) __cmsg_nxthdr (mhdr, cmsg)
|
#define CMSG_NXTHDR(mhdr, cmsg) __cmsg_nxthdr (mhdr, cmsg)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user