Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/pgoyette-compat]: src/sys Convert the final non-MP-safe "vectored" compa...
details: https://anonhg.NetBSD.org/src/rev/327f9fd6fc62
branches: pgoyette-compat
changeset: 445167:327f9fd6fc62
user: pgoyette <pgoyette%NetBSD.org@localhost>
date: Mon Oct 15 22:06:16 2018 +0000
description:
Convert the final non-MP-safe "vectored" compat routine to use the
MP-safe mechanism.
diffstat:
sys/compat/common/compat_sysv_50_mod.c | 15 ++++++++-------
sys/compat/common/compat_sysv_mod.h | 4 +---
sys/kern/compat_stub.c | 7 ++++++-
sys/kern/sysv_ipc.c | 18 ++++++++----------
sys/sys/compat_stub.h | 8 +++++++-
5 files changed, 30 insertions(+), 22 deletions(-)
diffs (178 lines):
diff -r 5dba94b5eeb2 -r 327f9fd6fc62 sys/compat/common/compat_sysv_50_mod.c
--- a/sys/compat/common/compat_sysv_50_mod.c Mon Oct 15 11:57:05 2018 +0000
+++ b/sys/compat/common/compat_sysv_50_mod.c Mon Oct 15 22:06:16 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: compat_sysv_50_mod.c,v 1.1.2.1 2018/04/17 23:06:11 pgoyette Exp $ */
+/* $NetBSD: compat_sysv_50_mod.c,v 1.1.2.2 2018/10/15 22:06:16 pgoyette Exp $ */
/*-
* Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: compat_sysv_50_mod.c,v 1.1.2.1 2018/04/17 23:06:11 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: compat_sysv_50_mod.c,v 1.1.2.2 2018/10/15 22:06:16 pgoyette Exp $");
#ifdef _KERNEL_OPT
#include "opt_compat_netbsd.h"
@@ -43,6 +43,7 @@
#include <sys/syscallargs.h>
#include <sys/syscallvar.h>
#include <sys/sysctl.h>
+#include <sys/compat_stub.h>
#include <compat/common/compat_sysv_mod.h>
@@ -63,11 +64,12 @@
{ 0, 0, NULL }
};
+MODULE_SET_HOOK(sysvipc50_sysctl_hook, "sysv50", sysctl_kern_sysvipc50);
+MODULE_UNSET_HOOK(sysvipc50_sysctl_hook);
+
static int
compat_sysv_50_modcmd(modcmd_t cmd, void *arg)
{
- static int (*orig_sysvipc50_sysctl)(SYSCTLFN_PROTO);
-
int error = 0;
switch (cmd) {
@@ -76,16 +78,15 @@
if (error != 0) {
break;
}
- orig_sysvipc50_sysctl = vec_sysvipc50_sysctl;
- vec_sysvipc50_sysctl = sysctl_kern_sysvipc50;
+ sysvipc50_sysctl_hook_set();
break;
case MODULE_CMD_FINI:
- vec_sysvipc50_sysctl = orig_sysvipc50_sysctl;
error = syscall_disestablish(NULL, compat_sysv_50_syscalls);
if (error != 0) {
break;
}
+ sysvipc50_sysctl_hook_unset();
break;
default:
diff -r 5dba94b5eeb2 -r 327f9fd6fc62 sys/compat/common/compat_sysv_mod.h
--- a/sys/compat/common/compat_sysv_mod.h Mon Oct 15 11:57:05 2018 +0000
+++ b/sys/compat/common/compat_sysv_mod.h Mon Oct 15 22:06:16 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: compat_sysv_mod.h,v 1.1.2.1 2018/04/17 21:59:27 pgoyette Exp $ */
+/* $NetBSD: compat_sysv_mod.h,v 1.1.2.2 2018/10/15 22:06:16 pgoyette Exp $ */
/*-
* Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -34,8 +34,6 @@
#include <sys/sysctl.h>
-extern int (*vec_sysvipc50_sysctl)(SYSCTLFN_PROTO);
-
int sysctl_kern_sysvipc50(SYSCTLFN_PROTO);
#endif /* _COMPAT_COMMON_SYSV_IPC_MOD_H_ */
diff -r 5dba94b5eeb2 -r 327f9fd6fc62 sys/kern/compat_stub.c
--- a/sys/kern/compat_stub.c Mon Oct 15 11:57:05 2018 +0000
+++ b/sys/kern/compat_stub.c Mon Oct 15 22:06:16 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: compat_stub.c,v 1.1.2.31 2018/10/15 11:57:05 pgoyette Exp $ */
+/* $NetBSD: compat_stub.c,v 1.1.2.32 2018/10/15 22:06:16 pgoyette Exp $ */
/*-
* Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -203,3 +203,8 @@
*/
struct compat_70_unp_hook_t compat_70_unp_hook;
+/*
+ * Hook for sysvipc50_sysctl
+ */
+struct sysvipc50_sysctl_hook_t sysvipc50_sysctl_hook;
+
diff -r 5dba94b5eeb2 -r 327f9fd6fc62 sys/kern/sysv_ipc.c
--- a/sys/kern/sysv_ipc.c Mon Oct 15 11:57:05 2018 +0000
+++ b/sys/kern/sysv_ipc.c Mon Oct 15 22:06:16 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sysv_ipc.c,v 1.32.16.5 2018/09/06 06:56:42 pgoyette Exp $ */
+/* $NetBSD: sysv_ipc.c,v 1.32.16.6 2018/10/15 22:06:16 pgoyette Exp $ */
/*-
* Copyright (c) 1998, 2007 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sysv_ipc.c,v 1.32.16.5 2018/09/06 06:56:42 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sysv_ipc.c,v 1.32.16.6 2018/10/15 22:06:16 pgoyette Exp $");
#ifdef _KERNEL_OPT
#include "opt_sysv.h"
@@ -61,11 +61,10 @@
#include <sys/stat.h>
#include <sys/sysctl.h>
#include <sys/kauth.h>
+#include <sys/compat_stub.h>
#include <compat/common/compat_sysv_mod.h> /* for sysctl routine vector */
-int (*vec_sysvipc50_sysctl)(SYSCTLFN_PROTO);
-
/*
* Values in support of System V compatible shared memory. XXX
* (originally located in sys/conf/param.c)
@@ -342,17 +341,16 @@
sysvipc_listener_cb, NULL);
}
-/* Vector the old 50 sysctl stuff */
-
-static int stub_sysvipc50_sysctl(SYSCTLFN_PROTO);
-int (*vec_sysvipc50_sysctl)(SYSCTLFN_PROTO) = stub_sysvipc50_sysctl;
-
static int
stub_sysvipc50_sysctl(SYSCTLFN_ARGS)
{
return EPASSTHROUGH;
}
+MODULE_CALL_HOOK_DECL(sysvipc50_sysctl_hook, f, (SYSCTLFN_PROTO));
+MODULE_CALL_HOOK(sysvipc50_sysctl_hook, f, (SYSCTLFN_ARGS),
+ (SYSCTLFN_CALL(rnode)), stub_sysvipc50_sysctl(SYSCTLFN_CALL(rnode)));
+
static int
sysctl_kern_sysvipc(SYSCTLFN_ARGS)
{
@@ -379,7 +377,7 @@
* to the non-compat sysctl code.
*/
- error = (*vec_sysvipc50_sysctl)(SYSCTLFN_CALL(rnode));
+ error = sysvipc50_sysctl_hook_f_call(SYSCTLFN_CALL(rnode));
if (error != EPASSTHROUGH)
return error;
diff -r 5dba94b5eeb2 -r 327f9fd6fc62 sys/sys/compat_stub.h
--- a/sys/sys/compat_stub.h Mon Oct 15 11:57:05 2018 +0000
+++ b/sys/sys/compat_stub.h Mon Oct 15 22:06:16 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: compat_stub.h,v 1.1.2.43 2018/10/15 11:57:05 pgoyette Exp $ */
+/* $NetBSD: compat_stub.h,v 1.1.2.44 2018/10/15 22:06:16 pgoyette Exp $ */
/*-
* Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -257,4 +257,10 @@
struct mbuf;
MODULE_HOOK(compat_70_unp_hook, (struct mbuf **, struct lwp *, struct mbuf *));
+/*
+ * Hook for sysvipc50 sysctl
+ */
+#include <sys/sysctl.h>
+MODULE_HOOK(sysvipc50_sysctl_hook, (SYSCTLFN_PROTO));
+
#endif /* _SYS_COMPAT_STUB_H */
Home |
Main Index |
Thread Index |
Old Index