18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 28c2ecf20Sopenharmony_ci#ifndef __ASM_GENERIC_SEMBUF_H 38c2ecf20Sopenharmony_ci#define __ASM_GENERIC_SEMBUF_H 48c2ecf20Sopenharmony_ci 58c2ecf20Sopenharmony_ci#include <asm/bitsperlong.h> 68c2ecf20Sopenharmony_ci#include <asm/ipcbuf.h> 78c2ecf20Sopenharmony_ci 88c2ecf20Sopenharmony_ci/* 98c2ecf20Sopenharmony_ci * The semid64_ds structure for x86 architecture. 108c2ecf20Sopenharmony_ci * Note extra padding because this structure is passed back and forth 118c2ecf20Sopenharmony_ci * between kernel and user space. 128c2ecf20Sopenharmony_ci * 138c2ecf20Sopenharmony_ci * semid64_ds was originally meant to be architecture specific, but 148c2ecf20Sopenharmony_ci * everyone just ended up making identical copies without specific 158c2ecf20Sopenharmony_ci * optimizations, so we may just as well all use the same one. 168c2ecf20Sopenharmony_ci * 178c2ecf20Sopenharmony_ci * 64 bit architectures use a 64-bit long time field here, while 188c2ecf20Sopenharmony_ci * 32 bit architectures have a pair of unsigned long values. 198c2ecf20Sopenharmony_ci * 208c2ecf20Sopenharmony_ci * On big-endian systems, the padding is in the wrong place for 218c2ecf20Sopenharmony_ci * historic reasons, so user space has to reconstruct a time_t 228c2ecf20Sopenharmony_ci * value using 238c2ecf20Sopenharmony_ci * 248c2ecf20Sopenharmony_ci * user_semid_ds.sem_otime = kernel_semid64_ds.sem_otime + 258c2ecf20Sopenharmony_ci * ((long long)kernel_semid64_ds.sem_otime_high << 32) 268c2ecf20Sopenharmony_ci * 278c2ecf20Sopenharmony_ci * Pad space is left for 2 miscellaneous 32-bit values 288c2ecf20Sopenharmony_ci */ 298c2ecf20Sopenharmony_cistruct semid64_ds { 308c2ecf20Sopenharmony_ci struct ipc64_perm sem_perm; /* permissions .. see ipc.h */ 318c2ecf20Sopenharmony_ci#if __BITS_PER_LONG == 64 328c2ecf20Sopenharmony_ci long sem_otime; /* last semop time */ 338c2ecf20Sopenharmony_ci long sem_ctime; /* last change time */ 348c2ecf20Sopenharmony_ci#else 358c2ecf20Sopenharmony_ci unsigned long sem_otime; /* last semop time */ 368c2ecf20Sopenharmony_ci unsigned long sem_otime_high; 378c2ecf20Sopenharmony_ci unsigned long sem_ctime; /* last change time */ 388c2ecf20Sopenharmony_ci unsigned long sem_ctime_high; 398c2ecf20Sopenharmony_ci#endif 408c2ecf20Sopenharmony_ci unsigned long sem_nsems; /* no. of semaphores in array */ 418c2ecf20Sopenharmony_ci unsigned long __unused3; 428c2ecf20Sopenharmony_ci unsigned long __unused4; 438c2ecf20Sopenharmony_ci}; 448c2ecf20Sopenharmony_ci 458c2ecf20Sopenharmony_ci#endif /* __ASM_GENERIC_SEMBUF_H */ 46