1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 2*4882a593Smuzhiyun #ifndef __ASM_GENERIC_SEMBUF_H 3*4882a593Smuzhiyun #define __ASM_GENERIC_SEMBUF_H 4*4882a593Smuzhiyun 5*4882a593Smuzhiyun #include <asm/bitsperlong.h> 6*4882a593Smuzhiyun #include <asm/ipcbuf.h> 7*4882a593Smuzhiyun 8*4882a593Smuzhiyun /* 9*4882a593Smuzhiyun * The semid64_ds structure for x86 architecture. 10*4882a593Smuzhiyun * Note extra padding because this structure is passed back and forth 11*4882a593Smuzhiyun * between kernel and user space. 12*4882a593Smuzhiyun * 13*4882a593Smuzhiyun * semid64_ds was originally meant to be architecture specific, but 14*4882a593Smuzhiyun * everyone just ended up making identical copies without specific 15*4882a593Smuzhiyun * optimizations, so we may just as well all use the same one. 16*4882a593Smuzhiyun * 17*4882a593Smuzhiyun * 64 bit architectures use a 64-bit long time field here, while 18*4882a593Smuzhiyun * 32 bit architectures have a pair of unsigned long values. 19*4882a593Smuzhiyun * 20*4882a593Smuzhiyun * On big-endian systems, the padding is in the wrong place for 21*4882a593Smuzhiyun * historic reasons, so user space has to reconstruct a time_t 22*4882a593Smuzhiyun * value using 23*4882a593Smuzhiyun * 24*4882a593Smuzhiyun * user_semid_ds.sem_otime = kernel_semid64_ds.sem_otime + 25*4882a593Smuzhiyun * ((long long)kernel_semid64_ds.sem_otime_high << 32) 26*4882a593Smuzhiyun * 27*4882a593Smuzhiyun * Pad space is left for 2 miscellaneous 32-bit values 28*4882a593Smuzhiyun */ 29*4882a593Smuzhiyun struct semid64_ds { 30*4882a593Smuzhiyun struct ipc64_perm sem_perm; /* permissions .. see ipc.h */ 31*4882a593Smuzhiyun #if __BITS_PER_LONG == 64 32*4882a593Smuzhiyun long sem_otime; /* last semop time */ 33*4882a593Smuzhiyun long sem_ctime; /* last change time */ 34*4882a593Smuzhiyun #else 35*4882a593Smuzhiyun unsigned long sem_otime; /* last semop time */ 36*4882a593Smuzhiyun unsigned long sem_otime_high; 37*4882a593Smuzhiyun unsigned long sem_ctime; /* last change time */ 38*4882a593Smuzhiyun unsigned long sem_ctime_high; 39*4882a593Smuzhiyun #endif 40*4882a593Smuzhiyun unsigned long sem_nsems; /* no. of semaphores in array */ 41*4882a593Smuzhiyun unsigned long __unused3; 42*4882a593Smuzhiyun unsigned long __unused4; 43*4882a593Smuzhiyun }; 44*4882a593Smuzhiyun 45*4882a593Smuzhiyun #endif /* __ASM_GENERIC_SEMBUF_H */ 46