386BSD 0.1 development
[unix-history] / usr / src / sys.386bsd / sys / shm.h
CommitLineData
b688fc87
WJ
1/*
2 * Copyright (c) 1988 University of Utah.
3 * Copyright (c) 1990 The Regents of the University of California.
4 * 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 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 * 3. All advertising materials mentioning features or use of this software
19 * must display the following acknowledgement:
20 * This product includes software developed by the University of
21 * California, Berkeley and its contributors.
22 * 4. Neither the name of the University nor the names of its contributors
23 * may be used to endorse or promote products derived from this software
24 * without specific prior written permission.
25 *
26 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
27 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
30 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 * SUCH DAMAGE.
37 *
38 * @(#)shm.h 7.2 (Berkeley) 2/5/91
39 */
40
41/*
42 * SVID compatible shm.h file
43 */
44#ifndef _SHM_H_
45#define _SHM_H_
46
47#ifdef KERNEL
48#include "ipc.h"
49#else
50#include <sys/ipc.h>
51#endif
52
53struct shmid_ds {
54 struct ipc_perm shm_perm; /* operation perms */
55 int shm_segsz; /* size of segment (bytes) */
56 ushort shm_cpid; /* pid, creator */
57 ushort shm_lpid; /* pid, last operation */
58 short shm_nattch; /* no. of current attaches */
59 time_t shm_atime; /* last attach time */
60 time_t shm_dtime; /* last detach time */
61 time_t shm_ctime; /* last change time */
62 void *shm_handle; /* internal handle for shm segment */
63};
64
65/*
66 * System 5 style catch-all structure for shared memory constants that
67 * might be of interest to user programs. Do we really want/need this?
68 */
69struct shminfo {
70 int shmmax; /* max shared memory segment size (bytes) */
71 int shmmin; /* min shared memory segment size (bytes) */
72 int shmmni; /* max number of shared memory identifiers */
73 int shmseg; /* max shared memory segments per process */
74 int shmall; /* max amount of shared memory (pages) */
75};
76
77/* internal "mode" bits */
78#define SHM_ALLOC 01000 /* segment is allocated */
79#define SHM_DEST 02000 /* segment will be destroyed on last detach */
80
81/* SVID required constants (same values as system 5) */
82#define SHM_RDONLY 010000 /* read-only access */
83#define SHM_RND 020000 /* round attach address to SHMLBA boundary */
84
85/* implementation constants */
86#define SHMLBA CLBYTES /* segment low boundary address multiple */
87#define SHMMMNI 512 /* maximum value for shminfo.shmmni */
88
89#ifdef KERNEL
90struct shmid_ds *shmsegs;
91struct shminfo shminfo;
92#endif
93
94#endif /* !_SHM_H_ */