]> git.saurik.com Git - apple/xnu.git/blame - bsd/sys/shm_internal.h
xnu-792.6.56.tar.gz
[apple/xnu.git] / bsd / sys / shm_internal.h
CommitLineData
91447636
A
1/*
2 * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
ff6e181a
A
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
91447636 12 *
ff6e181a
A
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
91447636
A
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
ff6e181a
A
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
91447636
A
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23/* $NetBSD: shm.h,v 1.15 1994/06/29 06:45:17 cgd Exp $ */
24
25/*
26 * Copyright (c) 1994 Adam Glass
27 * All rights reserved.
28 *
29 * Redistribution and use in source and binary forms, with or without
30 * modification, are permitted provided that the following conditions
31 * are met:
32 * 1. Redistributions of source code must retain the above copyright
33 * notice, this list of conditions and the following disclaimer.
34 * 2. Redistributions in binary form must reproduce the above copyright
35 * notice, this list of conditions and the following disclaimer in the
36 * documentation and/or other materials provided with the distribution.
37 * 3. All advertising materials mentioning features or use of this software
38 * must display the following acknowledgement:
39 * This product includes software developed by Adam Glass.
40 * 4. The name of the author may not be used to endorse or promote products
41 * derived from this software without specific prior written permission
42 *
43 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
44 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
45 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
46 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
47 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
48 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
49 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
50 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
51 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
52 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
53 */
54
55/*
56 * As defined+described in "X/Open System Interfaces and Headers"
57 * Issue 4, p. XXX
58 */
59
60#ifndef _SYS_SHM_INTERNALH_
61#define _SYS_SHM_INTERNALH_
62
63#include <sys/shm.h>
64#include <sys/cdefs.h>
65
66#include <machine/types.h>
67
68#if __DARWIN_ALIGN_NATURAL
69#pragma options align=natural
70#endif
71
72struct user_shmid_ds {
73 struct ipc_perm shm_perm; /* operation permission structure */
74 user_size_t shm_segsz; /* size of segment in bytes */
75 pid_t shm_lpid; /* PID of last shared memory op */
76 pid_t shm_cpid; /* PID of creator */
77 short shm_nattch; /* number of current attaches */
78 time_t shm_atime; /* time of last shmat() */
79 time_t shm_dtime; /* time of last shmdt() */
80 time_t shm_ctime; /* time of last change by shmctl() */
81 user_addr_t shm_internal; /* reserved for kernel use */
82};
83
84#if __DARWIN_ALIGN_NATURAL
85#pragma options align=reset
86#endif
87
88/*
89 * System 5 style catch-all structure for shared memory constants that
90 * might be of interest to user programs. Also part of the ipcs interface.
91 * Note: use of user_ssize_t intentional: permits 32 bit ipcs to provide
92 * information about 64 bit programs shared segments.
93 */
94struct shminfo {
95 user_ssize_t shmmax; /* max shm segment size (bytes) */
96 user_ssize_t shmmin; /* min shm segment size (bytes) */
97 user_ssize_t shmmni; /* max number of shm identifiers */
98 user_ssize_t shmseg; /* max shm segments per process */
99 user_ssize_t shmall; /* max amount of shm (pages) */
100};
101
102#ifdef KERNEL
103extern struct shminfo shminfo;
104extern struct user_shmid_ds *shmsegs;
105
106struct proc;
107
108__BEGIN_DECLS
109
110void shmexit(struct proc *);
111int shmfork(struct proc *, struct proc *);
112__private_extern__ void shmexec(struct proc *);
113
114__END_DECLS
115
116#endif /* kernel */
117
118#endif /* !_SYS_SHM_INTERNALH_ */