162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
262306a36Sopenharmony_ci#ifndef __ASM_GENERIC_SHMBUF_H
362306a36Sopenharmony_ci#define __ASM_GENERIC_SHMBUF_H
462306a36Sopenharmony_ci
562306a36Sopenharmony_ci#include <asm/bitsperlong.h>
662306a36Sopenharmony_ci#include <asm/ipcbuf.h>
762306a36Sopenharmony_ci#include <asm/posix_types.h>
862306a36Sopenharmony_ci
962306a36Sopenharmony_ci/*
1062306a36Sopenharmony_ci * The shmid64_ds structure for x86 architecture.
1162306a36Sopenharmony_ci * Note extra padding because this structure is passed back and forth
1262306a36Sopenharmony_ci * between kernel and user space.
1362306a36Sopenharmony_ci *
1462306a36Sopenharmony_ci * shmid64_ds was originally meant to be architecture specific, but
1562306a36Sopenharmony_ci * everyone just ended up making identical copies without specific
1662306a36Sopenharmony_ci * optimizations, so we may just as well all use the same one.
1762306a36Sopenharmony_ci *
1862306a36Sopenharmony_ci * 64 bit architectures use a 64-bit long time field here, while
1962306a36Sopenharmony_ci * 32 bit architectures have a pair of unsigned long values.
2062306a36Sopenharmony_ci * On big-endian systems, the lower half is in the wrong place.
2162306a36Sopenharmony_ci *
2262306a36Sopenharmony_ci *
2362306a36Sopenharmony_ci * Pad space is left for:
2462306a36Sopenharmony_ci * - 2 miscellaneous 32-bit values
2562306a36Sopenharmony_ci */
2662306a36Sopenharmony_ci
2762306a36Sopenharmony_cistruct shmid64_ds {
2862306a36Sopenharmony_ci	struct ipc64_perm	shm_perm;	/* operation perms */
2962306a36Sopenharmony_ci	__kernel_size_t		shm_segsz;	/* size of segment (bytes) */
3062306a36Sopenharmony_ci#if __BITS_PER_LONG == 64
3162306a36Sopenharmony_ci	long			shm_atime;	/* last attach time */
3262306a36Sopenharmony_ci	long			shm_dtime;	/* last detach time */
3362306a36Sopenharmony_ci	long			shm_ctime;	/* last change time */
3462306a36Sopenharmony_ci#else
3562306a36Sopenharmony_ci	unsigned long		shm_atime;	/* last attach time */
3662306a36Sopenharmony_ci	unsigned long		shm_atime_high;
3762306a36Sopenharmony_ci	unsigned long		shm_dtime;	/* last detach time */
3862306a36Sopenharmony_ci	unsigned long		shm_dtime_high;
3962306a36Sopenharmony_ci	unsigned long		shm_ctime;	/* last change time */
4062306a36Sopenharmony_ci	unsigned long		shm_ctime_high;
4162306a36Sopenharmony_ci#endif
4262306a36Sopenharmony_ci	__kernel_pid_t		shm_cpid;	/* pid of creator */
4362306a36Sopenharmony_ci	__kernel_pid_t		shm_lpid;	/* pid of last operator */
4462306a36Sopenharmony_ci	unsigned long		shm_nattch;	/* no. of current attaches */
4562306a36Sopenharmony_ci	unsigned long		__unused4;
4662306a36Sopenharmony_ci	unsigned long		__unused5;
4762306a36Sopenharmony_ci};
4862306a36Sopenharmony_ci
4962306a36Sopenharmony_cistruct shminfo64 {
5062306a36Sopenharmony_ci	unsigned long		shmmax;
5162306a36Sopenharmony_ci	unsigned long		shmmin;
5262306a36Sopenharmony_ci	unsigned long		shmmni;
5362306a36Sopenharmony_ci	unsigned long		shmseg;
5462306a36Sopenharmony_ci	unsigned long		shmall;
5562306a36Sopenharmony_ci	unsigned long		__unused1;
5662306a36Sopenharmony_ci	unsigned long		__unused2;
5762306a36Sopenharmony_ci	unsigned long		__unused3;
5862306a36Sopenharmony_ci	unsigned long		__unused4;
5962306a36Sopenharmony_ci};
6062306a36Sopenharmony_ci
6162306a36Sopenharmony_ci#endif /* __ASM_GENERIC_SHMBUF_H */
62