|
|
1.1 root 1: /*
2: * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3: *
4: * @APPLE_LICENSE_HEADER_START@
5: *
6: * The contents of this file constitute Original Code as defined in and
7: * are subject to the Apple Public Source License Version 1.1 (the
8: * "License"). You may not use this file except in compliance with the
9: * License. Please obtain a copy of the License at
10: * http://www.apple.com/publicsource and read it before using this file.
11: *
12: * This Original Code and all software distributed under the License are
13: * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14: * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15: * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16: * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17: * License for the specific language governing rights and limitations
18: * under the License.
19: *
20: * @APPLE_LICENSE_HEADER_END@
21: */
22: /* $NetBSD: shm.h,v 1.15 1994/06/29 06:45:17 cgd Exp $ */
23:
24: /*
25: * Copyright (c) 1994 Adam Glass
26: * All rights reserved.
27: *
28: * Redistribution and use in source and binary forms, with or without
29: * modification, are permitted provided that the following conditions
30: * are met:
31: * 1. Redistributions of source code must retain the above copyright
32: * notice, this list of conditions and the following disclaimer.
33: * 2. Redistributions in binary form must reproduce the above copyright
34: * notice, this list of conditions and the following disclaimer in the
35: * documentation and/or other materials provided with the distribution.
36: * 3. All advertising materials mentioning features or use of this software
37: * must display the following acknowledgement:
38: * This product includes software developed by Adam Glass.
39: * 4. The name of the author may not be used to endorse or promote products
40: * derived from this software without specific prior written permission
41: *
42: * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
43: * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
44: * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
45: * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
46: * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
47: * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
48: * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
49: * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
50: * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
51: * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
52: */
53:
54: /*
55: * As defined+described in "X/Open System Interfaces and Headers"
56: * Issue 4, p. XXX
57: */
58:
59: #ifndef _SYS_SHM_H_
60: #define _SYS_SHM_H_
61:
62: #include <sys/param.h>
63: #include <sys/ipc.h>
64:
65: #define SHM_RDONLY 010000 /* Attach read-only (else read-write) */
66: #define SHM_RND 020000 /* Round attach address to SHMLBA */
67: #define SHMLBA NBPG /* Segment low boundary address multiple */
68:
69: /* "official" access mode definitions; somewhat braindead since you have
70: to specify (SHM_* >> 3) for group and (SHM_* >> 6) for world permissions */
71: #define SHM_R (IPC_R)
72: #define SHM_W (IPC_W)
73:
74:
75: struct shmid_ds {
76: struct ipc_perm shm_perm; /* operation permission structure */
77: int shm_segsz; /* size of segment in bytes */
78: pid_t shm_lpid; /* process ID of last shared memory op */
79: pid_t shm_cpid; /* process ID of creator */
80: short shm_nattch; /* number of current attaches */
81: time_t shm_atime; /* time of last shmat() */
82: time_t shm_dtime; /* time of last shmdt() */
83: time_t shm_ctime; /* time of last change by shmctl() */
84: void *shm_internal; /* sysv stupidity */
85: };
86:
87: #ifdef KERNEL
88:
89: /*
90: * System 5 style catch-all structure for shared memory constants that
91: * might be of interest to user programs. Do we really want/need this?
92: */
93: struct shminfo {
94: int shmmax, /* max shared memory segment size (bytes) */
95: shmmin, /* min shared memory segment size (bytes) */
96: shmmni, /* max number of shared memory identifiers */
97: shmseg, /* max shared memory segments per process */
98: shmall; /* max amount of shared memory (pages) */
99: };
100: extern struct shminfo shminfo;
101: extern struct shmid_ds *shmsegs;
102:
103: struct proc;
104:
105: void shmexit __P((struct proc *));
106: void shmfork __P((struct proc *, struct proc *));
107: #else /* !KERNEL */
108:
109: #include <sys/cdefs.h>
110:
111: __BEGIN_DECLS
112: int shmsys __P((int, ...));
113: void *shmat __P((int, void *, int));
114: int shmget __P((key_t, int, int));
115: int shmctl __P((int, int, struct shmid_ds *));
116: int shmdt __P((void *));
117: __END_DECLS
118:
119: #endif /* !KERNEL */
120:
121: #endif /* !_SYS_SHM_H_ */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.