16f52b16cSGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 28a1ab315SDavid Howells #ifndef __ASM_GENERIC_SEMBUF_H 38a1ab315SDavid Howells #define __ASM_GENERIC_SEMBUF_H 48a1ab315SDavid Howells 58a1ab315SDavid Howells #include <asm/bitsperlong.h> 60fb9dc28SMasahiro Yamada #include <asm/ipcbuf.h> 78a1ab315SDavid Howells 88a1ab315SDavid Howells /* 9*2a45a08aSViresh Kumar * The semid64_ds structure for most architectures (though it came from x86_32 10*2a45a08aSViresh Kumar * originally). Note extra padding because this structure is passed back and 11*2a45a08aSViresh Kumar * forth between kernel and user space. 128a1ab315SDavid Howells * 138a1ab315SDavid Howells * semid64_ds was originally meant to be architecture specific, but 148a1ab315SDavid Howells * everyone just ended up making identical copies without specific 158a1ab315SDavid Howells * optimizations, so we may just as well all use the same one. 168a1ab315SDavid Howells * 17caf5e32dSArnd Bergmann * 64 bit architectures use a 64-bit long time field here, while 18f991f015SArnd Bergmann * 32 bit architectures have a pair of unsigned long values. 198a1ab315SDavid Howells * 20f991f015SArnd Bergmann * On big-endian systems, the padding is in the wrong place for 21f991f015SArnd Bergmann * historic reasons, so user space has to reconstruct a time_t 22f991f015SArnd Bergmann * value using 23f991f015SArnd Bergmann * 24f991f015SArnd Bergmann * user_semid_ds.sem_otime = kernel_semid64_ds.sem_otime + 25f991f015SArnd Bergmann * ((long long)kernel_semid64_ds.sem_otime_high << 32) 26f991f015SArnd Bergmann * 27f991f015SArnd Bergmann * Pad space is left for 2 miscellaneous 32-bit values 288a1ab315SDavid Howells */ 298a1ab315SDavid Howells struct semid64_ds { 308a1ab315SDavid Howells struct ipc64_perm sem_perm; /* permissions .. see ipc.h */ 31f991f015SArnd Bergmann #if __BITS_PER_LONG == 64 32caf5e32dSArnd Bergmann long sem_otime; /* last semop time */ 33caf5e32dSArnd Bergmann long sem_ctime; /* last change time */ 34f991f015SArnd Bergmann #else 35f991f015SArnd Bergmann unsigned long sem_otime; /* last semop time */ 36f991f015SArnd Bergmann unsigned long sem_otime_high; 37f991f015SArnd Bergmann unsigned long sem_ctime; /* last change time */ 38f991f015SArnd Bergmann unsigned long sem_ctime_high; 398a1ab315SDavid Howells #endif 408a1ab315SDavid Howells unsigned long sem_nsems; /* no. of semaphores in array */ 418a1ab315SDavid Howells unsigned long __unused3; 428a1ab315SDavid Howells unsigned long __unused4; 438a1ab315SDavid Howells }; 448a1ab315SDavid Howells 458a1ab315SDavid Howells #endif /* __ASM_GENERIC_SEMBUF_H */ 46