kern_mib.c (7f8a436ff29ebeb1ce2ae2434add4505d5e7e2ca) | kern_mib.c (4261ed50fdaf494bd3d7fdea6ab8d9912cfc562e) |
---|---|
1/*- 2 * Copyright (c) 1982, 1986, 1989, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Mike Karels at Berkeley Software Design, Inc. 7 * 8 * Quite extensively rewritten by Poul-Henning Kamp of the FreeBSD --- 237 unchanged lines hidden (view full) --- 246{ 247 struct prison *pr; 248 int error, level; 249 250 pr = req->td->td_ucred->cr_prison; 251 252 /* 253 * If the process is in jail, return the maximum of the global and | 1/*- 2 * Copyright (c) 1982, 1986, 1989, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Mike Karels at Berkeley Software Design, Inc. 7 * 8 * Quite extensively rewritten by Poul-Henning Kamp of the FreeBSD --- 237 unchanged lines hidden (view full) --- 246{ 247 struct prison *pr; 248 int error, level; 249 250 pr = req->td->td_ucred->cr_prison; 251 252 /* 253 * If the process is in jail, return the maximum of the global and |
254 * local levels; otherwise, return the global level. | 254 * local levels; otherwise, return the global level. Perform a 255 * lockless read since the securelevel is an interger. |
255 */ | 256 */ |
256 if (pr != NULL) { 257 mtx_lock(&pr->pr_mtx); | 257 if (pr != NULL) |
258 level = imax(securelevel, pr->pr_securelevel); | 258 level = imax(securelevel, pr->pr_securelevel); |
259 mtx_unlock(&pr->pr_mtx); 260 } else | 259 else |
261 level = securelevel; 262 error = sysctl_handle_int(oidp, &level, 0, req); 263 if (error || !req->newptr) 264 return (error); 265 /* 266 * Permit update only if the new securelevel exceeds the 267 * global level, and local level if any. 268 */ --- 107 unchanged lines hidden --- | 260 level = securelevel; 261 error = sysctl_handle_int(oidp, &level, 0, req); 262 if (error || !req->newptr) 263 return (error); 264 /* 265 * Permit update only if the new securelevel exceeds the 266 * global level, and local level if any. 267 */ --- 107 unchanged lines hidden --- |