Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
0002 #ifndef __ASM_GENERIC_SEMBUF_H
0003 #define __ASM_GENERIC_SEMBUF_H
0004 
0005 #include <asm/bitsperlong.h>
0006 #include <asm/ipcbuf.h>
0007 
0008 /*
0009  * The semid64_ds structure for most architectures (though it came from x86_32
0010  * originally). Note extra padding because this structure is passed back and
0011  * forth between kernel and user space.
0012  *
0013  * semid64_ds was originally meant to be architecture specific, but
0014  * everyone just ended up making identical copies without specific
0015  * optimizations, so we may just as well all use the same one.
0016  *
0017  * 64 bit architectures use a 64-bit long time field here, while
0018  * 32 bit architectures have a pair of unsigned long values.
0019  *
0020  * On big-endian systems, the padding is in the wrong place for
0021  * historic reasons, so user space has to reconstruct a time_t
0022  * value using
0023  *
0024  * user_semid_ds.sem_otime = kernel_semid64_ds.sem_otime +
0025  *      ((long long)kernel_semid64_ds.sem_otime_high << 32)
0026  *
0027  * Pad space is left for 2 miscellaneous 32-bit values
0028  */
0029 struct semid64_ds {
0030     struct ipc64_perm sem_perm; /* permissions .. see ipc.h */
0031 #if __BITS_PER_LONG == 64
0032     long        sem_otime;  /* last semop time */
0033     long        sem_ctime;  /* last change time */
0034 #else
0035     unsigned long   sem_otime;  /* last semop time */
0036     unsigned long   sem_otime_high;
0037     unsigned long   sem_ctime;  /* last change time */
0038     unsigned long   sem_ctime_high;
0039 #endif
0040     unsigned long   sem_nsems;  /* no. of semaphores in array */
0041     unsigned long   __unused3;
0042     unsigned long   __unused4;
0043 };
0044 
0045 #endif /* __ASM_GENERIC_SEMBUF_H */