Browse Source

sys/user.h: derive __WORDSIZE from __LONG_MAX

previously, only a few archs defined it here. this change makes the
presence consistent across all archs, and reduces the amount of header
duplication (and potential for future inconsistency) between archs.
master
Rich Felker 2 years ago
parent
commit
7019fbe103
  1. 3
      arch/s390x/bits/user.h
  2. 3
      arch/sh/bits/user.h
  3. 3
      arch/x32/bits/user.h
  4. 3
      arch/x86_64/bits/user.h
  5. 9
      include/sys/user.h

3
arch/s390x/bits/user.h

@ -1,6 +1,3 @@
#undef __WORDSIZE
#define __WORDSIZE 64
typedef union { typedef union {
double d; double d;
float f; float f;

3
arch/sh/bits/user.h

@ -1,6 +1,3 @@
#undef __WORDSIZE
#define __WORDSIZE 32
#define REG_REG0 0 #define REG_REG0 0
#define REG_REG15 15 #define REG_REG15 15
#define REG_PC 16 #define REG_PC 16

3
arch/x32/bits/user.h

@ -1,6 +1,3 @@
#undef __WORDSIZE
#define __WORDSIZE 32
typedef struct user_fpregs_struct { typedef struct user_fpregs_struct {
uint16_t cwd, swd, ftw, fop; uint16_t cwd, swd, ftw, fop;
uint64_t rip, rdp; uint64_t rip, rdp;

3
arch/x86_64/bits/user.h

@ -1,6 +1,3 @@
#undef __WORDSIZE
#define __WORDSIZE 64
typedef struct user_fpregs_struct { typedef struct user_fpregs_struct {
uint16_t cwd, swd, ftw, fop; uint16_t cwd, swd, ftw, fop;
uint64_t rip, rdp; uint64_t rip, rdp;

9
include/sys/user.h

@ -8,6 +8,15 @@ extern "C" {
#include <stdint.h> #include <stdint.h>
#include <unistd.h> #include <unistd.h>
#include <bits/alltype.h>
#undef __WORDSIZE
#if __LONG_MAX == 0x7fffffffL
#define __WORDSIZE 32
#else
#define __WORDSIZE 64
#endif
#include <bits/user.h> #include <bits/user.h>
#ifdef __cplusplus #ifdef __cplusplus

Loading…
Cancel
Save