Update kernel uabi header files for x32
cover Update kernel uabi header files for x32
X32 uses the same kernel system call interface as x86-64 for many system calls. However, "long" is 64-bit for x86-64 and is 32-bit for x32. Where long or unsigned long are used in struct types for such system calls, they are wrong for x32. __kernel_[u]long_t is [unsigned] long for all ABIs other than x32. I am submitting 8 patches to replace long or unsigned long with __kernel_[u]long_t so that those struct types can be used with x32 system calls.
H.J. Lu (8):
Use __kernel_long_t in struct timex
Use __kernel_long_t/__kernel_ulong_t in <linux/resource.h> Use __kernel_ulong_t in uapi struct ipc64_perm Use __kernel_long_t in struct msgbuf
Use __kernel_ulong_t in struct msqid64_ds
Use __kernel_ulong_t in x86 struct semid64_ds Use __kernel_ulong_t in shmid64_ds/shminfo64/shm_info Use __kernel_long_t in struct mq_attr
arch/x86/include/uapi/asm/sembuf.h | 10 ++++----- include/uapi/asm-generic/ipcbuf.h | 5 +++++ include/uapi/asm-generic/msgbuf.h | 19 +++++++++++----- include/uapi/asm-generic/shmbuf.h | 36 +++++++++++++++++++++-------- include/uapi/linux/mqueue.h | 18 ++++++++++----- include/uapi/linux/msg.h | 8 +++++-- include/uapi/linux/resource.h | 26 +++++++++++++++++++-- include/uapi/linux/shm.h | 14 +++++++++--- include/uapi/linux/timex.h | 46 +++++++++++++++++++++++++++++++------- 9 files changed, 143 insertions(+), 39 deletions(-)
Signature · 1 line
1.8.4.2
PATCH 1/8 Use __kernel_long_t in struct timex
X32 adjtimex system call is the same as x86-64 adjtimex system call, which uses 64-bit integer for long in struct timex. But x32 long is 32 bit. This patch replaces long in struct timex with __kernel_long_t if __BITS_PER_LONG == 64.
--- include/uapi/linux/timex.h | 46 ++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 38 insertions(+), 8 deletions(-)
include/uapi/linux/timex.h +38 -8
@@ -63,28 +63,58 @@*/ struct timex {unsigned int modes;/* mode selector */ +#if __BITS_PER_LONG ==64 +__kernel_long_t offset;/* time offset (usec) */ +__kernel_long_t freq;/* frequency offset (scaled ppm) */ +__kernel_long_t maxerror;/* maximum error (usec) */ +__kernel_long_t esterror;/* estimated error (usec) */ +#else long offset;/* time offset (usec) */ long freq;/* frequency offset (scaled ppm) */ long maxerror;/* maximum error (usec) */ long esterror;/* estimated error (usec) */ +#endif int status;/* clock command/status */ +#if __BITS_PER_LONG ==64 +__kernel_long_t constant;/* pll time constant */ +__kernel_long_t precision;/* clock precision (usec) (read only) */ +__kernel_long_t tolerance;/* clock frequency tolerance (ppm) +* (read only) +*/ +#else long constant;/* pll time constant */ long precision;/* clock precision (usec) (read only) */ long tolerance;/* clock frequency tolerance (ppm) * (read only) */ +#endif struct timeval time;/* (read only, except for ADJ_SETOFFSET) */ +#if __BITS_PER_LONG ==64 +__kernel_long_t tick;/* (modified) usecs between clock ticks */ + +__kernel_long_t ppsfreq;/* pps frequency (scaled ppm) (ro) */ +__kernel_long_t jitter;/* pps jitter (us) (ro) */ +#else long tick;/* (modified) usecs between clock ticks */ -long ppsfreq;/* pps frequency (scaled ppm) (ro) */ -long jitter;/* pps jitter (us) (ro) */ +long ppsfreq;/* pps frequency (scaled ppm) (ro) */ +long jitter;/* pps jitter (us) (ro) */ +#endif int shift;/* interval duration (s) (shift) (ro) */ -long stabil;/* pps stability (scaled ppm) (ro) */ -long jitcnt;/* jitter limit exceeded (ro) */ -long calcnt;/* calibration intervals (ro) */ -long errcnt;/* calibration errors (ro) */ -long stbcnt;/* stability limit exceeded (ro) */ - +#if __BITS_PER_LONG ==64 +__kernel_long_t stabil;/* pps stability (scaled ppm) (ro) */ +__kernel_long_t jitcnt;/* jitter limit exceeded (ro) */ +__kernel_long_t calcnt;/* calibration intervals (ro) */ +__kernel_long_t errcnt;/* calibration errors (ro) */ +__kernel_long_t stbcnt;/* stability limit exceeded (ro) */ + +#else +long stabil;/* pps stability (scaled ppm) (ro) */ +long jitcnt;/* jitter limit exceeded (ro) */ +long calcnt;/* calibration intervals (ro) */ +long errcnt;/* calibration errors (ro) */ +long stbcnt;/* stability limit exceeded (ro) */ +#endif int tai;/* TAI offset (ro) */ int :32; int :32; int :32; int :32;
Signature · 1 line
1.8.4.2
H. Peter Anvin
reviewerRe: [PATCH 1/8] Use __kernel_long_t in struct timex
Quoted 20 lines · H.J. Lu
X32 adjtimex system call is the same as x86-64 adjtimex system call, which uses 64-bit integer for long in struct timex. But x32 long is 32 bit. This patch replaces long in struct timex with
__kernel_long_tif__BITS_PER_LONG== 64.Signed-off-by H.J. Lu <[email protected]>--- include/uapi/linux/timex.h | 46 ++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 38 insertions(+), 8 deletions(-)include/uapi/linux/timex.h +2
-0@@ -63,28 +63,58 @@*/ struct timex {unsigned int modes;/* mode selector */ +#if __BITS_PER_LONG ==64 +__kernel_long_t offset;/* time offset (usec) */
include/uapi/linux/timex.h line 77
Quoted 10 lines
include/uapi/linux/timex.h +5
-0+__kernel_long_t freq;/* frequency offset (scaled ppm) */ +__kernel_long_t maxerror;/* maximum error (usec) */ +__kernel_long_t esterror;/* estimated error (usec) */ +#else long offset;/* time offset (usec) */ long freq;/* frequency offset (scaled ppm) */ long maxerror;/* maximum error (usec) */ long esterror;/* estimated error (usec) */ +#endif int status;/* clock command/status */
I thought we already discussed this? No __BITS_PER_LONG conditionals, please, unless you can strongly motivate them... and if so, we probably should introduce another __kernel type instead.
-hpa
Re: [PATCH 1/8] Use __kernel_long_t in struct timex
In reply to H.J. LuQuoted 19 lines · H.J. Lu
X32 adjtimex system call is the same as x86-64 adjtimex system call, which uses 64-bit integer for long in struct timex. But x32 long is 32 bit. This patch replaces long in struct timex with
__kernel_long_tif__BITS_PER_LONG== 64.Signed-off-by H.J. Lu <[email protected]>--- include/uapi/linux/timex.h | 46 ++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 38 insertions(+), 8 deletions(-)include/uapi/linux/timex.h +1
-0@@ -63,28 +63,58 @@*/ struct timex {unsigned int modes;/* mode selector */ +#if __BITS_PER_LONG ==64
include/uapi/linux/timex.h line 76
Quoted 10 lines
include/uapi/linux/timex.h +6
-0+__kernel_long_t offset;/* time offset (usec) */ +__kernel_long_t freq;/* frequency offset (scaled ppm) */ +__kernel_long_t maxerror;/* maximum error (usec) */ +__kernel_long_t esterror;/* estimated error (usec) */ +#else long offset;/* time offset (usec) */ long freq;/* frequency offset (scaled ppm) */ long maxerror;/* maximum error (usec) */ long esterror;/* estimated error (usec) */ +#endif
These changes should work on arm64 ILP32 as well.
Quoted 5 lines
include/uapi/linux/timex.h +4
-0int status;/* clock command/status */ +#if __BITS_PER_LONG ==64 +__kernel_long_t constant;/* pll time constant */ +__kernel_long_t precision;/* clock precision (usec) (read only) */ +__kernel_long_t tolerance;/* clock frequency tolerance (ppm)
include/uapi/linux/timex.h line 91
Quoted 10 lines
include/uapi/linux/timex.h +4
-0+* (read only) +*/ +#else long constant;/* pll time constant */ long precision;/* clock precision (usec) (read only) */ long tolerance;/* clock frequency tolerance (ppm) * (read only) */ +#endif struct timeval time;/* (read only, except for ADJ_SETOFFSET) */
struct timeval is already defined in terms of __kernel_long_t, so no issues here either.
BTW, could we not avoid the #if and always use __kernel_long_t? This wouldn't break the user ABI.
Signature · 1 line
Catalin
H. Peter Anvin
reviewerRe: [PATCH 1/8] Use __kernel_long_t in struct timex
Quoted 4 lines · Catalin Marinas
BTW, could we not avoid the #if and always use
__kernel_long_t? This wouldn't break the user ABI.
Ah yes, this is the wrong version of the patchset. I already gave that feedback and H.J. posted an update. My bad.
-hpa
Re: [PATCH 1/8] Use __kernel_long_t in struct timex
Quoted 6 lines · H. Peter Anvin
Quoted 2 lines · Catalin Marinas
BTW, could we not avoid the #if and always use
__kernel_long_t? This wouldn't break the user ABI.Ah yes, this is the wrong version of the patchset. I already gave that feedback and H.J. posted an update. My bad.
Ah, I have to dig a newer version then.
Signature · 1 line
Catalin
PATCH 2/8 Use __kernel_long_t/__kernel_ulong_t in <linux/resource.h>
In reply to H.J. LuBoth x32 and x86-64 use the same struct rusage and struct rlimit for system calls. But x32 log is 32-bit. This patch change uapi <linux/resource.h> to use __kernel_long_t in struct rusage and __kernel_ulong_t in and struct rlimit if __BITS_PER_LONG == 64.
--- include/uapi/linux/resource.h | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-)
include/uapi/linux/resource.h +24 -2
@@ -23,6 +23,22 @@struct rusage {struct timeval ru_utime;/* user time used */ struct timeval ru_stime;/* system time used */ +#if __BITS_PER_LONG ==64 +__kernel_long_t ru_maxrss;/* maximum resident set size */ +__kernel_long_t ru_ixrss;/* integral shared memory size */ +__kernel_long_t ru_idrss;/* integral unshared data size */ +__kernel_long_t ru_isrss;/* integral unshared stack size */ +__kernel_long_t ru_minflt;/* page reclaims */ +__kernel_long_t ru_majflt;/* page faults */ +__kernel_long_t ru_nswap;/* swaps */ +__kernel_long_t ru_inblock;/* block input operations */ +__kernel_long_t ru_oublock;/* block output operations */ +__kernel_long_t ru_msgsnd;/* messages sent */ +__kernel_long_t ru_msgrcv;/* messages received */ +__kernel_long_t ru_nsignals;/* signals received */ +__kernel_long_t ru_nvcsw;/* voluntary context switches */ +__kernel_long_t ru_nivcsw;/* involuntary " */ +#else long ru_maxrss;/* maximum resident set size */ long ru_ixrss;/* integral shared memory size */ long ru_idrss;/* integral unshared data size */
@@ -37,11 +53,17 @@ struct rusage {long ru_nsignals;/* signals received */ long ru_nvcsw;/* voluntary context switches */ long ru_nivcsw;/* involuntary " */ +#endif };struct rlimit { -unsigned long rlim_cur; -unsigned long rlim_max; +#if __BITS_PER_LONG ==64 +__kernel_ulong_t rlim_cur; +__kernel_ulong_t rlim_max; +#else +unsigned long rlim_cur; +unsigned long rlim_max; +#endif };#define RLIM64_INFINITY (~0ULL)
Signature · 1 line
1.8.4.2
PATCH 3/8 Use __kernel_ulong_t in uapi struct ipc64_perm
In reply to H.J. LuX32 IPC system call is the same as x86-64 IPC system call, which uses 64-bit integer for unsigned long in struct ipc64_perm. But x32 long is 32 bit. This patch replaces unsigned long in uapi struct ipc64_perm with __kernel_ulong_t if __BITS_PER_LONG == 64.
--- include/uapi/asm-generic/ipcbuf.h | 5 +++++ 1 file changed, 5 insertions(+)
include/uapi/asm-generic/ipcbuf.h +5 -0
@@ -27,8 +27,13 @@ struct ipc64_perm {unsigned char __pad1[4 -sizeof (__kernel_mode_t)];unsigned short seq;unsigned short __pad2; +#if __BITS_PER_LONG ==64 +__kernel_ulong_t __unused1; +__kernel_ulong_t __unused2; +#else unsigned long __unused1;unsigned long __unused2; +#endif };#endif /* __ASM_GENERIC_IPCBUF_H */
Signature · 1 line
1.8.4.2
PATCH 4/8 Use __kernel_long_t in struct msgbuf
In reply to H.J. LuX32 msgsnd/msgrcv system calls are the same as x86-64 msgsnd/msgrcv system calls, which use 64-bit integer for long in struct msgbuf . But x32 long is 32 bit. This patch replaces long in struct msgbuf with __kernel_long_t if __BITS_PER_LONG == 64.
--- include/uapi/linux/msg.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
include/uapi/linux/msg.h +6 -2
@@ -34,8 +34,12 @@ struct msqid_ds {/* message buffer for msgsnd and msgrcv calls */ struct msgbuf { -long mtype;/* type of message */ -char mtext[1 ];/* message text */ +#if __BITS_PER_LONG ==64 +__kernel_long_t mtype;/* type of message */ +#else +long mtype;/* type of message */ +#endif +char mtext[1 ];/* message text */ };/* buffer for msgctl calls IPC_INFO, MSG_INFO */
Signature · 1 line
1.8.4.2
PATCH 5/8 Use __kernel_ulong_t in struct msqid64_ds
In reply to H.J. LuBoth x32 and x86-64 use the same struct msqid64_ds for system calls. But x32 long is 32-bit. This patch replaces unsigned long with __kernel_ulong_t in struct msqid64_ds if __BITS_PER_LONG == 64.
--- include/uapi/asm-generic/msgbuf.h | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-)
include/uapi/asm-generic/msgbuf.h +14 -5
@@ -34,14 +34,23 @@ struct msqid64_ds {__kernel_time_t msg_ctime;/* last change time */ #if __BITS_PER_LONG !=64 unsigned long __unused3; +unsigned long msg_cbytes;/* current number of bytes on queue */ +unsigned long msg_qnum;/* number of messages in queue */ +unsigned long msg_qbytes;/* max number of bytes on queue */ +#else +__kernel_ulong_t msg_cbytes;/* current number of bytes on queue */ +__kernel_ulong_t msg_qnum;/* number of messages in queue */ +__kernel_ulong_t msg_qbytes;/* max number of bytes on queue */ #endif -unsigned long msg_cbytes;/* current number of bytes on queue */ -unsigned long msg_qnum;/* number of messages in queue */ -unsigned long msg_qbytes;/* max number of bytes on queue */ __kernel_pid_t msg_lspid;/* pid of last msgsnd */ __kernel_pid_t msg_lrpid;/* last receive pid */ -unsigned long __unused4; - unsigned long __unused5; +#if __BITS_PER_LONG !=64 +unsigned long __unused4; +unsigned long __unused5; +#else +__kernel_ulong_t __unused4; +__kernel_ulong_t __unused5; +#endif };#endif /* __ASM_GENERIC_MSGBUF_H */
Signature · 1 line
1.8.4.2
PATCH 6/8 Use __kernel_ulong_t in x86 struct semid64_ds
In reply to H.J. LuBoth x32 and x86-64 use the same struct semid64_ds for system calls. But x32 long is 32-bit. This patch replaces unsigned long with __kernel_ulong_t in x86 struct semid64_ds.
--- arch/x86/include/uapi/asm/sembuf.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
arch/x86/include/uapi/asm/sembuf.h +5 -5
@@ -13,12 +13,12 @@struct semid64_ds {struct ipc64_perm sem_perm;/* permissions .. see ipc.h */ __kernel_time_t sem_otime;/* last semop time */ -unsigned long __unused1; +__kernel_ulong_t __unused1;__kernel_time_t sem_ctime;/* last change time */ -unsigned long __unused2; -unsigned long sem_nsems;/* no. of semaphores in array */ -unsigned long __unused3; -unsigned long __unused4; +__kernel_ulong_t __unused2; +__kernel_ulong_t sem_nsems;/* no. of semaphores in array */ +__kernel_ulong_t __unused3; +__kernel_ulong_t __unused4; };#endif /* _ASM_X86_SEMBUF_H */
Signature · 1 line
1.8.4.2
Re: [PATCH 6/8] Use __kernel_ulong_t in x86 struct semid64_ds
Quoted 19 lines · H.J. Lu
Both x32 and x86-64 use the same struct
semid64_dsfor system calls. But x32 long is 32-bit. This patch replaces unsigned long with__kernel_ulong_tin x86 structsemid64_ds.Signed-off-by H.J. Lu <[email protected]>--- arch/x86/include/uapi/asm/sembuf.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)arch/x86/include/uapi/asm/sembuf.h +1
-1@@ -13,12 +13,12 @@struct semid64_ds {struct ipc64_perm sem_perm;/* permissions .. see ipc.h */ __kernel_time_t sem_otime;/* last semop time */ -unsigned long __unused1; +__kernel_ulong_t __unused1;
arch/x86/include/uapi/asm/sembuf.h line 22
Quoted 10 lines
arch/x86/include/uapi/asm/sembuf.h +4
-4__kernel_time_t sem_ctime;/* last change time */ -unsigned long __unused2; -unsigned long sem_nsems;/* no. of semaphores in array */ -unsigned long __unused3; -unsigned long __unused4; +__kernel_ulong_t __unused2; +__kernel_ulong_t sem_nsems;/* no. of semaphores in array */ +__kernel_ulong_t __unused3; +__kernel_ulong_t __unused4; };
Since you are at this, could you please change the include/uapi/asm-generic/sembuf.h structure as well?
Signature · 1 line
Catalin
Re: [PATCH 6/8] Use __kernel_ulong_t in x86 struct semid64_ds
Quoted 25 lines · Catalin Marinas
Quoted 24 lines · H.J. Lu
Both x32 and x86-64 use the same struct
semid64_dsfor system calls. But x32 long is 32-bit. This patch replaces unsigned long with__kernel_ulong_tin x86 structsemid64_ds.Signed-off-by H.J. Lu <[email protected]>--- arch/x86/include/uapi/asm/sembuf.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)arch/x86/include/uapi/asm/sembuf.h +1
-5@@ -13,12 +13,12 @@struct semid64_ds {struct ipc64_perm sem_perm;/* permissions .. see ipc.h */ __kernel_time_t sem_otime;/* last semop time */ -unsigned long __unused1; +__kernel_ulong_t __unused1;__kernel_time_t sem_ctime;/* last change time */ -unsigned long __unused2; -unsigned long sem_nsems;/* no. of semaphores in array */ -unsigned long __unused3; -unsigned long __unused4;
Quoted 9 lines
arch/x86/include/uapi/asm/sembuf.h line 22
Quoted 5 lines
arch/x86/include/uapi/asm/sembuf.h +4
-0+__kernel_ulong_t __unused2; +__kernel_ulong_t sem_nsems;/* no. of semaphores in array */ +__kernel_ulong_t __unused3; +__kernel_ulong_t __unused4; };Since you are at this, could you please change the
include/uapi/asm-generic/sembuf.hstructure as well?
I could, but my build doesn't use that header file. I prefer not to change something I can't test.
I am enclosing a program to check kernel uabi header files against glibc header files. You can try it on ILP32 ARM64.
Signature · 1 line
H.J.
Re: [PATCH 6/8] Use __kernel_ulong_t in x86 struct semid64_ds
Quoted 36 lines · H.J. Lu
Quoted 25 lines · Catalin Marinas
Quoted 24 lines · H.J. Lu
Both x32 and x86-64 use the same struct
semid64_dsfor system calls. But x32 long is 32-bit. This patch replaces unsigned long with__kernel_ulong_tin x86 structsemid64_ds.Signed-off-by H.J. Lu <[email protected]>--- arch/x86/include/uapi/asm/sembuf.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)arch/x86/include/uapi/asm/sembuf.h +1
-5@@ -13,12 +13,12 @@struct semid64_ds {struct ipc64_perm sem_perm;/* permissions .. see ipc.h */ __kernel_time_t sem_otime;/* last semop time */ -unsigned long __unused1; +__kernel_ulong_t __unused1;__kernel_time_t sem_ctime;/* last change time */ -unsigned long __unused2; -unsigned long sem_nsems;/* no. of semaphores in array */ -unsigned long __unused3; -unsigned long __unused4;Quoted 8 lines
arch/x86/include/uapi/asm/sembuf.h line 22
Quoted 5 lines
arch/x86/include/uapi/asm/sembuf.h +4
-0+__kernel_ulong_t __unused2; +__kernel_ulong_t sem_nsems;/* no. of semaphores in array */ +__kernel_ulong_t __unused3; +__kernel_ulong_t __unused4; };Since you are at this, could you please change the
include/uapi/asm-generic/sembuf.hstructure as well?
Quoted 2 lines
I could, but my build doesn't use that header file. I prefer not to change something I can't test.
OK, it makes sense.
Quoted 2 lines
I am enclosing a program to check kernel uabi header files against glibc header files. You can try it on ILP32 ARM64.
Thanks, very useful. We'll give it a try when we get there. So far I NAK'ed the first set of arm64 ILP32 patches as they were mostly using the compat ABI (https://lkml.org/lkml/2013/9/9/502).
Signature · 1 line
Catalin
H. Peter Anvin
reviewerRe: [PATCH 6/8] Use __kernel_ulong_t in x86 struct semid64_ds
Quoted 5 lines · Catalin Marinas
Thanks, very useful. We'll give it a try when we get there. So far I NAK'ed the first set of arm64 ILP32 patches as they were mostly using the compat ABI (https://lkml.org/lkml/2013/9/9/502).
That's mostly where we started out, too.
-hpa
PATCH 7/8 Use __kernel_ulong_t in shmid64_ds/shminfo64/shm_info
In reply to H.J. LuBoth x32 and x86-64 use the same struct shmid64_ds/shminfo64/shm_info for system calls. But x32 long is 32-bit. This patch replaces unsigned long with __kernel_ulong_t in struct shmid64_ds/shminfo64/shm_info if __BITS_PER_LONG == 64.
--- include/uapi/asm-generic/shmbuf.h | 36 +++++++++++++++++++++++++++--------- include/uapi/linux/shm.h | 14 +++++++++++--- 2 files changed, 38 insertions(+), 12 deletions(-)
include/uapi/asm-generic/shmbuf.h +27 -9
@@ -39,21 +39,39 @@ struct shmid64_ds {#endif __kernel_pid_t shm_cpid;/* pid of creator */ __kernel_pid_t shm_lpid;/* pid of last operator */ +#if __BITS_PER_LONG !=64 unsigned long shm_nattch;/* no. of current attaches */ unsigned long __unused4;unsigned long __unused5; +#else +__kernel_ulong_t shm_nattch;/* no. of current attaches */ +__kernel_ulong_t __unused4; +__kernel_ulong_t __unused5; +#endif };struct shminfo64 { -unsigned long shmmax; -unsigned long shmmin; -unsigned long shmmni; -unsigned long shmseg; -unsigned long shmall; -unsigned long __unused1; -unsigned long __unused2; -unsigned long __unused3; -unsigned long __unused4; +#if __BITS_PER_LONG !=64 +unsigned long shmmax; +unsigned long shmmin; +unsigned long shmmni; +unsigned long shmseg; +unsigned long shmall; +unsigned long __unused1; +unsigned long __unused2; +unsigned long __unused3; +unsigned long __unused4; +#else +__kernel_ulong_t shmmax; +__kernel_ulong_t shmmin; +__kernel_ulong_t shmmni; +__kernel_ulong_t shmseg; +__kernel_ulong_t shmall; +__kernel_ulong_t __unused1; +__kernel_ulong_t __unused2; +__kernel_ulong_t __unused3; +__kernel_ulong_t __unused4; +#endif };#endif /* __ASM_GENERIC_SHMBUF_H */
include/uapi/linux/shm.h +11 -3
@@ -68,11 +68,19 @@ struct shminfo {struct shm_info {int used_ids; -unsigned long shm_tot;/* total allocated shm */ -unsigned long shm_rss;/* total resident shm */ -unsigned long shm_swp;/* total swapped shm */ +#if __BITS_PER_LONG ==64 +__kernel_ulong_t shm_tot;/* total allocated shm */ +__kernel_ulong_t shm_rss;/* total resident shm */ +__kernel_ulong_t shm_swp;/* total swapped shm */ +__kernel_ulong_t swap_attempts; +__kernel_ulong_t swap_successes; +#else +unsigned long shm_tot;/* total allocated shm */ +unsigned long shm_rss;/* total resident shm */ +unsigned long shm_swp;/* total swapped shm */ unsigned long swap_attempts;unsigned long swap_successes; +#endif };
Signature · 1 line
1.8.4.2
PATCH 8/8 Use __kernel_long_t in struct mq_attr
In reply to H.J. LuBoth x32 and x86-64 use the same struct mq_attr for system calls. But x32 long is 32-bit. This patch replaces long with __kernel_long_t in struct mq_attr if __BITS_PER_LONG == 64.
--- include/uapi/linux/mqueue.h | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-)
include/uapi/linux/mqueue.h +13 -5
@@ -23,11 +23,19 @@#define MQ_BYTES_MAX 819200struct mq_attr { -long mq_flags;/* message queue flags */ -long mq_maxmsg;/* maximum number of messages */ -long mq_msgsize;/* maximum message size */ -long mq_curmsgs;/* number of messages currently queued */ -long __reserved[4 ];/* ignored for input, zeroed for output */ +#if __BITS_PER_LONG ==64 +__kernel_long_t mq_flags;/* message queue flags */ +__kernel_long_t mq_maxmsg;/* maximum number of messages */ +__kernel_long_t mq_msgsize;/* maximum message size */ +__kernel_long_t mq_curmsgs;/* number of messages currently queued */ +__kernel_long_t __reserved[4 ];/* ignored for input, zeroed for output */ +#else +long mq_flags;/* message queue flags */ +long mq_maxmsg;/* maximum number of messages */ +long mq_msgsize;/* maximum message size */ +long mq_curmsgs;/* number of messages currently queued */ +long __reserved[4 ];/* ignored for input, zeroed for output */ +#endif };/*
Signature · 1 line
1.8.4.2