xref: /original-bsd/sys/sys/shm.h (revision 7a38d872)
1 /*
2  * Copyright (c) 1988 University of Utah.
3  * Copyright (c) 1990, 1993
4  *	The Regents of the University of California.  All rights reserved.
5  *
6  * This code is derived from software contributed to Berkeley by
7  * the Systems Programming Group of the University of Utah Computer
8  * Science Department.
9  *
10  * %sccs.include.proprietary.c%
11  *
12  *	@(#)shm.h	8.4 (Berkeley) 01/11/94
13  */
14 
15 /*
16  * SVID compatible shm.h file
17  */
18 #ifndef _SYS_SHM_H_
19 #define _SYS_SHM_H_
20 
21 #include <sys/ipc.h>
22 
23 struct shmid_ds {
24 	struct	ipc_perm shm_perm;	/* operation perms */
25 	int	shm_segsz;		/* size of segment (bytes) */
26 	ushort	shm_cpid;		/* pid, creator */
27 	ushort	shm_lpid;		/* pid, last operation */
28 	short	shm_nattch;		/* no. of current attaches */
29 	time_t	shm_atime;		/* last attach time */
30 	time_t	shm_dtime;		/* last detach time */
31 	time_t	shm_ctime;		/* last change time */
32 	void	*shm_handle;		/* internal handle for shm segment */
33 };
34 
35 /*
36  * System 5 style catch-all structure for shared memory constants that
37  * might be of interest to user programs.  Do we really want/need this?
38  */
39 struct	shminfo {
40 	int	shmmax;		/* max shared memory segment size (bytes) */
41 	int	shmmin;		/* min shared memory segment size (bytes) */
42 	int	shmmni;		/* max number of shared memory identifiers */
43 	int	shmseg;		/* max shared memory segments per process */
44 	int	shmall;		/* max amount of shared memory (pages) */
45 };
46 
47 /* internal "mode" bits */
48 #define	SHM_ALLOC	01000	/* segment is allocated */
49 #define	SHM_DEST	02000	/* segment will be destroyed on last detach */
50 
51 /* SVID required constants (same values as system 5) */
52 #define	SHM_RDONLY	010000	/* read-only access */
53 #define	SHM_RND		020000	/* round attach address to SHMLBA boundary */
54 
55 /* implementation constants */
56 #define	SHMLBA		CLBYTES	/* segment low boundary address multiple */
57 #define	SHMMMNI		512	/* maximum value for shminfo.shmmni */
58 
59 #ifdef KERNEL
60 struct	shmid_ds	*shmsegs;
61 struct	shminfo		shminfo;
62 #endif
63 
64 #endif /* !_SYS_SHM_H_ */
65