]> git.saurik.com Git - apple/xnu.git/blame - bsd/sys/shm_internal.h
xnu-792.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 *
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_INTERNALH_
60#define _SYS_SHM_INTERNALH_
61
62#include <sys/shm.h>
63#include <sys/cdefs.h>
64
65#include <machine/types.h>
66
67#if __DARWIN_ALIGN_NATURAL
68#pragma options align=natural
69#endif
70
71struct user_shmid_ds {
72 struct ipc_perm shm_perm; /* operation permission structure */
73 user_size_t shm_segsz; /* size of segment in bytes */
74 pid_t shm_lpid; /* PID of last shared memory op */
75 pid_t shm_cpid; /* PID of creator */
76 short shm_nattch; /* number of current attaches */
77 time_t shm_atime; /* time of last shmat() */
78 time_t shm_dtime; /* time of last shmdt() */
79 time_t shm_ctime; /* time of last change by shmctl() */
80 user_addr_t shm_internal; /* reserved for kernel use */
81};
82
83#if __DARWIN_ALIGN_NATURAL
84#pragma options align=reset
85#endif
86
87/*
88 * System 5 style catch-all structure for shared memory constants that
89 * might be of interest to user programs. Also part of the ipcs interface.
90 * Note: use of user_ssize_t intentional: permits 32 bit ipcs to provide
91 * information about 64 bit programs shared segments.
92 */
93struct shminfo {
94 user_ssize_t shmmax; /* max shm segment size (bytes) */
95 user_ssize_t shmmin; /* min shm segment size (bytes) */
96 user_ssize_t shmmni; /* max number of shm identifiers */
97 user_ssize_t shmseg; /* max shm segments per process */
98 user_ssize_t shmall; /* max amount of shm (pages) */
99};
100
101#ifdef KERNEL
102extern struct shminfo shminfo;
103extern struct user_shmid_ds *shmsegs;
104
105struct proc;
106
107__BEGIN_DECLS
108
109void shmexit(struct proc *);
110int shmfork(struct proc *, struct proc *);
111__private_extern__ void shmexec(struct proc *);
112
113__END_DECLS
114
115#endif /* kernel */
116
117#endif /* !_SYS_SHM_INTERNALH_ */