Print this page
| Split |
Close |
| Expand all |
| Collapse all |
--- old/usr/src/uts/common/sys/shm_impl.h
+++ new/usr/src/uts/common/sys/shm_impl.h
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21 /*
22 22 * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
23 23 * Use is subject to license terms.
24 24 * Copyright 2016 Joyent, Inc.
25 25 */
26 26
27 27 #ifndef _SYS_SHM_IMPL_H
28 28 #define _SYS_SHM_IMPL_H
29 29
30 30 #include <sys/ipc_impl.h>
31 31 #if defined(_KERNEL) || defined(_KMEMUSER)
32 32 #include <sys/shm.h>
33 33 #include <sys/avl.h>
34 34 #include <sys/t_lock.h>
35 35 #endif
36 36
37 37 #ifdef __cplusplus
38 38 extern "C" {
39 39 #endif
40 40
41 41 /*
42 42 * shmsys system call subcodes
43 43 */
44 44 #define SHMAT 0
45 45 #define SHMCTL 1
46 46 #define SHMDT 2
47 47 #define SHMGET 3
48 48 #define SHMIDS 4
49 49
50 50 /*
51 51 * There is a shared mem id data structure (shmid_ds) for each
52 52 * segment in the system.
53 53 */
54 54 #if defined(_KERNEL) || defined(_KMEMUSER)
55 55 typedef struct kshmid {
56 56 kipc_perm_t shm_perm; /* operation permission struct */
57 57 size_t shm_segsz; /* size of segment in bytes */
58 58 struct anon_map *shm_amp; /* segment anon_map pointer */
59 59 ushort_t shm_lkcnt; /* number of times it is being locked */
60 60 pgcnt_t shm_lkpages; /* number of pages locked by shmctl */
61 61 kmutex_t shm_mlock; /* held when locking physical pages */
62 62 /* Therefore, protects p_lckcnt for */
63 63 /* pages that back shm */
64 64 pid_t shm_lpid; /* pid of last shmop */
65 65 pid_t shm_cpid; /* pid of creator */
66 66 ulong_t shm_ismattch; /* number of ISM attaches */
67 67 time_t shm_atime; /* last shmat time */
68 68 time_t shm_dtime; /* last shmdt time */
69 69 time_t shm_ctime; /* last change time */
70 70 struct sptinfo *shm_sptinfo; /* info about ISM segment */
71 71 struct seg *shm_sptseg; /* pointer to ISM segment */
72 72 ulong_t shm_opts;
73 73 /*
74 74 * Composed of: sptprot (uchar_t) and
75 75 * RM_PENDING flag (1 bit).
76 76 */
77 77 } kshmid_t;
78 78
79 79 /*
80 80 * Segacct Flags.
81 81 */
82 82 #define SHMSA_ISM 1 /* uses shared page table */
83 83
84 84 /*
85 85 * shm_opts definitions
86 86 * Low byte in shm_opts is used for sptprot (see PROT_ALL). The upper bits are
87 87 * used for additional options.
88 88 */
89 89 #define SHM_PROT_MASK 0xff
90 90 #define SHM_RM_PENDING 0x100
91 91
92 92 typedef struct sptinfo {
93 93 struct as *sptas; /* dummy as ptr. for spt segment */
94 94 } sptinfo_t;
95 95
96 96 /*
97 97 * Protected by p->p_lock
98 98 */
99 99 typedef struct segacct {
100 100 avl_node_t sa_tree;
101 101 caddr_t sa_addr;
102 102 size_t sa_len;
103 103 ulong_t sa_flags;
104 104 kshmid_t *sa_id;
105 105 } segacct_t;
106 106
107 107 /*
108 108 * Error codes for shmgetid().
109 109 */
110 110 #define SHMID_NONE (-1)
111 111 #define SHMID_FREE (-2)
112 112
113 113 extern void shminit(void);
114 114 extern void shmfork(struct proc *, struct proc *);
115 115 extern void shmexit(struct proc *);
116 116 extern int shmgetid(struct proc *, caddr_t);
117 117
118 118 #endif /* _KERNEL */
119 119
120 120 #if defined(_SYSCALL32)
121 121 /*
122 122 * LP64 view of the ILP32 shmid_ds structure
123 123 */
124 124 struct shmid_ds32 {
125 125 struct ipc_perm32 shm_perm; /* operation permission struct */
126 126 size32_t shm_segsz; /* size of segment in bytes */
127 127 caddr32_t shm_amp; /* segment anon_map pointer */
128 128 uint16_t shm_lkcnt; /* number of times it is being locked */
129 129 pid32_t shm_lpid; /* pid of last shmop */
130 130 pid32_t shm_cpid; /* pid of creator */
131 131 uint32_t shm_nattch; /* number of attaches */
132 132 uint32_t shm_cnattch; /* number of ISM attaches */
133 133 time32_t shm_atime; /* last shmat time */
134 134 int32_t shm_pad1; /* reserved for time_t expansion */
135 135 time32_t shm_dtime; /* last shmdt time */
136 136 int32_t shm_pad2; /* reserved for time_t expansion */
137 137 time32_t shm_ctime; /* last change time */
138 138 int32_t shm_pad3; /* reserved for time_t expansion */
139 139 int32_t shm_pad4[4]; /* reserve area */
140 140 };
141 141 #endif
142 142
143 143 #ifdef __cplusplus
144 144 }
145 145 #endif
146 146
147 147 #endif /* _SYS_SHM_IMPL_H */
|
↓ open down ↓ |
147 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX