Message ID | 1414396793-9005-6-git-send-email-apinski@cavium.com |
---|---|
State | New |
Headers | show |
On 10/27/2014 3:59 AM, Andrew Pinski wrote:
> +/* The fd_set member is required to be an array of longs by XPG4.2. */
So on aarch64 compat it's now an array of long longs. Is this a problem? Would it be better to make it an array of longs but twice as many longs on ILP32 as on LP64? I suppose this becomes problematic when supporting big-endian, though. But it would be good to address the XPG4.2 issue somewhere in the headers.
On 27 October 2014 16:32, Chris Metcalf <cmetcalf@tilera.com> wrote: > On 10/27/2014 3:59 AM, Andrew Pinski wrote: >> >> +/* The fd_set member is required to be an array of longs by XPG4.2. */ > > > So on aarch64 compat it's now an array of long longs. Is this a problem? > Would it be better to make it an array of longs but twice as many longs on > ILP32 as on LP64? I suppose this becomes problematic when supporting > big-endian, though. But it would be good to address the XPG4.2 issue > somewhere in the headers. Yes, this seems strange to me. Maybe it might be best handled by a wrapper in the kernel?
diff --git a/misc/sys/select.h b/misc/sys/select.h index 941588d..0ca660e 100644 --- a/misc/sys/select.h +++ b/misc/sys/select.h @@ -49,16 +49,20 @@ typedef __suseconds_t suseconds_t; # define __suseconds_t_defined #endif +/* The fd_set member is required to be an array of longs by XPG4.2. */ +#ifndef __FD_MASK_TYPE +#define __FD_MASK_TYPE long +#define __FD_MASK_CONST(a) a##ul +#endif -/* The fd_set member is required to be an array of longs. */ -typedef long int __fd_mask; +typedef __FD_MASK_TYPE __fd_mask; /* Some versions of <linux/posix_types.h> define this macros. */ #undef __NFDBITS /* It's easier to assume 8-bit bytes than to get CHAR_BIT. */ #define __NFDBITS (8 * (int) sizeof (__fd_mask)) #define __FD_ELT(d) ((d) / __NFDBITS) -#define __FD_MASK(d) ((__fd_mask) (1UL << ((d) % __NFDBITS))) +#define __FD_MASK(d) ((__fd_mask) (__FD_MASK_CONST(1) << ((d) % __NFDBITS))) /* fd_set for select and pselect. */ typedef struct