Deleted Added
full compact
kern_mib.c (127911) kern_mib.c (140676)
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

--- 22 unchanged lines hidden (view full) ---

31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 * SUCH DAMAGE.
34 *
35 * @(#)kern_sysctl.c 8.4 (Berkeley) 4/14/94
36 */
37
38#include <sys/cdefs.h>
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

--- 22 unchanged lines hidden (view full) ---

31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 * SUCH DAMAGE.
34 *
35 * @(#)kern_sysctl.c 8.4 (Berkeley) 4/14/94
36 */
37
38#include <sys/cdefs.h>
39__FBSDID("$FreeBSD: head/sys/kern/kern_mib.c 127911 2004-04-05 21:03:37Z imp $");
39__FBSDID("$FreeBSD: head/sys/kern/kern_mib.c 140676 2005-01-23 20:59:19Z rwatson $");
40
41#include "opt_posix.h"
42
43#include <sys/param.h>
44#include <sys/kernel.h>
45#include <sys/systm.h>
46#include <sys/sysctl.h>
47#include <sys/proc.h>

--- 198 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
40
41#include "opt_posix.h"
42
43#include <sys/param.h>
44#include <sys/kernel.h>
45#include <sys/systm.h>
46#include <sys/sysctl.h>
47#include <sys/proc.h>

--- 198 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 ---