[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [hurd,commited] bits/socket.h: Update to recent BSD definition
From: |
Samuel Thibault |
Subject: |
Re: [hurd,commited] bits/socket.h: Update to recent BSD definition |
Date: |
Thu, 2 Jan 2025 11:16:14 +0100 |
Florian Weimer, le jeu. 02 janv. 2025 11:12:55 +0100, a ecrit:
> * Samuel Thibault:
>
> > 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>
> > ---
> > bits/socket.h | 12 ++++--------
> > sysdeps/mach/hurd/bits/socket.h | 12 ++++--------
> > 2 files changed, 8 insertions(+), 16 deletions(-)
> >
> > diff --git a/bits/socket.h b/bits/socket.h
> > index 62276fb49d..e83ad5bc01 100644
> > --- a/bits/socket.h
> > +++ b/bits/socket.h
> > @@ -221,17 +221,13 @@ struct cmsghdr
> > of cmsghdr structure. */
> > int cmsg_level; /* Originating protocol. */
> > int cmsg_type; /* Protocol specific type. */
> > -#if __glibc_c99_flexarr_available
> > - __extension__ unsigned char __cmsg_data __flexarr; /* Ancillary data.
> > */
> > -#endif
> > + /* This field is to be aligned with CMSG_ALIGN */
> > + /* __extension__ unsigned char __cmsg_data __flexarr; */ /* Ancillary
> > data. */
> > };
>
> Does the Linux version have the same problem?
By luck, no, because cmsg_len is erroneously a size_t there, and thus
cmsg_data happens to be size_t-aligned on both 32b and 64b archs. If we
ever get a 128b arch which does require 128b alignment, it'll have the
same problem, though.
Samuel
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [hurd,commited] bits/socket.h: Update to recent BSD definition,
Samuel Thibault <=