xref: /original-bsd/sys/sys/shm.h (revision 95ecee29)
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.2 (Berkeley) 09/22/93
13  */
14 
15 /*
16  * SVID compatible shm.h file
17  */
18 #ifndef _SHM_H_
19 #define _SHM_H_
20 
21 #ifdef KERNEL
22 #include "ipc.h"
23 #else
24 #include <sys/ipc.h>
25 #endif
26 
27 struct shmid_ds {
28 	struct	ipc_perm shm_perm;	/* operation perms */
29 	int	shm_segsz;		/* size of segment (bytes) */
30 	ushort	shm_cpid;		/* pid, creator */
31 	ushort	shm_lpid;		/* pid, last operation */
32 	short	shm_nattch;		/* no. of current attaches */
33 	time_t	shm_atime;		/* last attach time */
34 	time_t	shm_dtime;		/* last detach time */
35 	time_t	shm_ctime;		/* last change time */
36 	void	*shm_handle;		/* internal handle for shm segment */
37 };
38 
39 /*
40  * System 5 style catch-all structure for shared memory constants that
41  * might be of interest to user programs.  Do we really want/need this?
42  */
43 struct	shminfo {
44 	int	shmmax;		/* max shared memory segment size (bytes) */
45 	int	shmmin;		/* min shared memory segment size (bytes) */
46 	int	shmmni;		/* max number of shared memory identifiers */
47 	int	shmseg;		/* max shared memory segments per process */
48 	int	shmall;		/* max amount of shared memory (pages) */
49 };
50 
51 /* internal "mode" bits */
52 #define	SHM_ALLOC	01000	/* segment is allocated */
53 #define	SHM_DEST	02000	/* segment will be destroyed on last detach */
54 
55 /* SVID required constants (same values as system 5) */
56 #define	SHM_RDONLY	010000	/* read-only access */
57 #define	SHM_RND		020000	/* round attach address to SHMLBA boundary */
58 
59 /* implementation constants */
60 #define	SHMLBA		CLBYTES	/* segment low boundary address multiple */
61 #define	SHMMMNI		512	/* maximum value for shminfo.shmmni */
62 
63 #ifdef KERNEL
64 struct	shmid_ds	*shmsegs;
65 struct	shminfo		shminfo;
66 #endif
67 
68 #endif /* !_SHM_H_ */
69