18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
28c2ecf20Sopenharmony_ci#ifndef __ASM_GENERIC_SHMBUF_H
38c2ecf20Sopenharmony_ci#define __ASM_GENERIC_SHMBUF_H
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ci#include <asm/bitsperlong.h>
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ci/*
88c2ecf20Sopenharmony_ci * The shmid64_ds structure for x86 architecture.
98c2ecf20Sopenharmony_ci * Note extra padding because this structure is passed back and forth
108c2ecf20Sopenharmony_ci * between kernel and user space.
118c2ecf20Sopenharmony_ci *
128c2ecf20Sopenharmony_ci * shmid64_ds was originally meant to be architecture specific, but
138c2ecf20Sopenharmony_ci * everyone just ended up making identical copies without specific
148c2ecf20Sopenharmony_ci * optimizations, so we may just as well all use the same one.
158c2ecf20Sopenharmony_ci *
168c2ecf20Sopenharmony_ci * 64 bit architectures use a 64-bit long time field here, while
178c2ecf20Sopenharmony_ci * 32 bit architectures have a pair of unsigned long values.
188c2ecf20Sopenharmony_ci * On big-endian systems, the lower half is in the wrong place.
198c2ecf20Sopenharmony_ci *
208c2ecf20Sopenharmony_ci *
218c2ecf20Sopenharmony_ci * Pad space is left for:
228c2ecf20Sopenharmony_ci * - 2 miscellaneous 32-bit values
238c2ecf20Sopenharmony_ci */
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_cistruct shmid64_ds {
268c2ecf20Sopenharmony_ci	struct ipc64_perm	shm_perm;	/* operation perms */
278c2ecf20Sopenharmony_ci	size_t			shm_segsz;	/* size of segment (bytes) */
288c2ecf20Sopenharmony_ci#if __BITS_PER_LONG == 64
298c2ecf20Sopenharmony_ci	long			shm_atime;	/* last attach time */
308c2ecf20Sopenharmony_ci	long			shm_dtime;	/* last detach time */
318c2ecf20Sopenharmony_ci	long			shm_ctime;	/* last change time */
328c2ecf20Sopenharmony_ci#else
338c2ecf20Sopenharmony_ci	unsigned long		shm_atime;	/* last attach time */
348c2ecf20Sopenharmony_ci	unsigned long		shm_atime_high;
358c2ecf20Sopenharmony_ci	unsigned long		shm_dtime;	/* last detach time */
368c2ecf20Sopenharmony_ci	unsigned long		shm_dtime_high;
378c2ecf20Sopenharmony_ci	unsigned long		shm_ctime;	/* last change time */
388c2ecf20Sopenharmony_ci	unsigned long		shm_ctime_high;
398c2ecf20Sopenharmony_ci#endif
408c2ecf20Sopenharmony_ci	__kernel_pid_t		shm_cpid;	/* pid of creator */
418c2ecf20Sopenharmony_ci	__kernel_pid_t		shm_lpid;	/* pid of last operator */
428c2ecf20Sopenharmony_ci	unsigned long		shm_nattch;	/* no. of current attaches */
438c2ecf20Sopenharmony_ci	unsigned long		__unused4;
448c2ecf20Sopenharmony_ci	unsigned long		__unused5;
458c2ecf20Sopenharmony_ci};
468c2ecf20Sopenharmony_ci
478c2ecf20Sopenharmony_cistruct shminfo64 {
488c2ecf20Sopenharmony_ci	unsigned long		shmmax;
498c2ecf20Sopenharmony_ci	unsigned long		shmmin;
508c2ecf20Sopenharmony_ci	unsigned long		shmmni;
518c2ecf20Sopenharmony_ci	unsigned long		shmseg;
528c2ecf20Sopenharmony_ci	unsigned long		shmall;
538c2ecf20Sopenharmony_ci	unsigned long		__unused1;
548c2ecf20Sopenharmony_ci	unsigned long		__unused2;
558c2ecf20Sopenharmony_ci	unsigned long		__unused3;
568c2ecf20Sopenharmony_ci	unsigned long		__unused4;
578c2ecf20Sopenharmony_ci};
588c2ecf20Sopenharmony_ci
598c2ecf20Sopenharmony_ci#endif /* __ASM_GENERIC_SHMBUF_H */
60