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