Print this page
Bring back LX zones.
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/uts/common/brand/sn1/sn1_brand.c
+++ new/usr/src/uts/common/brand/sn1/sn1_brand.c
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 /*
23 23 * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
24 24 */
25 25
26 26 #include <sys/errno.h>
27 27 #include <sys/exec.h>
28 28 #include <sys/kmem.h>
29 29 #include <sys/modctl.h>
30 30 #include <sys/model.h>
31 31 #include <sys/proc.h>
32 32 #include <sys/syscall.h>
33 33 #include <sys/systm.h>
34 34 #include <sys/thread.h>
35 35 #include <sys/cmn_err.h>
36 36 #include <sys/archsystm.h>
37 37 #include <sys/pathname.h>
38 38
39 39 #include <sys/machbrand.h>
40 40 #include <sys/brand.h>
41 41 #include "sn1_brand.h"
42 42
43 43 char *sn1_emulation_table = NULL;
44 44
45 45 void sn1_init_brand_data(zone_t *);
46 46 void sn1_free_brand_data(zone_t *);
47 47 void sn1_setbrand(proc_t *);
48 48 int sn1_getattr(zone_t *, int, void *, size_t *);
49 49 int sn1_setattr(zone_t *, int, void *, size_t);
50 50 int sn1_brandsys(int, int64_t *, uintptr_t, uintptr_t, uintptr_t,
51 51 uintptr_t, uintptr_t, uintptr_t);
52 52 void sn1_copy_procdata(proc_t *, proc_t *);
53 53 void sn1_proc_exit(struct proc *, klwp_t *);
54 54 void sn1_exec();
55 55 int sn1_initlwp(klwp_t *);
56 56 void sn1_forklwp(klwp_t *, klwp_t *);
57 57 void sn1_freelwp(klwp_t *);
58 58 void sn1_lwpexit(klwp_t *);
59 59 int sn1_elfexec(vnode_t *, execa_t *, uarg_t *, intpdata_t *, int,
60 60 long *, int, caddr_t, cred_t *, int);
61 61
62 62 /* sn1 brand */
63 63 struct brand_ops sn1_brops = {
64 64 sn1_init_brand_data,
65 65 sn1_free_brand_data,
66 66 sn1_brandsys,
67 67 sn1_setbrand,
68 68 sn1_getattr,
69 69 sn1_setattr,
70 70 sn1_copy_procdata,
71 71 sn1_proc_exit,
72 72 sn1_exec,
73 73 lwp_setrval,
74 74 sn1_initlwp,
75 75 sn1_forklwp,
76 76 sn1_freelwp,
77 77 sn1_lwpexit,
78 78 sn1_elfexec,
79 79 NULL,
80 80 NULL,
81 81 NSIG,
82 82 };
83 83
84 84 #ifdef sparc
85 85
86 86 struct brand_mach_ops sn1_mops = {
↓ open down ↓ |
86 lines elided |
↑ open up ↑ |
87 87 sn1_brand_syscall_callback,
88 88 sn1_brand_syscall32_callback
89 89 };
90 90
91 91 #else /* sparc */
92 92
93 93 #ifdef __amd64
94 94
95 95 struct brand_mach_ops sn1_mops = {
96 96 sn1_brand_sysenter_callback,
97 + NULL,
97 98 sn1_brand_int91_callback,
98 99 sn1_brand_syscall_callback,
99 - sn1_brand_syscall32_callback
100 + sn1_brand_syscall32_callback,
101 + NULL
100 102 };
101 103
102 104 #else /* ! __amd64 */
103 105
104 106 struct brand_mach_ops sn1_mops = {
105 107 sn1_brand_sysenter_callback,
106 108 NULL,
109 + NULL,
107 110 sn1_brand_syscall_callback,
111 + NULL,
108 112 NULL
109 113 };
110 114 #endif /* __amd64 */
111 115
112 116 #endif /* _sparc */
113 117
114 118 struct brand sn1_brand = {
115 119 BRAND_VER_1,
116 120 "sn1",
117 121 &sn1_brops,
118 122 &sn1_mops
119 123 };
120 124
121 125 static struct modlbrand modlbrand = {
122 126 &mod_brandops, /* type of module */
123 127 "Solaris N-1 Brand", /* description of module */
124 128 &sn1_brand /* driver ops */
125 129 };
126 130
127 131 static struct modlinkage modlinkage = {
128 132 MODREV_1, (void *)&modlbrand, NULL
129 133 };
130 134
131 135 void
132 136 sn1_setbrand(proc_t *p)
133 137 {
134 138 brand_solaris_setbrand(p, &sn1_brand);
135 139 }
136 140
137 141 /* ARGSUSED */
138 142 int
139 143 sn1_getattr(zone_t *zone, int attr, void *buf, size_t *bufsize)
140 144 {
141 145 return (EINVAL);
142 146 }
143 147
144 148 /* ARGSUSED */
145 149 int
146 150 sn1_setattr(zone_t *zone, int attr, void *buf, size_t bufsize)
147 151 {
148 152 return (EINVAL);
149 153 }
150 154
151 155 /*ARGSUSED*/
152 156 int
153 157 sn1_brandsys(int cmd, int64_t *rval, uintptr_t arg1, uintptr_t arg2,
154 158 uintptr_t arg3, uintptr_t arg4, uintptr_t arg5, uintptr_t arg6)
155 159 {
156 160 int res;
157 161
158 162 *rval = 0;
159 163
160 164 res = brand_solaris_cmd(cmd, arg1, arg2, arg3, &sn1_brand, SN1_VERSION);
161 165 if (res >= 0)
162 166 return (res);
163 167
164 168 return (EINVAL);
165 169 }
166 170
167 171 void
168 172 sn1_copy_procdata(proc_t *child, proc_t *parent)
169 173 {
170 174 brand_solaris_copy_procdata(child, parent, &sn1_brand);
171 175 }
172 176
173 177 void
174 178 sn1_proc_exit(struct proc *p, klwp_t *l)
175 179 {
176 180 brand_solaris_proc_exit(p, l, &sn1_brand);
177 181 }
178 182
179 183 void
180 184 sn1_exec()
181 185 {
182 186 brand_solaris_exec(&sn1_brand);
183 187 }
184 188
185 189 int
186 190 sn1_initlwp(klwp_t *l)
187 191 {
188 192 return (brand_solaris_initlwp(l, &sn1_brand));
189 193 }
190 194
191 195 void
192 196 sn1_forklwp(klwp_t *p, klwp_t *c)
193 197 {
194 198 brand_solaris_forklwp(p, c, &sn1_brand);
195 199 }
196 200
197 201 void
198 202 sn1_freelwp(klwp_t *l)
199 203 {
200 204 brand_solaris_freelwp(l, &sn1_brand);
201 205 }
202 206
203 207 void
204 208 sn1_lwpexit(klwp_t *l)
205 209 {
206 210 brand_solaris_lwpexit(l, &sn1_brand);
207 211 }
208 212
209 213 /*ARGSUSED*/
210 214 void
211 215 sn1_free_brand_data(zone_t *zone)
212 216 {
213 217 }
214 218
215 219 /*ARGSUSED*/
216 220 void
217 221 sn1_init_brand_data(zone_t *zone)
218 222 {
219 223 }
220 224
221 225 int
222 226 sn1_elfexec(vnode_t *vp, execa_t *uap, uarg_t *args, intpdata_t *idatap,
223 227 int level, long *execsz, int setid, caddr_t exec_file, cred_t *cred,
224 228 int brand_action)
225 229 {
226 230 return (brand_solaris_elfexec(vp, uap, args, idatap, level, execsz,
227 231 setid, exec_file, cred, brand_action, &sn1_brand, SN1_BRANDNAME,
228 232 SN1_LIB, SN1_LIB32, SN1_LINKER, SN1_LINKER32));
229 233 }
230 234
231 235 int
232 236 _init(void)
233 237 {
234 238 int err;
235 239
236 240 /*
237 241 * Set up the table indicating which system calls we want to
238 242 * interpose on. We should probably build this automatically from
239 243 * a list of system calls that is shared with the user-space
240 244 * library.
241 245 */
242 246 sn1_emulation_table = kmem_zalloc(NSYSCALL, KM_SLEEP);
243 247 sn1_emulation_table[SYS_read] = 1; /* 3 */
244 248 sn1_emulation_table[SYS_write] = 1; /* 4 */
245 249 sn1_emulation_table[SYS_time] = 1; /* 13 */
246 250 sn1_emulation_table[SYS_getpid] = 1; /* 20 */
247 251 sn1_emulation_table[SYS_mount] = 1; /* 21 */
248 252 sn1_emulation_table[SYS_getuid] = 1; /* 24 */
249 253 sn1_emulation_table[SYS_times] = 1; /* 43 */
250 254 sn1_emulation_table[SYS_getgid] = 1; /* 47 */
251 255 sn1_emulation_table[SYS_utssys] = 1; /* 57 */
252 256 sn1_emulation_table[SYS_waitid] = 1; /* 107 */
253 257 sn1_emulation_table[SYS_uname] = 1; /* 135 */
254 258
255 259 err = mod_install(&modlinkage);
256 260 if (err) {
257 261 cmn_err(CE_WARN, "Couldn't install brand module");
258 262 kmem_free(sn1_emulation_table, NSYSCALL);
259 263 }
260 264
261 265 return (err);
262 266 }
263 267
264 268 int
265 269 _info(struct modinfo *modinfop)
266 270 {
267 271 return (mod_info(&modlinkage, modinfop));
268 272 }
269 273
270 274 int
271 275 _fini(void)
272 276 {
273 277 return (brand_solaris_fini(&sn1_emulation_table, &modlinkage,
274 278 &sn1_brand));
275 279 }
↓ open down ↓ |
158 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX