Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/compat Finally (hopefully) return completely to the stat...
details: https://anonhg.NetBSD.org/src/rev/9fb5a00842d1
branches: trunk
changeset: 358060:9fb5a00842d1
user: kre <kre%NetBSD.org@localhost>
date: Sun Dec 10 00:43:05 2017 +0000
description:
Finally (hopefully) return completely to the state where compat_linux is
enabled by default.
While here make it possible to enable this if already enabled, or disable
if already disabled, without error. Some minor KNF.
diffstat:
sys/compat/linux/common/linux_mod.c | 20 +++++++++++++-------
sys/compat/linux32/common/linux32_mod.c | 26 +++++++++++++++++---------
2 files changed, 30 insertions(+), 16 deletions(-)
diffs (109 lines):
diff -r 54b4409312e7 -r 9fb5a00842d1 sys/compat/linux/common/linux_mod.c
--- a/sys/compat/linux/common/linux_mod.c Sun Dec 10 00:07:36 2017 +0000
+++ b/sys/compat/linux/common/linux_mod.c Sun Dec 10 00:43:05 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_mod.c,v 1.9 2017/12/08 15:31:13 kre Exp $ */
+/* $NetBSD: linux_mod.c,v 1.10 2017/12/10 00:43:05 kre Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_mod.c,v 1.9 2017/12/08 15:31:13 kre Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_mod.c,v 1.10 2017/12/10 00:43:05 kre Exp $");
#ifdef _KERNEL_OPT
#include "opt_execfmt.h"
@@ -136,13 +136,16 @@
if (error != 0 || newp == NULL)
return error;
- if (val == 1) {
+ if (val == *(int *)rnode->sysctl_data)
+ return 0;
+
+ if (val == 1)
error = exec_add(linux_execsw, __arraycount(linux_execsw));
- } else if (val == 0) {
+ else if (val == 0)
error = exec_remove(linux_execsw, __arraycount(linux_execsw));
- } else {
+ else
error = EINVAL;
- }
+
if (error)
return error;
@@ -160,7 +163,10 @@
case MODULE_CMD_INIT:
linux_futex_init();
linux_sysctl_init();
- return 0;
+ error = exec_add(linux_execsw, __arraycount(linux_execsw));
+ if (error != 0)
+ linux_sysctl_fini();
+ return error;
case MODULE_CMD_FINI:
error = exec_remove(linux_execsw, __arraycount(linux_execsw));
diff -r 54b4409312e7 -r 9fb5a00842d1 sys/compat/linux32/common/linux32_mod.c
--- a/sys/compat/linux32/common/linux32_mod.c Sun Dec 10 00:07:36 2017 +0000
+++ b/sys/compat/linux32/common/linux32_mod.c Sun Dec 10 00:43:05 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: linux32_mod.c,v 1.10 2017/12/08 15:31:13 kre Exp $ */
+/* $NetBSD: linux32_mod.c,v 1.11 2017/12/10 00:43:05 kre Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux32_mod.c,v 1.10 2017/12/08 15:31:13 kre Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux32_mod.c,v 1.11 2017/12/10 00:43:05 kre Exp $");
#ifdef _KERNEL_OPT
#include "opt_execfmt.h"
@@ -95,13 +95,17 @@
if (error != 0 || newp == NULL)
return error;
- if (val == 1) {
+ if (val == *(int *)rnode->sysctl_data)
+ return 0;
+
+ if (val == 1)
error = exec_add(linux32_execsw, __arraycount(linux32_execsw));
- } else if (val == 0) {
- error = exec_remove(linux32_execsw, __arraycount(linux32_execsw));
- } else {
+ else if (val == 0)
+ error =
+ exec_remove(linux32_execsw, __arraycount(linux32_execsw));
+ else
error = EINVAL;
- }
+
if (error)
return error;
@@ -118,10 +122,14 @@
switch (cmd) {
case MODULE_CMD_INIT:
linux32_sysctl_init();
- return 0;
+ error = exec_add(linux32_execsw, __arraycount(linux32_execsw));
+ if (error != 0)
+ linux32_sysctl_fini();
+ return error;
case MODULE_CMD_FINI:
- error = exec_remove(linux32_execsw, __arraycount(linux32_execsw));
+ error =
+ exec_remove(linux32_execsw, __arraycount(linux32_execsw));
if (error)
return error;
linux32_sysctl_fini();
Home |
Main Index |
Thread Index |
Old Index