CVS commit: [pgoyette-compat] src/sys/kern

2019-01-15 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Tue Jan 15 22:01:26 UTC 2019

Modified Files:
src/sys/kern [pgoyette-compat]: compat_stub.c

Log Message:
Add a comment for the SCTP section, as was done for the NTP section


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.38 -r1.1.2.39 src/sys/kern/compat_stub.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/compat_stub.c
diff -u src/sys/kern/compat_stub.c:1.1.2.38 src/sys/kern/compat_stub.c:1.1.2.39
--- src/sys/kern/compat_stub.c:1.1.2.38	Tue Jan 15 21:37:44 2019
+++ src/sys/kern/compat_stub.c	Tue Jan 15 22:01:26 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: compat_stub.c,v 1.1.2.38 2019/01/15 21:37:44 pgoyette Exp $	*/
+/* $NetBSD: compat_stub.c,v 1.1.2.39 2019/01/15 22:01:26 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -64,6 +64,12 @@ int (*vec_ntp_timestatus)(void) = NULL;
 void (*vec_ntp_adjtime1)(struct timex *) = NULL;
 #endif
 
+/*
+ * Routine vectors for sctp (called from within rtsock)
+ *
+ * MP-hooks not needed since the SCTP code is not modular
+ */
+
 #ifdef SCTP
 void (*vec_sctp_add_ip_address)(struct ifaddr *) = sctp_add_ip_address;
 void (*vec_sctp_delete_ip_address)(struct ifaddr *) = sctp_delete_ip_address;



CVS commit: [pgoyette-compat] src/sys/kern

2019-01-15 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Tue Jan 15 22:01:26 UTC 2019

Modified Files:
src/sys/kern [pgoyette-compat]: compat_stub.c

Log Message:
Add a comment for the SCTP section, as was done for the NTP section


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.38 -r1.1.2.39 src/sys/kern/compat_stub.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [pgoyette-compat] src/sys/kern

2019-01-15 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Tue Jan 15 21:37:44 UTC 2019

Modified Files:
src/sys/kern [pgoyette-compat]: compat_stub.c

Log Message:
Add missing # to fix the non-SCTP case.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.37 -r1.1.2.38 src/sys/kern/compat_stub.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [pgoyette-compat] src/sys/kern

2019-01-15 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Tue Jan 15 21:37:44 UTC 2019

Modified Files:
src/sys/kern [pgoyette-compat]: compat_stub.c

Log Message:
Add missing # to fix the non-SCTP case.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.37 -r1.1.2.38 src/sys/kern/compat_stub.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/compat_stub.c
diff -u src/sys/kern/compat_stub.c:1.1.2.37 src/sys/kern/compat_stub.c:1.1.2.38
--- src/sys/kern/compat_stub.c:1.1.2.37	Tue Jan 15 10:52:20 2019
+++ src/sys/kern/compat_stub.c	Tue Jan 15 21:37:44 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: compat_stub.c,v 1.1.2.37 2019/01/15 10:52:20 pgoyette Exp $	*/
+/* $NetBSD: compat_stub.c,v 1.1.2.38 2019/01/15 21:37:44 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@ void (*vec_ntp_adjtime1)(struct timex *)
 #ifdef SCTP
 void (*vec_sctp_add_ip_address)(struct ifaddr *) = sctp_add_ip_address;
 void (*vec_sctp_delete_ip_address)(struct ifaddr *) = sctp_delete_ip_address;
-else
+#else
 void (*vec_sctp_add_ip_address)(struct ifaddr *) = NULL;
 void (*vec_sctp_delete_ip_address)(struct ifaddr *) = NULL;
 #endif 



CVS commit: [pgoyette-compat] src/sys/kern

2019-01-15 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Tue Jan 15 10:52:20 UTC 2019

Modified Files:
src/sys/kern [pgoyette-compat]: compat_stub.c

Log Message:
Include appropriate headers to define the sctp routines


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.36 -r1.1.2.37 src/sys/kern/compat_stub.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/compat_stub.c
diff -u src/sys/kern/compat_stub.c:1.1.2.36 src/sys/kern/compat_stub.c:1.1.2.37
--- src/sys/kern/compat_stub.c:1.1.2.36	Tue Jan 15 04:10:34 2019
+++ src/sys/kern/compat_stub.c	Tue Jan 15 10:52:20 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: compat_stub.c,v 1.1.2.36 2019/01/15 04:10:34 pgoyette Exp $	*/
+/* $NetBSD: compat_stub.c,v 1.1.2.37 2019/01/15 10:52:20 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -33,6 +33,7 @@
 
 #ifdef _KERNEL_OPT
 #include "opt_ntp.h"
+#include "opt_sctp.h"
 #endif
 
 #include 
@@ -43,6 +44,10 @@
 #include 
 #endif
 
+#ifdef SCTP
+#include 
+#endif
+
 /*
  * Routine vectors for compat_50___sys_ntp_gettime
  *



CVS commit: [pgoyette-compat] src/sys/kern

2019-01-15 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Tue Jan 15 10:52:20 UTC 2019

Modified Files:
src/sys/kern [pgoyette-compat]: compat_stub.c

Log Message:
Include appropriate headers to define the sctp routines


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.36 -r1.1.2.37 src/sys/kern/compat_stub.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [pgoyette-compat] src/sys/kern

2018-10-03 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Wed Oct  3 22:53:52 UTC 2018

Modified Files:
src/sys/kern [pgoyette-compat]: kern_module.c

Log Message:
Better diagnostic message


To generate a diff of this commit:
cvs rdiff -u -r1.130.2.23 -r1.130.2.24 src/sys/kern/kern_module.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/kern_module.c
diff -u src/sys/kern/kern_module.c:1.130.2.23 src/sys/kern/kern_module.c:1.130.2.24
--- src/sys/kern/kern_module.c:1.130.2.23	Sun Sep  9 11:54:10 2018
+++ src/sys/kern/kern_module.c	Wed Oct  3 22:53:52 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_module.c,v 1.130.2.23 2018/09/09 11:54:10 pgoyette Exp $	*/
+/*	$NetBSD: kern_module.c,v 1.130.2.24 2018/10/03 22:53:52 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_module.c,v 1.130.2.23 2018/09/09 11:54:10 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_module.c,v 1.130.2.24 2018/10/03 22:53:52 pgoyette Exp $");
 
 #define _MODULE_INTERNAL
 
@@ -1453,8 +1453,8 @@ module_fetch_info(module_t *mod)
 		return error;
 	}
 	if (size != sizeof(modinfo_t **)) {
-		module_error("`link_set_modules' section wrong size %zu != %zu",
-		size, sizeof(modinfo_t **));
+		module_error("`link_set_modules' section wrong size "
+		"(got %zu, wanted %zu)", size, sizeof(modinfo_t **));
 		return ENOEXEC;
 	}
 	mod->mod_info = *(modinfo_t **)addr;



CVS commit: [pgoyette-compat] src/sys/kern

2018-10-03 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Wed Oct  3 22:53:52 UTC 2018

Modified Files:
src/sys/kern [pgoyette-compat]: kern_module.c

Log Message:
Better diagnostic message


To generate a diff of this commit:
cvs rdiff -u -r1.130.2.23 -r1.130.2.24 src/sys/kern/kern_module.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [pgoyette-compat] src/sys/kern

2018-09-23 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sun Sep 23 22:00:58 UTC 2018

Modified Files:
src/sys/kern [pgoyette-compat]: compat_stub.c

Log Message:
Actually allocate/define the kern_proc_32 hook


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.23 -r1.1.2.24 src/sys/kern/compat_stub.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/compat_stub.c
diff -u src/sys/kern/compat_stub.c:1.1.2.23 src/sys/kern/compat_stub.c:1.1.2.24
--- src/sys/kern/compat_stub.c:1.1.2.23	Fri Sep 21 03:42:20 2018
+++ src/sys/kern/compat_stub.c	Sun Sep 23 22:00:58 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: compat_stub.c,v 1.1.2.23 2018/09/21 03:42:20 pgoyette Exp $	*/
+/* $NetBSD: compat_stub.c,v 1.1.2.24 2018/09/23 22:00:58 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -163,3 +163,8 @@ struct compat_modstat_80_hook_t compat_m
  * mask for kern_sig_43's killpg (updated by compat_09)
  */
 int kern_sig_43_pgid_mask = ~0;
+
+/*
+ * hook for kern_proc_32
+ */
+struct kern_proc_32_hook_t kern_proc_32_hook;



CVS commit: [pgoyette-compat] src/sys/kern

2018-09-23 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sun Sep 23 22:00:58 UTC 2018

Modified Files:
src/sys/kern [pgoyette-compat]: compat_stub.c

Log Message:
Actually allocate/define the kern_proc_32 hook


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.23 -r1.1.2.24 src/sys/kern/compat_stub.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [pgoyette-compat] src/sys/kern

2018-09-23 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sun Sep 23 07:44:13 UTC 2018

Modified Files:
src/sys/kern [pgoyette-compat]: kern_rndq.c

Log Message:
Don't bother to include COMPAT_50 related headers, since all the COMPAT_50
code has been relocated.


To generate a diff of this commit:
cvs rdiff -u -r1.89.16.2 -r1.89.16.3 src/sys/kern/kern_rndq.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/kern_rndq.c
diff -u src/sys/kern/kern_rndq.c:1.89.16.2 src/sys/kern/kern_rndq.c:1.89.16.3
--- src/sys/kern/kern_rndq.c:1.89.16.2	Sat Jul 28 04:38:08 2018
+++ src/sys/kern/kern_rndq.c	Sun Sep 23 07:44:13 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_rndq.c,v 1.89.16.2 2018/07/28 04:38:08 pgoyette Exp $	*/
+/*	$NetBSD: kern_rndq.c,v 1.89.16.3 2018/09/23 07:44:13 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 1997-2013 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_rndq.c,v 1.89.16.2 2018/07/28 04:38:08 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_rndq.c,v 1.89.16.3 2018/09/23 07:44:13 pgoyette Exp $");
 
 #include 
 #include 
@@ -56,10 +56,6 @@ __KERNEL_RCSID(0, "$NetBSD: kern_rndq.c,
 
 #include 
 
-#ifdef COMPAT_50
-#include 
-#endif
-
 #if defined(__HAVE_CPU_RNG) && !defined(_RUMPKERNEL)
 #include 
 #endif



CVS commit: [pgoyette-compat] src/sys/kern

2018-09-23 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sun Sep 23 07:44:13 UTC 2018

Modified Files:
src/sys/kern [pgoyette-compat]: kern_rndq.c

Log Message:
Don't bother to include COMPAT_50 related headers, since all the COMPAT_50
code has been relocated.


To generate a diff of this commit:
cvs rdiff -u -r1.89.16.2 -r1.89.16.3 src/sys/kern/kern_rndq.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [pgoyette-compat] src/sys/kern

2018-09-10 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Mon Sep 10 08:52:10 UTC 2018

Modified Files:
src/sys/kern [pgoyette-compat]: syscalls.conf

Log Message:
Add compat_80 to the list of compats


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.28.16.1 src/sys/kern/syscalls.conf

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/syscalls.conf
diff -u src/sys/kern/syscalls.conf:1.28 src/sys/kern/syscalls.conf:1.28.16.1
--- src/sys/kern/syscalls.conf:1.28	Fri May  6 10:17:34 2016
+++ src/sys/kern/syscalls.conf	Mon Sep 10 08:52:10 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: syscalls.conf,v 1.28 2016/05/06 10:17:34 pooka Exp $
+#	$NetBSD: syscalls.conf,v 1.28.16.1 2018/09/10 08:52:10 pgoyette Exp $
 
 sysnames="syscalls.c"
 sysnumhdr="../sys/syscall.h"
@@ -11,7 +11,7 @@ sysalign=1
 rumpcalls="../rump/librump/rumpkern/rump_syscalls.c"
 rumpcallshdr="../rump/include/rump/rump_syscalls.h"
 rumpsysmap="../rump/rump.sysmap"
-compatopts="compat_43 compat_09 compat_10 compat_11 compat_12 compat_13 compat_14 compat_15 compat_16 compat_20 compat_30 compat_40 compat_50 compat_60 compat_70"
+compatopts="compat_43 compat_09 compat_10 compat_11 compat_12 compat_13 compat_14 compat_15 compat_16 compat_20 compat_30 compat_40 compat_50 compat_60 compat_70 compat_80"
 libcompatopts=""
 
 switchname="sysent"



CVS commit: [pgoyette-compat] src/sys/kern

2018-09-10 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Mon Sep 10 08:52:10 UTC 2018

Modified Files:
src/sys/kern [pgoyette-compat]: syscalls.conf

Log Message:
Add compat_80 to the list of compats


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.28.16.1 src/sys/kern/syscalls.conf

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [pgoyette-compat] src/sys/kern

2018-09-09 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sun Sep  9 11:54:10 UTC 2018

Modified Files:
src/sys/kern [pgoyette-compat]: kern_module.c

Log Message:
When freeing the required list, make sure we calculate its size based
on the size of the contained elements, not on the size of a pointer to
those elements.


To generate a diff of this commit:
cvs rdiff -u -r1.130.2.22 -r1.130.2.23 src/sys/kern/kern_module.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [pgoyette-compat] src/sys/kern

2018-09-09 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sun Sep  9 11:54:10 UTC 2018

Modified Files:
src/sys/kern [pgoyette-compat]: kern_module.c

Log Message:
When freeing the required list, make sure we calculate its size based
on the size of the contained elements, not on the size of a pointer to
those elements.


To generate a diff of this commit:
cvs rdiff -u -r1.130.2.22 -r1.130.2.23 src/sys/kern/kern_module.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/kern_module.c
diff -u src/sys/kern/kern_module.c:1.130.2.22 src/sys/kern/kern_module.c:1.130.2.23
--- src/sys/kern/kern_module.c:1.130.2.22	Fri Sep  7 23:32:30 2018
+++ src/sys/kern/kern_module.c	Sun Sep  9 11:54:10 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_module.c,v 1.130.2.22 2018/09/07 23:32:30 pgoyette Exp $	*/
+/*	$NetBSD: kern_module.c,v 1.130.2.23 2018/09/09 11:54:10 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_module.c,v 1.130.2.22 2018/09/07 23:32:30 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_module.c,v 1.130.2.23 2018/09/09 11:54:10 pgoyette Exp $");
 
 #define _MODULE_INTERNAL
 
@@ -245,7 +245,7 @@ module_free(module_t *mod)
 	specificdata_fini(module_specificdata_domain, >mod_sdref);
 	if (mod->mod_required)
 		kmem_free(mod->mod_required, mod->mod_arequired *
-		sizeof(module_t));
+		sizeof(module_t *));
 	kmem_free(mod, sizeof(*mod));
 }
 



CVS commit: [pgoyette-compat] src/sys/kern

2018-09-05 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Thu Sep  6 00:10:55 UTC 2018

Modified Files:
src/sys/kern [pgoyette-compat]: kern_module.c

Log Message:
One more time - let's get this right!


To generate a diff of this commit:
cvs rdiff -u -r1.130.2.19 -r1.130.2.20 src/sys/kern/kern_module.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/kern_module.c
diff -u src/sys/kern/kern_module.c:1.130.2.19 src/sys/kern/kern_module.c:1.130.2.20
--- src/sys/kern/kern_module.c:1.130.2.19	Wed Sep  5 22:04:51 2018
+++ src/sys/kern/kern_module.c	Thu Sep  6 00:10:55 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_module.c,v 1.130.2.19 2018/09/05 22:04:51 pgoyette Exp $	*/
+/*	$NetBSD: kern_module.c,v 1.130.2.20 2018/09/06 00:10:55 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_module.c,v 1.130.2.19 2018/09/05 22:04:51 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_module.c,v 1.130.2.20 2018/09/06 00:10:55 pgoyette Exp $");
 
 #define _MODULE_INTERNAL
 
@@ -1402,9 +1402,6 @@ module_do_unload(const char *name, bool 
 	if (mod->mod_kobj != NULL) {
 		kobj_unload(mod->mod_kobj);
 	}
-	if (mod->mod_required)
-		kmem_free(mod->mod_required, mod->mod_arequired *
-		sizeof(module_t));
 	if (mod->mod_source == MODULE_SOURCE_KERNEL) {
 		if (mod->mod_required != NULL) {
 			/*



CVS commit: [pgoyette-compat] src/sys/kern

2018-09-05 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Thu Sep  6 00:10:55 UTC 2018

Modified Files:
src/sys/kern [pgoyette-compat]: kern_module.c

Log Message:
One more time - let's get this right!


To generate a diff of this commit:
cvs rdiff -u -r1.130.2.19 -r1.130.2.20 src/sys/kern/kern_module.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [pgoyette-compat] src/sys/kern

2018-09-05 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Wed Sep  5 22:04:51 UTC 2018

Modified Files:
src/sys/kern [pgoyette-compat]: kern_module.c

Log Message:
After releasing the resources, make sure we don't retain pointer to them!


To generate a diff of this commit:
cvs rdiff -u -r1.130.2.18 -r1.130.2.19 src/sys/kern/kern_module.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/kern_module.c
diff -u src/sys/kern/kern_module.c:1.130.2.18 src/sys/kern/kern_module.c:1.130.2.19
--- src/sys/kern/kern_module.c:1.130.2.18	Wed Sep  5 09:42:57 2018
+++ src/sys/kern/kern_module.c	Wed Sep  5 22:04:51 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_module.c,v 1.130.2.18 2018/09/05 09:42:57 pgoyette Exp $	*/
+/*	$NetBSD: kern_module.c,v 1.130.2.19 2018/09/05 22:04:51 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_module.c,v 1.130.2.18 2018/09/05 09:42:57 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_module.c,v 1.130.2.19 2018/09/05 22:04:51 pgoyette Exp $");
 
 #define _MODULE_INTERNAL
 
@@ -1406,7 +1406,7 @@ module_do_unload(const char *name, bool 
 		kmem_free(mod->mod_required, mod->mod_arequired *
 		sizeof(module_t));
 	if (mod->mod_source == MODULE_SOURCE_KERNEL) {
-		if (mod->mod_arequired != 0) {
+		if (mod->mod_required != NULL) {
 			/*
 			 * release "required" resources - will be re-parsed
 			 * if the module is re-enabled
@@ -1415,6 +1415,7 @@ module_do_unload(const char *name, bool 
 			mod->mod_arequired * sizeof(module_t *));
 			mod->mod_nrequired = 0;
 			mod->mod_arequired = 0;
+			mod->mod_required = NULL;
 		}
 		if (load_requires_force)
 			module_require_force(mod);



CVS commit: [pgoyette-compat] src/sys/kern

2018-09-05 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Wed Sep  5 22:04:51 UTC 2018

Modified Files:
src/sys/kern [pgoyette-compat]: kern_module.c

Log Message:
After releasing the resources, make sure we don't retain pointer to them!


To generate a diff of this commit:
cvs rdiff -u -r1.130.2.18 -r1.130.2.19 src/sys/kern/kern_module.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [pgoyette-compat] src/sys/kern

2018-09-05 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Wed Sep  5 09:42:58 UTC 2018

Modified Files:
src/sys/kern [pgoyette-compat]: kern_module.c

Log Message:
ooppss - don't forget the structure pointer!


To generate a diff of this commit:
cvs rdiff -u -r1.130.2.17 -r1.130.2.18 src/sys/kern/kern_module.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/kern_module.c
diff -u src/sys/kern/kern_module.c:1.130.2.17 src/sys/kern/kern_module.c:1.130.2.18
--- src/sys/kern/kern_module.c:1.130.2.17	Wed Sep  5 09:26:59 2018
+++ src/sys/kern/kern_module.c	Wed Sep  5 09:42:57 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_module.c,v 1.130.2.17 2018/09/05 09:26:59 pgoyette Exp $	*/
+/*	$NetBSD: kern_module.c,v 1.130.2.18 2018/09/05 09:42:57 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_module.c,v 1.130.2.17 2018/09/05 09:26:59 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_module.c,v 1.130.2.18 2018/09/05 09:42:57 pgoyette Exp $");
 
 #define _MODULE_INTERNAL
 
@@ -1406,7 +1406,7 @@ module_do_unload(const char *name, bool 
 		kmem_free(mod->mod_required, mod->mod_arequired *
 		sizeof(module_t));
 	if (mod->mod_source == MODULE_SOURCE_KERNEL) {
-		if (mod_arequired != 0) {
+		if (mod->mod_arequired != 0) {
 			/*
 			 * release "required" resources - will be re-parsed
 			 * if the module is re-enabled



CVS commit: [pgoyette-compat] src/sys/kern

2018-09-05 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Wed Sep  5 09:42:58 UTC 2018

Modified Files:
src/sys/kern [pgoyette-compat]: kern_module.c

Log Message:
ooppss - don't forget the structure pointer!


To generate a diff of this commit:
cvs rdiff -u -r1.130.2.17 -r1.130.2.18 src/sys/kern/kern_module.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [pgoyette-compat] src/sys/kern

2018-09-05 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Wed Sep  5 09:26:59 UTC 2018

Modified Files:
src/sys/kern [pgoyette-compat]: kern_module.c

Log Message:
If a built-in module is "unloaded", release all the resources associated
with the "required" list.  The list will be re-parsed if the module is
later re-enabled.


To generate a diff of this commit:
cvs rdiff -u -r1.130.2.16 -r1.130.2.17 src/sys/kern/kern_module.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/kern_module.c
diff -u src/sys/kern/kern_module.c:1.130.2.16 src/sys/kern/kern_module.c:1.130.2.17
--- src/sys/kern/kern_module.c:1.130.2.16	Tue Sep  4 11:53:46 2018
+++ src/sys/kern/kern_module.c	Wed Sep  5 09:26:59 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_module.c,v 1.130.2.16 2018/09/04 11:53:46 pgoyette Exp $	*/
+/*	$NetBSD: kern_module.c,v 1.130.2.17 2018/09/05 09:26:59 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_module.c,v 1.130.2.16 2018/09/04 11:53:46 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_module.c,v 1.130.2.17 2018/09/05 09:26:59 pgoyette Exp $");
 
 #define _MODULE_INTERNAL
 
@@ -1406,8 +1406,16 @@ module_do_unload(const char *name, bool 
 		kmem_free(mod->mod_required, mod->mod_arequired *
 		sizeof(module_t));
 	if (mod->mod_source == MODULE_SOURCE_KERNEL) {
-		mod->mod_nrequired = 0; /* will be re-parsed */
-		mod->mod_arequired = 0;
+		if (mod_arequired != 0) {
+			/*
+			 * release "required" resources - will be re-parsed
+			 * if the module is re-enabled
+			 */
+			kmem_free(mod->mod_required,
+			mod->mod_arequired * sizeof(module_t *));
+			mod->mod_nrequired = 0;
+			mod->mod_arequired = 0;
+		}
 		if (load_requires_force)
 			module_require_force(mod);
 		TAILQ_INSERT_TAIL(_builtins, mod, mod_chain);



CVS commit: [pgoyette-compat] src/sys/kern

2018-09-05 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Wed Sep  5 09:26:59 UTC 2018

Modified Files:
src/sys/kern [pgoyette-compat]: kern_module.c

Log Message:
If a built-in module is "unloaded", release all the resources associated
with the "required" list.  The list will be re-parsed if the module is
later re-enabled.


To generate a diff of this commit:
cvs rdiff -u -r1.130.2.16 -r1.130.2.17 src/sys/kern/kern_module.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [pgoyette-compat] src/sys/kern

2018-09-04 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Tue Sep  4 11:53:46 UTC 2018

Modified Files:
src/sys/kern [pgoyette-compat]: kern_module.c

Log Message:
Use correct structure member for module's name.


To generate a diff of this commit:
cvs rdiff -u -r1.130.2.15 -r1.130.2.16 src/sys/kern/kern_module.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/kern_module.c
diff -u src/sys/kern/kern_module.c:1.130.2.15 src/sys/kern/kern_module.c:1.130.2.16
--- src/sys/kern/kern_module.c:1.130.2.15	Tue Sep  4 11:48:38 2018
+++ src/sys/kern/kern_module.c	Tue Sep  4 11:53:46 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_module.c,v 1.130.2.15 2018/09/04 11:48:38 pgoyette Exp $	*/
+/*	$NetBSD: kern_module.c,v 1.130.2.16 2018/09/04 11:53:46 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_module.c,v 1.130.2.15 2018/09/04 11:48:38 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_module.c,v 1.130.2.16 2018/09/04 11:53:46 pgoyette Exp $");
 
 #define _MODULE_INTERNAL
 
@@ -949,7 +949,7 @@ module_do_builtin(const module_t *pmod, 
 error = EEXIST;
 module_error("built-in module %s alias %s "
 "already exists in module %s", name,
-*--aliasp, mod2->mod_info->mod_name);
+*--aliasp, mod2->mod_info->mi_name);
 goto fail;
 			}
 		}



CVS commit: [pgoyette-compat] src/sys/kern

2018-09-04 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Tue Sep  4 11:53:46 UTC 2018

Modified Files:
src/sys/kern [pgoyette-compat]: kern_module.c

Log Message:
Use correct structure member for module's name.


To generate a diff of this commit:
cvs rdiff -u -r1.130.2.15 -r1.130.2.16 src/sys/kern/kern_module.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [pgoyette-compat] src/sys/kern

2018-09-04 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Tue Sep  4 11:48:38 UTC 2018

Modified Files:
src/sys/kern [pgoyette-compat]: kern_module.c

Log Message:
Add some helpful error messages when things fail.


To generate a diff of this commit:
cvs rdiff -u -r1.130.2.14 -r1.130.2.15 src/sys/kern/kern_module.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/kern_module.c
diff -u src/sys/kern/kern_module.c:1.130.2.14 src/sys/kern/kern_module.c:1.130.2.15
--- src/sys/kern/kern_module.c:1.130.2.14	Tue Sep  4 11:31:11 2018
+++ src/sys/kern/kern_module.c	Tue Sep  4 11:48:38 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_module.c,v 1.130.2.14 2018/09/04 11:31:11 pgoyette Exp $	*/
+/*	$NetBSD: kern_module.c,v 1.130.2.15 2018/09/04 11:48:38 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_module.c,v 1.130.2.14 2018/09/04 11:31:11 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_module.c,v 1.130.2.15 2018/09/04 11:48:38 pgoyette Exp $");
 
 #define _MODULE_INTERNAL
 
@@ -904,8 +904,8 @@ module_do_builtin(const module_t *pmod, 
 		 * cases (such as nfsserver + nfs), the dependee can be
 		 * succesfully linked without the dependencies.
 		 */
-		module_error("%s: can't find builtin dependency `%s'",
-		pmod->mod_info->mi_name, name);
+		module_error("built-in module %s can't find builtin "
+		"dependency `%s'", pmod->mod_info->mi_name, name);
 		return ENOENT;
 	}
 
@@ -929,6 +929,8 @@ module_do_builtin(const module_t *pmod, 
 			alloc_required(mod);
 			error = module_do_builtin(mod, buf, , NULL);
 			if (error != 0) {
+module_error("built-in module %s prerequisite "
+"%s failed, error %d", name, buf, error);
 goto fail;
 			}
 			(*mod->mod_required)[mod->mod_nrequired++] = mod2;
@@ -945,6 +947,9 @@ module_do_builtin(const module_t *pmod, 
 if (modp != NULL)
 	*modp = mod2;
 error = EEXIST;
+module_error("built-in module %s alias %s "
+"already exists in module %s", name,
+*--aliasp, mod2->mod_info->mod_name);
 goto fail;
 			}
 		}
@@ -957,8 +962,8 @@ module_do_builtin(const module_t *pmod, 
 	error = (*mi->mi_modcmd)(MODULE_CMD_INIT, props);
 	module_active = prev_active;
 	if (error != 0) {
-		module_error("builtin module `%s' "
-		"failed to init, error %d", mi->mi_name, error);
+		module_error("built-in module %s failed its MODULE_CMD_INIT, "
+		"error %d", mi->mi_name, error);
 		goto fail;
 	}
 



CVS commit: [pgoyette-compat] src/sys/kern

2018-09-04 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Tue Sep  4 11:48:38 UTC 2018

Modified Files:
src/sys/kern [pgoyette-compat]: kern_module.c

Log Message:
Add some helpful error messages when things fail.


To generate a diff of this commit:
cvs rdiff -u -r1.130.2.14 -r1.130.2.15 src/sys/kern/kern_module.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [pgoyette-compat] src/sys/kern

2018-09-04 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Tue Sep  4 11:31:12 UTC 2018

Modified Files:
src/sys/kern [pgoyette-compat]: kern_module.c

Log Message:
If loading a built-in module fails, make sure we reset all the stuff
related to its pre-requisite modules.  Otherwise if we try to load it
again we will panic.


To generate a diff of this commit:
cvs rdiff -u -r1.130.2.13 -r1.130.2.14 src/sys/kern/kern_module.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [pgoyette-compat] src/sys/kern

2018-09-04 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Tue Sep  4 11:31:12 UTC 2018

Modified Files:
src/sys/kern [pgoyette-compat]: kern_module.c

Log Message:
If loading a built-in module fails, make sure we reset all the stuff
related to its pre-requisite modules.  Otherwise if we try to load it
again we will panic.


To generate a diff of this commit:
cvs rdiff -u -r1.130.2.13 -r1.130.2.14 src/sys/kern/kern_module.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/kern_module.c
diff -u src/sys/kern/kern_module.c:1.130.2.13 src/sys/kern/kern_module.c:1.130.2.14
--- src/sys/kern/kern_module.c:1.130.2.13	Mon Jul  9 08:45:41 2018
+++ src/sys/kern/kern_module.c	Tue Sep  4 11:31:11 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_module.c,v 1.130.2.13 2018/07/09 08:45:41 pgoyette Exp $	*/
+/*	$NetBSD: kern_module.c,v 1.130.2.14 2018/09/04 11:31:11 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_module.c,v 1.130.2.13 2018/07/09 08:45:41 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_module.c,v 1.130.2.14 2018/09/04 11:31:11 pgoyette Exp $");
 
 #define _MODULE_INTERNAL
 
@@ -847,7 +847,7 @@ alloc_required(module_t *mod)
 		areq = mod->mod_arequired + MAXMODDEPS;
 		old = mod->mod_required;
 		new = kmem_zalloc(areq * sizeof(module_t *), KM_SLEEP);
-		for (i = 0; i< mod->mod_arequired; i++)
+		for (i = 0; i < mod->mod_arequired; i++)
 			(*new)[i] = (*old)[i];
 		mod->mod_required = new;
 		if (old)
@@ -912,8 +912,10 @@ module_do_builtin(const module_t *pmod, 
 	/*
 	 * Initialize pre-requisites.
 	 */
+	KASSERT(mod->mod_required == NULL);
+	KASSERT(mod->mod_arequired == 0);
+	KASSERT(mod->mod_nrequired == 0);
 	if (mi->mi_required != NULL) {
-		mod->mod_arequired = 0;
 		for (s = mi->mi_required; *s != '\0'; s = p) {
 			if (*s == ',')
 s++;
@@ -926,8 +928,9 @@ module_do_builtin(const module_t *pmod, 
 break;
 			alloc_required(mod);
 			error = module_do_builtin(mod, buf, , NULL);
-			if (error != 0)
+			if (error != 0) {
 goto fail;
+			}
 			(*mod->mod_required)[mod->mod_nrequired++] = mod2;
 		}
 	}
@@ -973,6 +976,9 @@ module_do_builtin(const module_t *pmod, 
 	if (mod->mod_required)
 		kmem_free(mod->mod_required, mod->mod_arequired *
 		sizeof(module_t *));
+	mod->mod_arequired = 0;
+	mod->mod_nrequired = 0;
+	mod->mod_required = NULL;
 	return error;
 }
 



CVS commit: [pgoyette-compat] src/sys/kern

2018-08-01 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Thu Aug  2 05:34:09 UTC 2018

Modified Files:
src/sys/kern [pgoyette-compat]: files.kern

Log Message:
Clean up from sync-with-HEAD


To generate a diff of this commit:
cvs rdiff -u -r1.16.2.6 -r1.16.2.7 src/sys/kern/files.kern

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/files.kern
diff -u src/sys/kern/files.kern:1.16.2.6 src/sys/kern/files.kern:1.16.2.7
--- src/sys/kern/files.kern:1.16.2.6	Sat Jul 28 04:38:08 2018
+++ src/sys/kern/files.kern	Thu Aug  2 05:34:09 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: files.kern,v 1.16.2.6 2018/07/28 04:38:08 pgoyette Exp $
+#	$NetBSD: files.kern,v 1.16.2.7 2018/08/02 05:34:09 pgoyette Exp $
 
 #
 # kernel sources
@@ -6,8 +6,6 @@
 define	kern:	machdep, uvm
 defflag	opt_kern.h			KERN
 defflag	opt_script.h			SETUIDSCRIPTS FDSCRIPTS
-file	compat/common/compat_util.c	kern
-file	compat/common/compat_mod.c	compat_netbsd | compat_netbsd32
 file	conf/debugsyms.c		kern
 file	conf/param.c			kern
 file	kern/bufq_disksort.c		bufq_disksort



CVS commit: [pgoyette-compat] src/sys/kern

2018-08-01 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Thu Aug  2 05:34:09 UTC 2018

Modified Files:
src/sys/kern [pgoyette-compat]: files.kern

Log Message:
Clean up from sync-with-HEAD


To generate a diff of this commit:
cvs rdiff -u -r1.16.2.6 -r1.16.2.7 src/sys/kern/files.kern

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [pgoyette-compat] src/sys/kern

2018-07-09 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Mon Jul  9 08:45:42 UTC 2018

Modified Files:
src/sys/kern [pgoyette-compat]: kern_module.c

Log Message:
Put the checks back in the original order, and remove extra ')'

Thanks to soda for finding the real error.


To generate a diff of this commit:
cvs rdiff -u -r1.130.2.12 -r1.130.2.13 src/sys/kern/kern_module.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/kern_module.c
diff -u src/sys/kern/kern_module.c:1.130.2.12 src/sys/kern/kern_module.c:1.130.2.13
--- src/sys/kern/kern_module.c:1.130.2.12	Mon Jul  9 08:26:29 2018
+++ src/sys/kern/kern_module.c	Mon Jul  9 08:45:41 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_module.c,v 1.130.2.12 2018/07/09 08:26:29 pgoyette Exp $	*/
+/*	$NetBSD: kern_module.c,v 1.130.2.13 2018/07/09 08:45:41 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_module.c,v 1.130.2.12 2018/07/09 08:26:29 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_module.c,v 1.130.2.13 2018/07/09 08:45:41 pgoyette Exp $");
 
 #define _MODULE_INTERNAL
 
@@ -1039,8 +1039,8 @@ module_do_load(const char *name, bool is
 		}
 	}
 	if (mod) {
-		if (!ISSET(flags, MODCTL_LOAD_FORCE) &&
-		ISSET(mod->mod_flags, MODFLG_MUST_FORCE)) {
+		if (ISSET(mod->mod_flags, MODFLG_MUST_FORCE) &&
+		!ISSET(flags, MODCTL_LOAD_FORCE)) {
 			if (!autoload) {
 module_error("use -f to reinstate "
 "builtin module `%s'", name);



CVS commit: [pgoyette-compat] src/sys/kern

2018-07-09 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Mon Jul  9 08:45:42 UTC 2018

Modified Files:
src/sys/kern [pgoyette-compat]: kern_module.c

Log Message:
Put the checks back in the original order, and remove extra ')'

Thanks to soda for finding the real error.


To generate a diff of this commit:
cvs rdiff -u -r1.130.2.12 -r1.130.2.13 src/sys/kern/kern_module.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [pgoyette-compat] src/sys/kern

2018-07-09 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Mon Jul  9 08:26:29 UTC 2018

Modified Files:
src/sys/kern [pgoyette-compat]: kern_module.c

Log Message:
Reverse order of flags checking to appease compiler.  It seems
that gcc doesn't like

if (expr && !ISSET(t, f)) ...


To generate a diff of this commit:
cvs rdiff -u -r1.130.2.11 -r1.130.2.12 src/sys/kern/kern_module.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/kern_module.c
diff -u src/sys/kern/kern_module.c:1.130.2.11 src/sys/kern/kern_module.c:1.130.2.12
--- src/sys/kern/kern_module.c:1.130.2.11	Sun Jul  8 07:33:14 2018
+++ src/sys/kern/kern_module.c	Mon Jul  9 08:26:29 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_module.c,v 1.130.2.11 2018/07/08 07:33:14 pgoyette Exp $	*/
+/*	$NetBSD: kern_module.c,v 1.130.2.12 2018/07/09 08:26:29 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_module.c,v 1.130.2.11 2018/07/08 07:33:14 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_module.c,v 1.130.2.12 2018/07/09 08:26:29 pgoyette Exp $");
 
 #define _MODULE_INTERNAL
 
@@ -1039,8 +1039,8 @@ module_do_load(const char *name, bool is
 		}
 	}
 	if (mod) {
-		if (ISSET(mod->mod_flags, MODFLG_MUST_FORCE)) &&
-		!ISSET(flags, MODCTL_LOAD_FORCE)) {
+		if (!ISSET(flags, MODCTL_LOAD_FORCE) &&
+		ISSET(mod->mod_flags, MODFLG_MUST_FORCE)) {
 			if (!autoload) {
 module_error("use -f to reinstate "
 "builtin module `%s'", name);



CVS commit: [pgoyette-compat] src/sys/kern

2018-07-09 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Mon Jul  9 08:26:29 UTC 2018

Modified Files:
src/sys/kern [pgoyette-compat]: kern_module.c

Log Message:
Reverse order of flags checking to appease compiler.  It seems
that gcc doesn't like

if (expr && !ISSET(t, f)) ...


To generate a diff of this commit:
cvs rdiff -u -r1.130.2.11 -r1.130.2.12 src/sys/kern/kern_module.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [pgoyette-compat] src/sys/kern

2018-07-08 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sun Jul  8 07:33:14 UTC 2018

Modified Files:
src/sys/kern [pgoyette-compat]: kern_module.c kern_module_vfs.c
sys_module.c

Log Message:
Use SET, CLR, ISSET macros from types.h

NFCI


To generate a diff of this commit:
cvs rdiff -u -r1.130.2.10 -r1.130.2.11 src/sys/kern/kern_module.c
cvs rdiff -u -r1.16 -r1.16.8.1 src/sys/kern/kern_module_vfs.c
cvs rdiff -u -r1.23.2.6 -r1.23.2.7 src/sys/kern/sys_module.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [pgoyette-compat] src/sys/kern

2018-07-08 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sun Jul  8 07:33:14 UTC 2018

Modified Files:
src/sys/kern [pgoyette-compat]: kern_module.c kern_module_vfs.c
sys_module.c

Log Message:
Use SET, CLR, ISSET macros from types.h

NFCI


To generate a diff of this commit:
cvs rdiff -u -r1.130.2.10 -r1.130.2.11 src/sys/kern/kern_module.c
cvs rdiff -u -r1.16 -r1.16.8.1 src/sys/kern/kern_module_vfs.c
cvs rdiff -u -r1.23.2.6 -r1.23.2.7 src/sys/kern/sys_module.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/kern_module.c
diff -u src/sys/kern/kern_module.c:1.130.2.10 src/sys/kern/kern_module.c:1.130.2.11
--- src/sys/kern/kern_module.c:1.130.2.10	Mon Jun 25 08:50:10 2018
+++ src/sys/kern/kern_module.c	Sun Jul  8 07:33:14 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_module.c,v 1.130.2.10 2018/06/25 08:50:10 pgoyette Exp $	*/
+/*	$NetBSD: kern_module.c,v 1.130.2.11 2018/07/08 07:33:14 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_module.c,v 1.130.2.10 2018/06/25 08:50:10 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_module.c,v 1.130.2.11 2018/07/08 07:33:14 pgoyette Exp $");
 
 #define _MODULE_INTERNAL
 
@@ -256,7 +256,7 @@ module_free(module_t *mod)
 static void
 module_require_force(struct module *mod)
 {
-	mod->mod_flags |= MODFLG_MUST_FORCE;
+	SET(mod->mod_flags, MODFLG_MUST_FORCE);
 }
 
 /*
@@ -577,7 +577,7 @@ module_init_class(modclass_t modclass)
 			 * (If the module has previously been set to
 			 * MODFLG_MUST_FORCE, don't try to override that!)
 			 */
-			if ((mod->mod_flags & MODFLG_MUST_FORCE) ||
+			if (ISSET(mod->mod_flags, MODFLG_MUST_FORCE) ||
 			module_do_builtin(mod, mi->mi_name, NULL,
 			NULL) != 0) {
 TAILQ_REMOVE(_builtins, mod, mod_chain);
@@ -1039,8 +1039,8 @@ module_do_load(const char *name, bool is
 		}
 	}
 	if (mod) {
-		if ((mod->mod_flags & MODFLG_MUST_FORCE) &&
-		(flags & MODCTL_LOAD_FORCE) == 0) {
+		if (ISSET(mod->mod_flags, MODFLG_MUST_FORCE)) &&
+		!ISSET(flags, MODCTL_LOAD_FORCE)) {
 			if (!autoload) {
 module_error("use -f to reinstate "
 "builtin module `%s'", name);
@@ -1130,7 +1130,7 @@ module_do_load(const char *name, bool is
 	if (!module_compatible(mi->mi_version, __NetBSD_Version__)) {
 		module_error("module `%s' built for `%d', system `%d'",
 		mi->mi_name, mi->mi_version, __NetBSD_Version__);
-		if ((flags & MODCTL_LOAD_FORCE) != 0) {
+		if (ISSET(flags, MODCTL_LOAD_FORCE)) {
 			module_error("forced load, system may be unstable");
 		} else {
 			error = EPROGMISMATCH;
@@ -1311,7 +1311,7 @@ module_do_load(const char *name, bool is
 		 * a short delay unless auto-unload is disabled.
 		 */
 		mod->mod_autotime = time_second + module_autotime;
-		mod->mod_flags |= MODFLG_AUTO_LOADED;
+		SET(mod->mod_flags, MODFLG_AUTO_LOADED);
 		module_thread_kick();
 	}
 	SLIST_REMOVE_HEAD(_stack, pe_entry);
@@ -1544,7 +1544,7 @@ module_thread(void *cookie)
 			if (mod->mod_source == MODULE_SOURCE_KERNEL)
 continue;
 			/* skip modules that weren't auto-loaded */
-			if ((mod->mod_flags & MODFLG_AUTO_LOADED) == 0)
+			if (!ISSET(mod->mod_flags, MODFLG_AUTO_LOADED))
 continue;
 
 			if (uvmexp.free < uvmexp.freemin) {

Index: src/sys/kern/kern_module_vfs.c
diff -u src/sys/kern/kern_module_vfs.c:1.16 src/sys/kern/kern_module_vfs.c:1.16.8.1
--- src/sys/kern/kern_module_vfs.c:1.16	Thu Jun  1 02:45:13 2017
+++ src/sys/kern/kern_module_vfs.c	Sun Jul  8 07:33:14 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_module_vfs.c,v 1.16 2017/06/01 02:45:13 chs Exp $	*/
+/*	$NetBSD: kern_module_vfs.c,v 1.16.8.1 2018/07/08 07:33:14 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_module_vfs.c,v 1.16 2017/06/01 02:45:13 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_module_vfs.c,v 1.16.8.1 2018/07/08 07:33:14 pgoyette Exp $");
 
 #define _MODULE_INTERNAL
 #include 
@@ -106,7 +106,7 @@ module_load_vfs(const char *name, int fl
 	/*
 	 * Load and process .plist if it exists.
 	 */
-	if (((flags & MODCTL_NO_PROP) == 0 && filedictp) || autoload) {
+	if ((!ISSET(flags, MODCTL_NO_PROP) && filedictp) || autoload) {
 		error = module_load_plist_vfs(path, nochroot, );
 		if (error != 0) {
 			module_print("plist load returned error %d for `%s'",
@@ -124,7 +124,7 @@ module_load_vfs(const char *name, int fl
 			}
 		}
 		if (error == 0) {	/* can get here if error == ENOENT */
-			if ((flags & MODCTL_NO_PROP) == 0 && filedictp)
+			if (!ISSET(flags, MODCTL_NO_PROP) && filedictp)
 *filedictp = moduledict;
 			else 
 prop_object_release(moduledict);

Index: src/sys/kern/sys_module.c
diff -u src/sys/kern/sys_module.c:1.23.2.6 src/sys/kern/sys_module.c:1.23.2.7
--- src/sys/kern/sys_module.c:1.23.2.6	Tue Apr  3 08:29:44 2018
+++ 

CVS commit: [pgoyette-compat] src/sys/kern

2018-06-25 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Mon Jun 25 08:50:10 UTC 2018

Modified Files:
src/sys/kern [pgoyette-compat]: kern_module.c

Log Message:
Finish de-confliction


To generate a diff of this commit:
cvs rdiff -u -r1.130.2.9 -r1.130.2.10 src/sys/kern/kern_module.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [pgoyette-compat] src/sys/kern

2018-06-25 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Mon Jun 25 08:50:10 UTC 2018

Modified Files:
src/sys/kern [pgoyette-compat]: kern_module.c

Log Message:
Finish de-confliction


To generate a diff of this commit:
cvs rdiff -u -r1.130.2.9 -r1.130.2.10 src/sys/kern/kern_module.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/kern_module.c
diff -u src/sys/kern/kern_module.c:1.130.2.9 src/sys/kern/kern_module.c:1.130.2.10
--- src/sys/kern/kern_module.c:1.130.2.9	Mon Jun 25 07:22:54 2018
+++ src/sys/kern/kern_module.c	Mon Jun 25 08:50:10 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_module.c,v 1.130.2.9 2018/06/25 07:22:54 pgoyette Exp $	*/
+/*	$NetBSD: kern_module.c,v 1.130.2.10 2018/06/25 08:50:10 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_module.c,v 1.130.2.9 2018/06/25 07:22:54 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_module.c,v 1.130.2.10 2018/06/25 08:50:10 pgoyette Exp $");
 
 #define _MODULE_INTERNAL
 
@@ -1105,7 +1105,6 @@ module_do_load(const char *name, bool is
 #endif
 			SLIST_REMOVE_HEAD(_stack, pe_entry);
 			module_free(mod);
-			depth--;
 			return error;
 		}
 		TAILQ_INSERT_TAIL(pending, mod, mod_chain);
@@ -1332,7 +1331,6 @@ module_do_load(const char *name, bool is
 	TAILQ_REMOVE(pending, mod, mod_chain);
 	SLIST_REMOVE_HEAD(_stack, pe_entry);
 	module_free(mod);
-	depth--;
 	return error;
 }
 



CVS commit: [pgoyette-compat] src/sys/kern

2018-04-17 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Tue Apr 17 23:58:48 UTC 2018

Modified Files:
src/sys/kern [pgoyette-compat]: syscalls.master

Log Message:
Update compat module names to reference the version-specific modules.

This way, when we autoload compat code we load only what is needed,
and nothing "older".


To generate a diff of this commit:
cvs rdiff -u -r1.291.2.6 -r1.291.2.7 src/sys/kern/syscalls.master

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/syscalls.master
diff -u src/sys/kern/syscalls.master:1.291.2.6 src/sys/kern/syscalls.master:1.291.2.7
--- src/sys/kern/syscalls.master:1.291.2.6	Tue Mar 27 23:08:44 2018
+++ src/sys/kern/syscalls.master	Tue Apr 17 23:58:48 2018
@@ -1,4 +1,4 @@
-	$NetBSD: syscalls.master,v 1.291.2.6 2018/03/27 23:08:44 pgoyette Exp $
+	$NetBSD: syscalls.master,v 1.291.2.7 2018/04/17 23:58:48 pgoyette Exp $
 
 ;	@(#)syscalls.master	8.2 (Berkeley) 1/13/94
 
@@ -76,28 +76,28 @@
 5	STD 	 RUMP	{ int|sys||open(const char *path, \
 			int flags, ... mode_t mode); }
 6	STD	 RUMP	{ int|sys||close(int fd); }
-7	COMPAT_50 MODULAR compat { int|sys||wait4(pid_t pid, int *status, \
+7	COMPAT_50 MODULAR compat_50 { int|sys||wait4(pid_t pid, int *status, \
 			int options, struct rusage50 *rusage); }
-8	COMPAT_43 MODULAR compat	\
+8	COMPAT_43 MODULAR compat_43	\
 		{ int|sys||creat(const char *path, mode_t mode); } ocreat
 9	STD 	 RUMP	{ int|sys||link(const char *path, const char *link); }
 10	STD 	 RUMP	{ int|sys||unlink(const char *path); }
 11	OBSOL		execv
 12	STD 	 RUMP	{ int|sys||chdir(const char *path); }
 13	STD 	 RUMP	{ int|sys||fchdir(int fd); }
-14	COMPAT_50 MODULAR compat RUMP	\
+14	COMPAT_50 MODULAR compat_50 RUMP	\
 		{ int|sys||mknod(const char *path, mode_t mode, uint32_t dev); }
 15	STD 	 RUMP	{ int|sys||chmod(const char *path, mode_t mode); }
 16	STD 	 RUMP	{ int|sys||chown(const char *path, uid_t uid, \
 			gid_t gid); }
 17	STD 		{ int|sys||obreak(char *nsize); } break
-18	COMPAT_20 MODULAR compat { int|sys||getfsstat(struct statfs12 *buf, \
+18	COMPAT_20 MODULAR compat_20 { int|sys||getfsstat(struct statfs12 *buf, \
 			long bufsize, int flags); }
-19	COMPAT_43 MODULAR compat	\
+19	COMPAT_43 MODULAR compat_43	\
 		{ long|sys||lseek(int fd, long offset, int whence); }\
 			olseek
 20	NOERR 	RUMP	{ pid_t|sys||getpid_with_ppid(void); } getpid
-21	COMPAT_40 MODULAR compat	\
+21	COMPAT_40 MODULAR compat_40	\
 		{ int|sys||mount(const char *type, const char *path, \
 			int flags, void *data); }
 22	STD 	RUMP	{ int|sys||unmount(const char *path, int flags); }
@@ -125,10 +125,10 @@
 35	STD 	RUMP	{ int|sys||fchflags(int fd, u_long flags); }
 36	NOERR 	 RUMP	{ void|sys||sync(void); }
 37	STD 		{ int|sys||kill(pid_t pid, int signum); }
-38	COMPAT_43 MODULAR compat	\
+38	COMPAT_43 MODULAR compat_43	\
 		{ int|sys||stat(const char *path, struct stat43 *ub); } stat43
 39	NOERR 	RUMP	{ pid_t|sys||getppid(void); }
-40	COMPAT_43 MODULAR compat	\
+40	COMPAT_43 MODULAR compat_43	\
 		{ int|sys||lstat(const char *path, \
 			struct stat43 *ub); } lstat43
 41	STD 	RUMP	{ int|sys||dup(int fd); }
@@ -138,22 +138,22 @@
 			u_long offset, u_int scale); }
 45	STD 	RUMP	{ int|sys||ktrace(const char *fname, int ops, \
 			int facs, pid_t pid); }
-46	COMPAT_13 MODULAR compat { int|sys||sigaction(int signum, \
+46	COMPAT_13 MODULAR compat_13 { int|sys||sigaction(int signum, \
 			const struct sigaction13 *nsa, \
 			struct sigaction13 *osa); } sigaction13
 47	NOERR 	RUMP	{ gid_t|sys||getgid_with_egid(void); } getgid
-48	COMPAT_13 MODULAR compat { int|sys||sigprocmask(int how, \
+48	COMPAT_13 MODULAR compat_13 { int|sys||sigprocmask(int how, \
 			int mask); } sigprocmask13
 49	STD 	RUMP	{ int|sys||__getlogin(char *namebuf, size_t namelen); }
 50	STD 	RUMP 	{ int|sys||__setlogin(const char *namebuf); }
 51	STD 		{ int|sys||acct(const char *path); }
-52	COMPAT_13 MODULAR compat { int|sys||sigpending(void); } sigpending13
-53	COMPAT_13 MODULAR compat { int|sys||sigaltstack( \
+52	COMPAT_13 MODULAR compat_13 { int|sys||sigpending(void); } sigpending13
+53	COMPAT_13 MODULAR compat_13 { int|sys||sigaltstack( \
 			const struct sigaltstack13 *nss, \
 			struct sigaltstack13 *oss); } sigaltstack13
 54	STD	RUMP	{ int|sys||ioctl(int fd, \
 			u_long com, ... void *data); }
-55	COMPAT_12 MODULAR compat { int|sys||reboot(int opt); } oreboot
+55	COMPAT_12 MODULAR compat_12 { int|sys||reboot(int opt); } oreboot
 56	STD 	 RUMP	{ int|sys||revoke(const char *path); }
 57	STD 	 RUMP	{ int|sys||symlink(const char *path, \
 			const char *link); }
@@ -163,21 +163,21 @@
 			char * const *argp, char * const *envp); }
 60	STD 	 RUMP	{ mode_t|sys||umask(mode_t newmask); }
 61	STD 	 RUMP	{ int|sys||chroot(const char *path); }
-62	COMPAT_43 MODULAR compat	\
+62	COMPAT_43 MODULAR compat_43	\
 		{ int|sys||fstat(int fd, struct 

CVS commit: [pgoyette-compat] src/sys/kern

2018-04-17 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Tue Apr 17 23:58:48 UTC 2018

Modified Files:
src/sys/kern [pgoyette-compat]: syscalls.master

Log Message:
Update compat module names to reference the version-specific modules.

This way, when we autoload compat code we load only what is needed,
and nothing "older".


To generate a diff of this commit:
cvs rdiff -u -r1.291.2.6 -r1.291.2.7 src/sys/kern/syscalls.master

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [pgoyette-compat] src/sys/kern

2018-04-01 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Mon Apr  2 00:18:43 UTC 2018

Modified Files:
src/sys/kern [pgoyette-compat]: kern_module.c

Log Message:
Typos (new = old, not old = new!), whitespace, and consistency in
references to the dynamically allocated array of required modules.


To generate a diff of this commit:
cvs rdiff -u -r1.130.2.7 -r1.130.2.8 src/sys/kern/kern_module.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [pgoyette-compat] src/sys/kern

2018-04-01 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Mon Apr  2 00:18:43 UTC 2018

Modified Files:
src/sys/kern [pgoyette-compat]: kern_module.c

Log Message:
Typos (new = old, not old = new!), whitespace, and consistency in
references to the dynamically allocated array of required modules.


To generate a diff of this commit:
cvs rdiff -u -r1.130.2.7 -r1.130.2.8 src/sys/kern/kern_module.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/kern_module.c
diff -u src/sys/kern/kern_module.c:1.130.2.7 src/sys/kern/kern_module.c:1.130.2.8
--- src/sys/kern/kern_module.c:1.130.2.7	Sun Apr  1 23:06:11 2018
+++ src/sys/kern/kern_module.c	Mon Apr  2 00:18:43 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_module.c,v 1.130.2.7 2018/04/01 23:06:11 pgoyette Exp $	*/
+/*	$NetBSD: kern_module.c,v 1.130.2.8 2018/04/02 00:18:43 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_module.c,v 1.130.2.7 2018/04/01 23:06:11 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_module.c,v 1.130.2.8 2018/04/02 00:18:43 pgoyette Exp $");
 
 #define _MODULE_INTERNAL
 
@@ -787,10 +787,10 @@ alloc_required(module_t *mod)
 
 	if (mod->mod_nrequired >= mod->mod_arequired) {
 		areq = mod->mod_arequired + MAXMODDEPS;
-		old= mod->mod_required;
-		new= kmem_alloc(areq * sizeof(module_t *), KM_SLEEP);
+		old = mod->mod_required;
+		new = kmem_zalloc(areq * sizeof(module_t *), KM_SLEEP);
 		for (i = 0; i< mod->mod_arequired; i++)
-			(*old)[i] = (*new)[i];
+			(*new)[i] = (*old)[i];
 		mod->mod_required = new;
 		if (old)
 			kmem_free(old, mod->mod_arequired * sizeof(module_t *));
@@ -870,7 +870,7 @@ module_do_builtin(const module_t *pmod, 
 			error = module_do_builtin(mod, buf, , NULL);
 			if (error != 0)
 goto fail;
-			*mod->mod_required[mod->mod_nrequired++] = mod2;
+			(*mod->mod_required)[mod->mod_nrequired++] = mod2;
 		}
 	}
 
@@ -1172,7 +1172,7 @@ module_do_load(const char *name, bool is
 buf, error);
 goto fail;
 			}
-			*mod->mod_required[mod->mod_nrequired++] = mod2;
+			(*mod->mod_required)[mod->mod_nrequired++] = mod2;
 		}
 	}
 



CVS commit: [pgoyette-compat] src/sys/kern

2018-04-01 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sun Apr  1 10:47:53 UTC 2018

Modified Files:
src/sys/kern [pgoyette-compat]: sys_module.c

Log Message:
In the data returned by MODCTL_STAT, include alias information for
modules that are still on the built-in list.


To generate a diff of this commit:
cvs rdiff -u -r1.23.2.3 -r1.23.2.4 src/sys/kern/sys_module.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/sys_module.c
diff -u src/sys/kern/sys_module.c:1.23.2.3 src/sys/kern/sys_module.c:1.23.2.4
--- src/sys/kern/sys_module.c:1.23.2.3	Sun Mar 11 08:32:21 2018
+++ src/sys/kern/sys_module.c	Sun Apr  1 10:47:53 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: sys_module.c,v 1.23.2.3 2018/03/11 08:32:21 pgoyette Exp $	*/
+/*	$NetBSD: sys_module.c,v 1.23.2.4 2018/04/01 10:47:53 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sys_module.c,v 1.23.2.3 2018/03/11 08:32:21 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_module.c,v 1.23.2.4 2018/04/01 10:47:53 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_modular.h"
@@ -110,6 +110,17 @@ out1:
 	return error;
 }
 
+static void
+copy_alias(modstat_t ms, const char * const *aliasp, modinfo_t mi, module_t mod)
+{
+
+	strlcpy(ms->ms_name, *aliasp, sizeof(ms->ms_name));
+	strlcpy(ms->ms_required, mi->mi_name, sizeof(ms->ms_required));
+	ms->ms_class = mi->mi_class;
+	ms->ms_source = mod->mod_source;
+	ms->ms_flags = mod->mod_flags | MODFLG_IS_ALIAS;
+}
+
 static int
 handle_modctl_stat(struct iovec *iov, void *arg)
 {
@@ -163,12 +174,7 @@ handle_modctl_stat(struct iovec *iov, vo
 		if (aliasp == NULL)
 			continue;
 		while (*aliasp) {
-			strlcpy(ms->ms_name, *aliasp, sizeof(ms->ms_name));
-			strlcpy(ms->ms_required, mi->mi_name,
-			sizeof(ms->ms_required));
-			ms->ms_class = mi->mi_class;
-			ms->ms_source = mod->mod_source;
-			ms->ms_flags = mod->mod_flags | MODFLG_IS_ALIAS;
+			copy_alias(ms, aliasp, mi, mod);
 			aliasp++;
 			ms++;
 		}
@@ -190,6 +196,14 @@ handle_modctl_stat(struct iovec *iov, vo
 		KASSERT(mod->mod_source == MODULE_SOURCE_KERNEL);
 		ms->ms_source = mod->mod_source;
 		ms++;
+		aliasp = *mi->mi_aliases;
+		if (aliasp == NULL)
+			continue;
+		while (*aliasp) {
+			copy_alias(ms, aliasp, mi, mod);
+			aliasp++;
+			ms++;
+		}
 	}
 	kernconfig_unlock();
 	error = copyout(mso, iov->iov_base,



CVS commit: [pgoyette-compat] src/sys/kern

2018-04-01 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sun Apr  1 10:47:53 UTC 2018

Modified Files:
src/sys/kern [pgoyette-compat]: sys_module.c

Log Message:
In the data returned by MODCTL_STAT, include alias information for
modules that are still on the built-in list.


To generate a diff of this commit:
cvs rdiff -u -r1.23.2.3 -r1.23.2.4 src/sys/kern/sys_module.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [pgoyette-compat] src/sys/kern

2018-03-31 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sat Mar 31 08:34:17 UTC 2018

Modified Files:
src/sys/kern [pgoyette-compat]: kern_module.c

Log Message:
Rather than allocating and freeing the recursion stack entry from the pool,
just use an entry allocated on the procedure's stack.  The recursion entry
is very short-lived anyway, and always gets freed before the procedure
exits.


To generate a diff of this commit:
cvs rdiff -u -r1.130.2.5 -r1.130.2.6 src/sys/kern/kern_module.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/kern_module.c
diff -u src/sys/kern/kern_module.c:1.130.2.5 src/sys/kern/kern_module.c:1.130.2.6
--- src/sys/kern/kern_module.c:1.130.2.5	Fri Mar 30 23:49:42 2018
+++ src/sys/kern/kern_module.c	Sat Mar 31 08:34:17 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_module.c,v 1.130.2.5 2018/03/30 23:49:42 pgoyette Exp $	*/
+/*	$NetBSD: kern_module.c,v 1.130.2.6 2018/03/31 08:34:17 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_module.c,v 1.130.2.5 2018/03/30 23:49:42 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_module.c,v 1.130.2.6 2018/03/31 08:34:17 pgoyette Exp $");
 
 #define _MODULE_INTERNAL
 
@@ -913,7 +913,7 @@ module_do_load(const char *name, bool is
 	struct pend_entry {
 		SLIST_ENTRY(pend_entry) pe_entry;
 		struct pending_t *pe_pending;
-	} *my_pend_entry;
+	} my_pend_entry;
 
 	modinfo_t *mi;
 	module_t *mod, *mod2, *prev_active;
@@ -942,9 +942,8 @@ module_do_load(const char *name, bool is
 		pending = SLIST_FIRST(_stack)->pe_pending;
 	} else
 		pending = _pending;
-	my_pend_entry = kmem_zalloc(sizeof(*my_pend_entry), KM_SLEEP);
-	my_pend_entry->pe_pending = pending;
-	SLIST_INSERT_HEAD(_stack, my_pend_entry, pe_entry);
+	my_pend_entry.pe_pending = pending;
+	SLIST_INSERT_HEAD(_stack, _pend_entry, pe_entry);
 
 	/*
 	 * Search the list of disabled builtins first.
@@ -962,11 +961,9 @@ module_do_load(const char *name, bool is
 "builtin module `%s'", name);
 			}
 			SLIST_REMOVE_HEAD(_stack, pe_entry);
-			kmem_free(my_pend_entry, sizeof(*my_pend_entry));
 			return EPERM;
 		} else {
 			SLIST_REMOVE_HEAD(_stack, pe_entry);
-			kmem_free(my_pend_entry, sizeof(*my_pend_entry));
 			error = module_do_builtin(mod, name, modp, props);
 			return error;
 		}
@@ -996,7 +993,6 @@ module_do_load(const char *name, bool is
 			module_print("%s module `%s' already loaded",
 			isdep ? "dependent" : "requested", name);
 			SLIST_REMOVE_HEAD(_stack, pe_entry);
-			kmem_free(my_pend_entry, sizeof(*my_pend_entry));
 			return EEXIST;
 		}
 
@@ -1004,7 +1000,6 @@ module_do_load(const char *name, bool is
 		if (mod == NULL) {
 			module_error("out of memory for `%s'", name);
 			SLIST_REMOVE_HEAD(_stack, pe_entry);
-			kmem_free(my_pend_entry, sizeof(*my_pend_entry));
 			return ENOMEM;
 		}
 
@@ -1025,7 +1020,6 @@ module_do_load(const char *name, bool is
 #endif
 			kmem_free(mod, sizeof(*mod));
 			SLIST_REMOVE_HEAD(_stack, pe_entry);
-			kmem_free(my_pend_entry, sizeof(*my_pend_entry));
 			return error;
 		}
 		TAILQ_INSERT_TAIL(pending, mod, mod_chain);
@@ -1241,7 +1235,6 @@ module_do_load(const char *name, bool is
 		module_thread_kick();
 	}
 	SLIST_REMOVE_HEAD(_stack, pe_entry);
-	kmem_free(my_pend_entry, sizeof(*my_pend_entry));
 	module_print("module `%s' loaded successfully", mi->mi_name);
 	return 0;
 
@@ -1257,7 +1250,6 @@ module_do_load(const char *name, bool is
 	TAILQ_REMOVE(pending, mod, mod_chain);
 	kmem_free(mod, sizeof(*mod));
 	SLIST_REMOVE_HEAD(_stack, pe_entry);
-	kmem_free(my_pend_entry, sizeof(*my_pend_entry));
 	return error;
 }
 



CVS commit: [pgoyette-compat] src/sys/kern

2018-03-31 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sat Mar 31 08:34:17 UTC 2018

Modified Files:
src/sys/kern [pgoyette-compat]: kern_module.c

Log Message:
Rather than allocating and freeing the recursion stack entry from the pool,
just use an entry allocated on the procedure's stack.  The recursion entry
is very short-lived anyway, and always gets freed before the procedure
exits.


To generate a diff of this commit:
cvs rdiff -u -r1.130.2.5 -r1.130.2.6 src/sys/kern/kern_module.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [pgoyette-compat] src/sys/kern

2018-03-30 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Fri Mar 30 23:49:42 UTC 2018

Modified Files:
src/sys/kern [pgoyette-compat]: kern_module.c

Log Message:
Use an SLIST-based stack rather than a statically-allocated array for
recursion control.  This eliminates the MAXDEPTH constraint.

XXX We still have a static limit on MAXMODDEPS


To generate a diff of this commit:
cvs rdiff -u -r1.130.2.4 -r1.130.2.5 src/sys/kern/kern_module.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/kern_module.c
diff -u src/sys/kern/kern_module.c:1.130.2.4 src/sys/kern/kern_module.c:1.130.2.5
--- src/sys/kern/kern_module.c:1.130.2.4	Sun Mar 11 11:47:45 2018
+++ src/sys/kern/kern_module.c	Fri Mar 30 23:49:42 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_module.c,v 1.130.2.4 2018/03/11 11:47:45 pgoyette Exp $	*/
+/*	$NetBSD: kern_module.c,v 1.130.2.5 2018/03/30 23:49:42 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_module.c,v 1.130.2.4 2018/03/11 11:47:45 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_module.c,v 1.130.2.5 2018/03/30 23:49:42 pgoyette Exp $");
 
 #define _MODULE_INTERNAL
 
@@ -902,13 +902,19 @@ module_do_load(const char *name, bool is
 	   prop_dictionary_t props, module_t **modp, modclass_t modclass,
 	   bool autoload)
 {
-#define MODULE_MAX_DEPTH 6
-
+	/* The pending list for this level of recursion */
 	TAILQ_HEAD(pending_t, module);
-	static int depth = 0;
-	static struct pending_t *pending_lists[MODULE_MAX_DEPTH];
 	struct pending_t *pending;
 	struct pending_t new_pending = TAILQ_HEAD_INITIALIZER(new_pending);
+
+	/* The stack of pending lists */
+	static SLIST_HEAD(pend_head, pend_entry) pend_stack =
+		SLIST_HEAD_INITIALIZER(pend_stack);
+	struct pend_entry {
+		SLIST_ENTRY(pend_entry) pe_entry;
+		struct pending_t *pe_pending;
+	} *my_pend_entry;
+
 	modinfo_t *mi;
 	module_t *mod, *mod2, *prev_active;
 	prop_dictionary_t filedict;
@@ -924,27 +930,21 @@ module_do_load(const char *name, bool is
 	error = 0;
 
 	/*
-	 * Avoid recursing too far.
-	 */
-	if (++depth > MODULE_MAX_DEPTH) {
-		module_error("recursion too deep for `%s' %d > %d", name,
-		depth, MODULE_MAX_DEPTH);
-		depth--;
-		return EMLINK;
-	}
-
-	/*
-	 * Set up the pending list for this depth.  If this is a
-	 * recursive entry, then use same list as for outer call,
-	 * else use the locally allocated list.  In either case,
-	 * remember which one we're using.
+	 * Set up the pending list for this entry.  If this is an
+	 * internal entry (for a dependency), then use the same list
+	 * as for the outer call;  otherwise, it's an external entry
+	 * (possibly recursive, ie a module's xxx_modcmd(init, ...)
+	 * routine called us), so use the locally allocated list.  In
+	 * either case, add it to our stack.
 	 */
 	if (isdep) {
-		KASSERT(depth > 1);
-		pending = pending_lists[depth - 2];
+		KASSERT(SLIST_FIRST(_stack) != NULL);
+		pending = SLIST_FIRST(_stack)->pe_pending;
 	} else
 		pending = _pending;
-	pending_lists[depth - 1] = pending;
+	my_pend_entry = kmem_zalloc(sizeof(*my_pend_entry), KM_SLEEP);
+	my_pend_entry->pe_pending = pending;
+	SLIST_INSERT_HEAD(_stack, my_pend_entry, pe_entry);
 
 	/*
 	 * Search the list of disabled builtins first.
@@ -961,11 +961,13 @@ module_do_load(const char *name, bool is
 module_error("use -f to reinstate "
 "builtin module `%s'", name);
 			}
-			depth--;
+			SLIST_REMOVE_HEAD(_stack, pe_entry);
+			kmem_free(my_pend_entry, sizeof(*my_pend_entry));
 			return EPERM;
 		} else {
+			SLIST_REMOVE_HEAD(_stack, pe_entry);
+			kmem_free(my_pend_entry, sizeof(*my_pend_entry));
 			error = module_do_builtin(mod, name, modp, props);
-			depth--;
 			return error;
 		}
 	}
@@ -993,14 +995,16 @@ module_do_load(const char *name, bool is
 			}
 			module_print("%s module `%s' already loaded",
 			isdep ? "dependent" : "requested", name);
-			depth--;
+			SLIST_REMOVE_HEAD(_stack, pe_entry);
+			kmem_free(my_pend_entry, sizeof(*my_pend_entry));
 			return EEXIST;
 		}
 
 		mod = module_newmodule(MODULE_SOURCE_FILESYS);
 		if (mod == NULL) {
 			module_error("out of memory for `%s'", name);
-			depth--;
+			SLIST_REMOVE_HEAD(_stack, pe_entry);
+			kmem_free(my_pend_entry, sizeof(*my_pend_entry));
 			return ENOMEM;
 		}
 
@@ -1020,7 +1024,8 @@ module_do_load(const char *name, bool is
 "error %d", name, error);
 #endif
 			kmem_free(mod, sizeof(*mod));
-			depth--;
+			SLIST_REMOVE_HEAD(_stack, pe_entry);
+			kmem_free(my_pend_entry, sizeof(*my_pend_entry));
 			return error;
 		}
 		TAILQ_INSERT_TAIL(pending, mod, mod_chain);
@@ -1235,7 +1240,8 @@ module_do_load(const char *name, bool is
 		mod->mod_flags |= MODFLG_AUTO_LOADED;
 		module_thread_kick();
 	}
-	depth--;
+	SLIST_REMOVE_HEAD(_stack, pe_entry);
+	kmem_free(my_pend_entry, sizeof(*my_pend_entry));
 	

CVS commit: [pgoyette-compat] src/sys/kern

2018-03-30 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Fri Mar 30 23:49:42 UTC 2018

Modified Files:
src/sys/kern [pgoyette-compat]: kern_module.c

Log Message:
Use an SLIST-based stack rather than a statically-allocated array for
recursion control.  This eliminates the MAXDEPTH constraint.

XXX We still have a static limit on MAXMODDEPS


To generate a diff of this commit:
cvs rdiff -u -r1.130.2.4 -r1.130.2.5 src/sys/kern/kern_module.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [pgoyette-compat] src/sys/kern

2018-03-27 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Tue Mar 27 23:08:44 UTC 2018

Modified Files:
src/sys/kern [pgoyette-compat]: syscalls.master

Log Message:
Mark syscall #175 modular, since it is provided by the COMPAT_30 code


To generate a diff of this commit:
cvs rdiff -u -r1.291.2.5 -r1.291.2.6 src/sys/kern/syscalls.master

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/syscalls.master
diff -u src/sys/kern/syscalls.master:1.291.2.5 src/sys/kern/syscalls.master:1.291.2.6
--- src/sys/kern/syscalls.master:1.291.2.5	Sun Mar 25 07:19:13 2018
+++ src/sys/kern/syscalls.master	Tue Mar 27 23:08:44 2018
@@ -1,4 +1,4 @@
-	$NetBSD: syscalls.master,v 1.291.2.5 2018/03/25 07:19:13 pgoyette Exp $
+	$NetBSD: syscalls.master,v 1.291.2.6 2018/03/27 23:08:44 pgoyette Exp $
 
 ;	@(#)syscalls.master	8.2 (Berkeley) 1/13/94
 
@@ -381,7 +381,8 @@
 174	STD 	 RUMP	{ ssize_t|sys||pwrite(int fd, const void *buf, \
 			size_t nbyte, int PAD, off_t offset); }
 ; For some reason, ntp_gettime doesn't want to raise SIGSYS when it's excluded.
-175	COMPAT_30	{ int|sys||ntp_gettime(struct ntptimeval30 *ntvp); }
+175	COMPAT_30 MODULAR compat_30	\
+			{ int|sys||ntp_gettime(struct ntptimeval30 *ntvp); }
 #if defined(NTP) || !defined(_KERNEL_OPT)
 176	STD 		{ int|sys||ntp_adjtime(struct timex *tp); }
 #else



CVS commit: [pgoyette-compat] src/sys/kern

2018-03-27 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Tue Mar 27 23:08:44 UTC 2018

Modified Files:
src/sys/kern [pgoyette-compat]: syscalls.master

Log Message:
Mark syscall #175 modular, since it is provided by the COMPAT_30 code


To generate a diff of this commit:
cvs rdiff -u -r1.291.2.5 -r1.291.2.6 src/sys/kern/syscalls.master

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [pgoyette-compat] src/sys/kern

2018-03-25 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sun Mar 25 08:46:15 UTC 2018

Modified Files:
src/sys/kern [pgoyette-compat]: syscalls.c

Log Message:
Missed this in the regen


To generate a diff of this commit:
cvs rdiff -u -r1.310.2.4 -r1.310.2.5 src/sys/kern/syscalls.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/syscalls.c
diff -u src/sys/kern/syscalls.c:1.310.2.4 src/sys/kern/syscalls.c:1.310.2.5
--- src/sys/kern/syscalls.c:1.310.2.4	Sat Mar 17 06:50:55 2018
+++ src/sys/kern/syscalls.c	Sun Mar 25 08:46:14 2018
@@ -1,14 +1,14 @@
-/* $NetBSD: syscalls.c,v 1.310.2.4 2018/03/17 06:50:55 pgoyette Exp $ */
+/* $NetBSD: syscalls.c,v 1.310.2.5 2018/03/25 08:46:14 pgoyette Exp $ */
 
 /*
  * System call names.
  *
  * DO NOT EDIT-- this file is automatically generated.
- * created from	NetBSD: syscalls.master,v 1.291.2.4 2018/03/17 06:49:57 pgoyette Exp
+ * created from	NetBSD: syscalls.master,v 1.291.2.5 2018/03/25 07:19:13 pgoyette Exp
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: syscalls.c,v 1.310.2.4 2018/03/17 06:50:55 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: syscalls.c,v 1.310.2.5 2018/03/25 08:46:14 pgoyette Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_modular.h"



CVS commit: [pgoyette-compat] src/sys/kern

2018-03-25 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sun Mar 25 08:46:15 UTC 2018

Modified Files:
src/sys/kern [pgoyette-compat]: syscalls.c

Log Message:
Missed this in the regen


To generate a diff of this commit:
cvs rdiff -u -r1.310.2.4 -r1.310.2.5 src/sys/kern/syscalls.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [pgoyette-compat] src/sys/kern

2018-03-25 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sun Mar 25 07:19:13 UTC 2018

Modified Files:
src/sys/kern [pgoyette-compat]: syscalls.master

Log Message:
Since we're including the sa sysscalls in the compat_60 module code (even
if they are all implemented as no-ops), mark the master syscall list
appropriately.  Otherwise we fail to load the module.


To generate a diff of this commit:
cvs rdiff -u -r1.291.2.4 -r1.291.2.5 src/sys/kern/syscalls.master

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/syscalls.master
diff -u src/sys/kern/syscalls.master:1.291.2.4 src/sys/kern/syscalls.master:1.291.2.5
--- src/sys/kern/syscalls.master:1.291.2.4	Sat Mar 17 06:49:57 2018
+++ src/sys/kern/syscalls.master	Sun Mar 25 07:19:13 2018
@@ -1,4 +1,4 @@
-	$NetBSD: syscalls.master,v 1.291.2.4 2018/03/17 06:49:57 pgoyette Exp $
+	$NetBSD: syscalls.master,v 1.291.2.5 2018/03/25 07:19:13 pgoyette Exp $
 
 ;	@(#)syscalls.master	8.2 (Berkeley) 1/13/94
 
@@ -656,13 +656,19 @@
 328	UNIMPL
 329	UNIMPL
 ; SA system calls.
-330	COMPAT_60 	{ int|sys||sa_register(void *newv, void **oldv, \
+330	COMPAT_60 MODULAR compat	\
+		 	{ int|sys||sa_register(void *newv, void **oldv, \
 int flags, ssize_t stackinfo_offset); }
-331	COMPAT_60 	{ int|sys||sa_stacks(int num, stack_t *stacks); }
-332	COMPAT_60 	{ int|sys||sa_enable(void); }
-333	COMPAT_60 	{ int|sys||sa_setconcurrency(int concurrency); }
-334	COMPAT_60 	{ int|sys||sa_yield(void); }
-335	COMPAT_60 	{ int|sys||sa_preempt(int sa_id); }
+331	COMPAT_60 MODULAR compat	\
+			{ int|sys||sa_stacks(int num, stack_t *stacks); }
+332	COMPAT_60 MODULAR compat	\
+			{ int|sys||sa_enable(void); }
+333	COMPAT_60 MODULAR compat	\
+			{ int|sys||sa_setconcurrency(int concurrency); }
+334	COMPAT_60 MODULAR compat	\
+			{ int|sys||sa_yield(void); }
+335	COMPAT_60 MODULAR compat	\
+			{ int|sys||sa_preempt(int sa_id); }
 336	OBSOL 		sys_sa_unblockyield
 ;
 ; Syscalls 337-339 are reserved for other scheduler activation syscalls.



CVS commit: [pgoyette-compat] src/sys/kern

2018-03-25 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sun Mar 25 07:19:13 UTC 2018

Modified Files:
src/sys/kern [pgoyette-compat]: syscalls.master

Log Message:
Since we're including the sa sysscalls in the compat_60 module code (even
if they are all implemented as no-ops), mark the master syscall list
appropriately.  Otherwise we fail to load the module.


To generate a diff of this commit:
cvs rdiff -u -r1.291.2.4 -r1.291.2.5 src/sys/kern/syscalls.master

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



Re: CVS commit: [pgoyette-compat] src/sys/kern

2018-03-16 Thread Christos Zoulas
In article <20180317025636.7ee0df...@cvs.netbsd.org>,
Paul Goyette  wrote:
>-=-=-=-=-=-
>
>Module Name:   src
>Committed By:  pgoyette
>Date:  Sat Mar 17 02:56:36 UTC 2018
>
>Modified Files:
>   src/sys/kern [pgoyette-compat]: kern_cpu.c
>
>Log Message:
>Use two different compat stubs since they have different prototypes.

This is more of a mess now. There is no point exposing all these functions
and API's.

christos



CVS commit: [pgoyette-compat] src/sys/kern

2018-03-16 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sat Mar 17 02:56:36 UTC 2018

Modified Files:
src/sys/kern [pgoyette-compat]: kern_cpu.c

Log Message:
Use two different compat stubs since they have different prototypes.


To generate a diff of this commit:
cvs rdiff -u -r1.71.16.4 -r1.71.16.5 src/sys/kern/kern_cpu.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/kern_cpu.c
diff -u src/sys/kern/kern_cpu.c:1.71.16.4 src/sys/kern/kern_cpu.c:1.71.16.5
--- src/sys/kern/kern_cpu.c:1.71.16.4	Sat Mar 17 00:58:01 2018
+++ src/sys/kern/kern_cpu.c	Sat Mar 17 02:56:36 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_cpu.c,v 1.71.16.4 2018/03/17 00:58:01 pgoyette Exp $	*/
+/*	$NetBSD: kern_cpu.c,v 1.71.16.5 2018/03/17 02:56:36 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2007, 2008, 2009, 2010, 2012 The NetBSD Foundation, Inc.
@@ -56,7 +56,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_cpu.c,v 1.71.16.4 2018/03/17 00:58:01 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_cpu.c,v 1.71.16.5 2018/03/17 02:56:36 pgoyette Exp $");
 
 #include "opt_cpu_ucode.h"
 #include "opt_compat_netbsd.h"
@@ -135,15 +135,21 @@ static char cpu_model[128];
 /*
  * routine vectors for compat code
  */
-static int stub_compat_6_cpu_ucode(const struct compat6_cpu_ucode *ucode)
+static int stub_compat_6_cpu_ucode_get_version(struct compat6_cpu_ucode *ucode)
+{
+
+	return ENOTTY;
+}
+
+static int stub_compat_6_cpu_ucode_apply(const struct compat6_cpu_ucode *ucode)
 {
 
 	return ENOTTY;
 }
 int (*vec_compat6_cpu_ucode_get_version)(struct compat6_cpu_ucode *) =
-stub_compat_6_cpu_ucode;
+stub_compat_6_cpu_ucode_get_version;
 int (*vec_compat6_cpu_ucode_apply)(const struct compat6_cpu_ucode *) =
-stub_compat_6_cpu_ucode;
+stub_compat_6_cpu_ucode_apply;
 #endif
 
 /*



CVS commit: [pgoyette-compat] src/sys/kern

2018-03-16 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sat Mar 17 02:56:36 UTC 2018

Modified Files:
src/sys/kern [pgoyette-compat]: kern_cpu.c

Log Message:
Use two different compat stubs since they have different prototypes.


To generate a diff of this commit:
cvs rdiff -u -r1.71.16.4 -r1.71.16.5 src/sys/kern/kern_cpu.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [pgoyette-compat] src/sys/kern

2018-03-16 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sat Mar 17 00:58:01 UTC 2018

Modified Files:
src/sys/kern [pgoyette-compat]: kern_cpu.c

Log Message:
Typo - add missing (


To generate a diff of this commit:
cvs rdiff -u -r1.71.16.3 -r1.71.16.4 src/sys/kern/kern_cpu.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/kern_cpu.c
diff -u src/sys/kern/kern_cpu.c:1.71.16.3 src/sys/kern/kern_cpu.c:1.71.16.4
--- src/sys/kern/kern_cpu.c:1.71.16.3	Sat Mar 17 00:42:31 2018
+++ src/sys/kern/kern_cpu.c	Sat Mar 17 00:58:01 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_cpu.c,v 1.71.16.3 2018/03/17 00:42:31 pgoyette Exp $	*/
+/*	$NetBSD: kern_cpu.c,v 1.71.16.4 2018/03/17 00:58:01 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2007, 2008, 2009, 2010, 2012 The NetBSD Foundation, Inc.
@@ -56,7 +56,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_cpu.c,v 1.71.16.3 2018/03/17 00:42:31 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_cpu.c,v 1.71.16.4 2018/03/17 00:58:01 pgoyette Exp $");
 
 #include "opt_cpu_ucode.h"
 #include "opt_compat_netbsd.h"
@@ -320,7 +320,7 @@ cpuctl_ioctl(dev_t dev, u_long cmd, void
 		NULL, NULL, NULL, NULL);
 		if (error != 0)
 			break;
-		error = (*vec_compat6_cpu_ucode_apply)
+		error = (*vec_compat6_cpu_ucode_apply)(
 		(const struct compat6_cpu_ucode *)data);
 		break;
 #endif



CVS commit: [pgoyette-compat] src/sys/kern

2018-03-16 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sat Mar 17 00:58:01 UTC 2018

Modified Files:
src/sys/kern [pgoyette-compat]: kern_cpu.c

Log Message:
Typo - add missing (


To generate a diff of this commit:
cvs rdiff -u -r1.71.16.3 -r1.71.16.4 src/sys/kern/kern_cpu.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [pgoyette-compat] src/sys/kern

2018-03-16 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sat Mar 17 00:42:31 UTC 2018

Modified Files:
src/sys/kern [pgoyette-compat]: kern_cpu.c

Log Message:
Typos - add missing )'s


To generate a diff of this commit:
cvs rdiff -u -r1.71.16.2 -r1.71.16.3 src/sys/kern/kern_cpu.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/kern_cpu.c
diff -u src/sys/kern/kern_cpu.c:1.71.16.2 src/sys/kern/kern_cpu.c:1.71.16.3
--- src/sys/kern/kern_cpu.c:1.71.16.2	Fri Mar 16 08:10:27 2018
+++ src/sys/kern/kern_cpu.c	Sat Mar 17 00:42:31 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_cpu.c,v 1.71.16.2 2018/03/16 08:10:27 pgoyette Exp $	*/
+/*	$NetBSD: kern_cpu.c,v 1.71.16.3 2018/03/17 00:42:31 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2007, 2008, 2009, 2010, 2012 The NetBSD Foundation, Inc.
@@ -56,7 +56,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_cpu.c,v 1.71.16.2 2018/03/16 08:10:27 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_cpu.c,v 1.71.16.3 2018/03/17 00:42:31 pgoyette Exp $");
 
 #include "opt_cpu_ucode.h"
 #include "opt_compat_netbsd.h"
@@ -142,7 +142,7 @@ static int stub_compat_6_cpu_ucode(const
 }
 int (*vec_compat6_cpu_ucode_get_version)(struct compat6_cpu_ucode *) =
 stub_compat_6_cpu_ucode;
-int (*vec_compat6_cpu_ucode_apply(const struct compat6_cpu_ucode *) =
+int (*vec_compat6_cpu_ucode_apply)(const struct compat6_cpu_ucode *) =
 stub_compat_6_cpu_ucode;
 #endif
 
@@ -320,7 +320,7 @@ cpuctl_ioctl(dev_t dev, u_long cmd, void
 		NULL, NULL, NULL, NULL);
 		if (error != 0)
 			break;
-		error = (*vec_compat6_cpu_ucode_apply(
+		error = (*vec_compat6_cpu_ucode_apply)
 		(const struct compat6_cpu_ucode *)data);
 		break;
 #endif



CVS commit: [pgoyette-compat] src/sys/kern

2018-03-16 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sat Mar 17 00:42:31 UTC 2018

Modified Files:
src/sys/kern [pgoyette-compat]: kern_cpu.c

Log Message:
Typos - add missing )'s


To generate a diff of this commit:
cvs rdiff -u -r1.71.16.2 -r1.71.16.3 src/sys/kern/kern_cpu.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [pgoyette-compat] src/sys/kern

2018-03-15 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Fri Mar 16 00:35:40 UTC 2018

Modified Files:
src/sys/kern [pgoyette-compat]: syscalls.master

Log Message:
Revert changes for the scheduler-activation syscalls.  It's not
needed, as the syscalls are already marked ENOSYS if these sys-calls
are not built-in (ie, option COMPAT_60 is not specified;  if they
are built-in, the stubs in kern_sa_60.c still return ENOSYS, so no
change.


To generate a diff of this commit:
cvs rdiff -u -r1.291.2.2 -r1.291.2.3 src/sys/kern/syscalls.master

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [pgoyette-compat] src/sys/kern

2018-03-15 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Fri Mar 16 00:35:40 UTC 2018

Modified Files:
src/sys/kern [pgoyette-compat]: syscalls.master

Log Message:
Revert changes for the scheduler-activation syscalls.  It's not
needed, as the syscalls are already marked ENOSYS if these sys-calls
are not built-in (ie, option COMPAT_60 is not specified;  if they
are built-in, the stubs in kern_sa_60.c still return ENOSYS, so no
change.


To generate a diff of this commit:
cvs rdiff -u -r1.291.2.2 -r1.291.2.3 src/sys/kern/syscalls.master

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/syscalls.master
diff -u src/sys/kern/syscalls.master:1.291.2.2 src/sys/kern/syscalls.master:1.291.2.3
--- src/sys/kern/syscalls.master:1.291.2.2	Thu Mar 15 23:04:48 2018
+++ src/sys/kern/syscalls.master	Fri Mar 16 00:35:40 2018
@@ -1,4 +1,4 @@
-	$NetBSD: syscalls.master,v 1.291.2.2 2018/03/15 23:04:48 pgoyette Exp $
+	$NetBSD: syscalls.master,v 1.291.2.3 2018/03/16 00:35:40 pgoyette Exp $
 
 ;	@(#)syscalls.master	8.2 (Berkeley) 1/13/94
 
@@ -656,19 +656,13 @@
 328	UNIMPL
 329	UNIMPL
 ; SA system calls.
-330	COMPAT_60 MODULAR compat_60	\
-		 	{ int|sys||sa_register(void *newv, void **oldv, \
+330	COMPAT_60 	{ int|sys||sa_register(void *newv, void **oldv, \
 int flags, ssize_t stackinfo_offset); }
-331	COMPAT_60  MODULAR compat_60	\
-			{ int|sys||sa_stacks(int num, stack_t *stacks); }
-332	COMPAT_60  MODULAR compat_60	\
-			{ int|sys||sa_enable(void); }
-333	COMPAT_60  MODULAR compat_60	\
-			{ int|sys||sa_setconcurrency(int concurrency); }
-334	COMPAT_60  MODULAR compat_60	\
-			{ int|sys||sa_yield(void); }
-335	COMPAT_60  MODULAR compat_60	\
-			{ int|sys||sa_preempt(int sa_id); }
+331	COMPAT_60 	{ int|sys||sa_stacks(int num, stack_t *stacks); }
+332	COMPAT_60 	{ int|sys||sa_enable(void); }
+333	COMPAT_60 	{ int|sys||sa_setconcurrency(int concurrency); }
+334	COMPAT_60 	{ int|sys||sa_yield(void); }
+335	COMPAT_60 	{ int|sys||sa_preempt(int sa_id); }
 336	OBSOL 		sys_sa_unblockyield
 ;
 ; Syscalls 337-339 are reserved for other scheduler activation syscalls.



CVS commit: [pgoyette-compat] src/sys/kern

2018-03-15 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Thu Mar 15 23:04:48 UTC 2018

Modified Files:
src/sys/kern [pgoyette-compat]: syscalls.master

Log Message:
Update the compat_60 entries to reference the compat_60 module.

While here, allow the scheduler-activation syscalls to autoload the
compat_60 module.


To generate a diff of this commit:
cvs rdiff -u -r1.291.2.1 -r1.291.2.2 src/sys/kern/syscalls.master

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [pgoyette-compat] src/sys/kern

2018-03-15 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Thu Mar 15 23:04:48 UTC 2018

Modified Files:
src/sys/kern [pgoyette-compat]: syscalls.master

Log Message:
Update the compat_60 entries to reference the compat_60 module.

While here, allow the scheduler-activation syscalls to autoload the
compat_60 module.


To generate a diff of this commit:
cvs rdiff -u -r1.291.2.1 -r1.291.2.2 src/sys/kern/syscalls.master

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/syscalls.master
diff -u src/sys/kern/syscalls.master:1.291.2.1 src/sys/kern/syscalls.master:1.291.2.2
--- src/sys/kern/syscalls.master:1.291.2.1	Sat Mar 10 05:09:24 2018
+++ src/sys/kern/syscalls.master	Thu Mar 15 23:04:48 2018
@@ -1,4 +1,4 @@
-	$NetBSD: syscalls.master,v 1.291.2.1 2018/03/10 05:09:24 pgoyette Exp $
+	$NetBSD: syscalls.master,v 1.291.2.2 2018/03/15 23:04:48 pgoyette Exp $
 
 ;	@(#)syscalls.master	8.2 (Berkeley) 1/13/94
 
@@ -656,13 +656,19 @@
 328	UNIMPL
 329	UNIMPL
 ; SA system calls.
-330	COMPAT_60 	{ int|sys||sa_register(void *newv, void **oldv, \
+330	COMPAT_60 MODULAR compat_60	\
+		 	{ int|sys||sa_register(void *newv, void **oldv, \
 int flags, ssize_t stackinfo_offset); }
-331	COMPAT_60 	{ int|sys||sa_stacks(int num, stack_t *stacks); }
-332	COMPAT_60 	{ int|sys||sa_enable(void); }
-333	COMPAT_60 	{ int|sys||sa_setconcurrency(int concurrency); }
-334	COMPAT_60 	{ int|sys||sa_yield(void); }
-335	COMPAT_60 	{ int|sys||sa_preempt(int sa_id); }
+331	COMPAT_60  MODULAR compat_60	\
+			{ int|sys||sa_stacks(int num, stack_t *stacks); }
+332	COMPAT_60  MODULAR compat_60	\
+			{ int|sys||sa_enable(void); }
+333	COMPAT_60  MODULAR compat_60	\
+			{ int|sys||sa_setconcurrency(int concurrency); }
+334	COMPAT_60  MODULAR compat_60	\
+			{ int|sys||sa_yield(void); }
+335	COMPAT_60  MODULAR compat_60	\
+			{ int|sys||sa_preempt(int sa_id); }
 336	OBSOL 		sys_sa_unblockyield
 ;
 ; Syscalls 337-339 are reserved for other scheduler activation syscalls.
@@ -878,7 +884,7 @@
 		{ ssize_t|sys|50|mq_timedreceive(mqd_t mqdes, \
 			char *msg_ptr, size_t msg_len, unsigned *msg_prio, \
 			const struct timespec *abs_timeout); }
-434	COMPAT_60 MODULAR compat \
+434	COMPAT_60 MODULAR compat_60 \
 		{ int|sys||_lwp_park(const struct timespec *ts, \
 lwpid_t unpark, const void *hint, \
 const void *unparkhint); }



CVS commit: [pgoyette-compat] src/sys/kern

2018-03-11 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sun Mar 11 11:47:45 UTC 2018

Modified Files:
src/sys/kern [pgoyette-compat]: kern_module.c

Log Message:
Clean up the EXIST paths (module and/or alias already exists) and make
sure we always return a pointer to the duplicate.


To generate a diff of this commit:
cvs rdiff -u -r1.130.2.3 -r1.130.2.4 src/sys/kern/kern_module.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/kern_module.c
diff -u src/sys/kern/kern_module.c:1.130.2.3 src/sys/kern/kern_module.c:1.130.2.4
--- src/sys/kern/kern_module.c:1.130.2.3	Sun Mar 11 08:32:21 2018
+++ src/sys/kern/kern_module.c	Sun Mar 11 11:47:45 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_module.c,v 1.130.2.3 2018/03/11 08:32:21 pgoyette Exp $	*/
+/*	$NetBSD: kern_module.c,v 1.130.2.4 2018/03/11 11:47:45 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_module.c,v 1.130.2.3 2018/03/11 08:32:21 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_module.c,v 1.130.2.4 2018/03/11 11:47:45 pgoyette Exp $");
 
 #define _MODULE_INTERNAL
 
@@ -671,9 +671,10 @@ module_alias_lookup(const char *name, mo
 	aliasp = *mod->mod_info->mi_aliases;
 	if (aliasp == NULL)
 		return 0;
-	while (*aliasp)
+	while (*aliasp) {
 		if (strcmp(*aliasp++, name) == 0)
 			return 1;
+	}
 	return 0;
 }
 
@@ -690,11 +691,10 @@ module_lookup(const char *name)
 	KASSERT(kernconfig_is_held());
 
 	TAILQ_FOREACH(mod, _list, mod_chain) {
-		if (strcmp(mod->mod_info->mi_name, name) == 0) {
+		if (strcmp(mod->mod_info->mi_name, name) == 0)
 			break;
 		if (module_alias_lookup(name, mod))
 			break;
-		}
 	}
 
 	return mod;
@@ -855,13 +855,17 @@ module_do_builtin(const module_t *pmod, 
 	}
 
 	/*
-	 * Retrieve that none of the module's aliases already exist
+	 * Confirm that none of the module's aliases already exist
 	 */
 
 	if ((aliasp = *mod->mod_info->mi_aliases) != NULL) {
-		while (*aliasp)
-			if (module_lookup(*aliasp++) != NULL)
+		while (*aliasp) {
+			if ((mod2 = module_lookup(*aliasp++)) != NULL) {
+if (modp != NULL)
+	*modp = mod2;
 return EEXIST;
+			}
+		}
 	}
 	/*
 	 * Try to initialize the module.
@@ -1084,6 +1088,8 @@ module_do_load(const char *name, bool is
 			module_error("module with name `%s' already loaded",
 			mod2->mod_info->mi_name);
 			error = EEXIST;
+			if (modp != NULL)
+*modp = mod2;
 			goto fail;
 		}
 	}
@@ -1171,13 +1177,19 @@ module_do_load(const char *name, bool is
 	/*
 	 * One last check for duplicate module name/alias
 	 */
-	if ((aliasp = *mod->mod_info->mi_aliases) != NULL)
-		while (*aliasp != NULL)
-			if (module_lookup(*aliasp) != NULL) {
+	if ((aliasp = *mod->mod_info->mi_aliases) != NULL) {
+		while (*aliasp != NULL) {
+			if ((mod2 = module_lookup(*aliasp)) != NULL) {
 module_error("Module `%s' alias `%s' already "
 "exists", mod->mod_info->mi_name, *aliasp);
+error = EEXIST;
+if (modp != NULL)
+	*modp = mod2;
 goto fail;
 			}
+			aliasp++;
+		}
+	}
 
 	prev_active = module_active;
 	module_active = mod;



CVS commit: [pgoyette-compat] src/sys/kern

2018-03-11 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sun Mar 11 11:47:45 UTC 2018

Modified Files:
src/sys/kern [pgoyette-compat]: kern_module.c

Log Message:
Clean up the EXIST paths (module and/or alias already exists) and make
sure we always return a pointer to the duplicate.


To generate a diff of this commit:
cvs rdiff -u -r1.130.2.3 -r1.130.2.4 src/sys/kern/kern_module.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [pgoyette-compat] src/sys/kern

2018-03-11 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sun Mar 11 08:32:21 UTC 2018

Modified Files:
src/sys/kern [pgoyette-compat]: kern_module.c sys_module.c

Log Message:
Since we use pointer semantics when walking the alias lists, declare
the pointer variable accordingly.


To generate a diff of this commit:
cvs rdiff -u -r1.130.2.2 -r1.130.2.3 src/sys/kern/kern_module.c
cvs rdiff -u -r1.23.2.2 -r1.23.2.3 src/sys/kern/sys_module.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/kern_module.c
diff -u src/sys/kern/kern_module.c:1.130.2.2 src/sys/kern/kern_module.c:1.130.2.3
--- src/sys/kern/kern_module.c:1.130.2.2	Sun Mar 11 07:25:59 2018
+++ src/sys/kern/kern_module.c	Sun Mar 11 08:32:21 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_module.c,v 1.130.2.2 2018/03/11 07:25:59 pgoyette Exp $	*/
+/*	$NetBSD: kern_module.c,v 1.130.2.3 2018/03/11 08:32:21 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_module.c,v 1.130.2.2 2018/03/11 07:25:59 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_module.c,v 1.130.2.3 2018/03/11 08:32:21 pgoyette Exp $");
 
 #define _MODULE_INTERNAL
 
@@ -666,7 +666,7 @@ module_unload(const char *name)
 int
 module_alias_lookup(const char *name, module_t *mod)
 {
-	const char * const	aliasp[];
+	const char * const *aliasp;
 
 	aliasp = *mod->mod_info->mi_aliases;
 	if (aliasp == NULL)
@@ -784,7 +784,7 @@ module_do_builtin(const module_t *pmod, 
 prop_dictionary_t props)
 {
 	const char *p, *s;
-	const char * const	aliasp[];
+	const char * const *aliasp;
 	char buf[MAXMODNAME];
 	modinfo_t *mi = NULL;
 	module_t *mod, *mod2, *mod_loaded, *prev_active;
@@ -910,7 +910,7 @@ module_do_load(const char *name, bool is
 	prop_dictionary_t filedict;
 	char buf[MAXMODNAME];
 	const char *s, *p;
-	const char * const aliasp[];
+	const char * const *aliasp;
 	int error;
 	size_t len;
 

Index: src/sys/kern/sys_module.c
diff -u src/sys/kern/sys_module.c:1.23.2.2 src/sys/kern/sys_module.c:1.23.2.3
--- src/sys/kern/sys_module.c:1.23.2.2	Sun Mar 11 07:25:59 2018
+++ src/sys/kern/sys_module.c	Sun Mar 11 08:32:21 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: sys_module.c,v 1.23.2.2 2018/03/11 07:25:59 pgoyette Exp $	*/
+/*	$NetBSD: sys_module.c,v 1.23.2.3 2018/03/11 08:32:21 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sys_module.c,v 1.23.2.2 2018/03/11 07:25:59 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_module.c,v 1.23.2.3 2018/03/11 08:32:21 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_modular.h"
@@ -122,7 +122,7 @@ handle_modctl_stat(struct iovec *iov, vo
 	int error;
 	int mscnt;
 	bool stataddr;
-	const char * const aliasp[];
+	const char * const *aliasp;
 
 	/* If not privileged, don't expose kernel addresses. */
 	error = kauth_authorize_system(kauth_cred_get(), KAUTH_SYSTEM_MODULE,



CVS commit: [pgoyette-compat] src/sys/kern

2018-03-11 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sun Mar 11 08:32:21 UTC 2018

Modified Files:
src/sys/kern [pgoyette-compat]: kern_module.c sys_module.c

Log Message:
Since we use pointer semantics when walking the alias lists, declare
the pointer variable accordingly.


To generate a diff of this commit:
cvs rdiff -u -r1.130.2.2 -r1.130.2.3 src/sys/kern/kern_module.c
cvs rdiff -u -r1.23.2.2 -r1.23.2.3 src/sys/kern/sys_module.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [pgoyette-compat] src/sys/kern

2018-03-09 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sat Mar 10 05:09:24 UTC 2018

Modified Files:
src/sys/kern [pgoyette-compat]: syscalls.master

Log Message:
Update module name for sysv_ipc compat syscalls.


To generate a diff of this commit:
cvs rdiff -u -r1.291 -r1.291.2.1 src/sys/kern/syscalls.master

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/syscalls.master
diff -u src/sys/kern/syscalls.master:1.291 src/sys/kern/syscalls.master:1.291.2.1
--- src/sys/kern/syscalls.master:1.291	Sat Jan  6 16:41:23 2018
+++ src/sys/kern/syscalls.master	Sat Mar 10 05:09:24 2018
@@ -1,4 +1,4 @@
-	$NetBSD: syscalls.master,v 1.291 2018/01/06 16:41:23 kamil Exp $
+	$NetBSD: syscalls.master,v 1.291.2.1 2018/03/10 05:09:24 pgoyette Exp $
 
 ;	@(#)syscalls.master	8.2 (Berkeley) 1/13/94
 
@@ -353,7 +353,7 @@
 168	UNIMPL
 ; XXX more generally, never on machines where sizeof(void *) != sizeof(int)
 #if !defined(_LP64)
-169	COMPAT_10 MODULAR sysv_ipc	\
+169	COMPAT_10 MODULAR compat_sysv	\
 		{ int|sys||semsys(int which, int a2, int a3, int a4, \
 			int a5); } osemsys
 #else
@@ -361,7 +361,7 @@
 #endif
 ; XXX more generally, never on machines where sizeof(void *) != sizeof(int)
 #if !defined(_LP64)
-170	COMPAT_10 MODULAR sysv_ipc	\
+170	COMPAT_10 MODULAR compat_sysv	\
 		{ int|sys||msgsys(int which, int a2, int a3, int a4, \
 			int a5, int a6); } omsgsys
 #else
@@ -369,7 +369,7 @@
 #endif
 ; XXX more generally, never on machines where sizeof(void *) != sizeof(int)
 #if !defined(_LP64)
-171	COMPAT_10 MODULAR sysv_ipc	\
+171	COMPAT_10 MODULAR compat_sysv	\
 		{ int|sys||shmsys(int which, int a2, int a3, int a4); } \
 			oshmsys
 #else
@@ -455,7 +455,7 @@
 218	UNIMPL
 219	UNIMPL
 ; System calls 220-300 are reserved for use by NetBSD
-220	COMPAT_14 MODULAR sysv_ipc	\
+220	COMPAT_14 MODULAR compat_sysv	\
 		{ int|sys||__semctl(int semid, int semnum, int cmd, \
 			union __semun *arg); }
 221	STD MODULAR sysv_ipc { int|sys||semget(key_t key, int nsems, \
@@ -463,7 +463,7 @@
 222	STD MODULAR sysv_ipc { int|sys||semop(int semid, struct sembuf *sops, \
 			size_t nsops); }
 223	STD MODULAR sysv_ipc { int|sys||semconfig(int flag); }
-224	COMPAT_14 MODULAR sysv_ipc { int|sys||msgctl(int msqid, int cmd, \
+224	COMPAT_14 MODULAR compat_sysv { int|sys||msgctl(int msqid, int cmd, \
 			struct msqid_ds14 *buf); }
 225	STD MODULAR sysv_ipc { int|sys||msgget(key_t key, int msgflg); }
 226	STD MODULAR sysv_ipc { int|sys||msgsnd(int msqid, const void *msgp, \
@@ -472,7 +472,7 @@
 			size_t msgsz, long msgtyp, int msgflg); }
 228	STD MODULAR sysv_ipc { void *|sys||shmat(int shmid,	\
 			const void *shmaddr, int shmflg); }
-229	COMPAT_14 MODULAR sysv_ipc { int|sys||shmctl(int shmid, int cmd, \
+229	COMPAT_14 MODULAR compat_sysv { int|sys||shmctl(int shmid, int cmd, \
 			struct shmid_ds14 *buf); }
 230	STD MODULAR sysv_ipc { int|sys||shmdt(const void *shmaddr); }
 231	STD MODULAR sysv_ipc { int|sys||shmget(key_t key, size_t size,	\
@@ -611,12 +611,12 @@
 300	COMPAT_20 MODULAR compat	\
 		{ int|sys||fhstatfs(const struct compat_30_fhandle *fhp, \
 			struct statfs12 *buf); }
-301	COMPAT_50 MODULAR sysv_ipc	\
+301	COMPAT_50 MODULAR compat_sysv	\
 		{ int|sys|13|__semctl(int semid, int semnum, int cmd, \
 			... union __semun *arg); }
-302	COMPAT_50 MODULAR sysv_ipc { int|sys|13|msgctl(int msqid, int cmd, \
+302	COMPAT_50 MODULAR compat_sysv { int|sys|13|msgctl(int msqid, int cmd, \
 			struct msqid_ds *buf); }
-303	COMPAT_50 MODULAR sysv_ipc { int|sys|13|shmctl(int shmid, int cmd, \
+303	COMPAT_50 MODULAR compat_sysv { int|sys|13|shmctl(int shmid, int cmd, \
 			struct shmid_ds13 *buf); }
 304	STD 	 RUMP	{ int|sys||lchflags(const char *path, u_long flags); }
 305	NOERR 	RUMP	{ int|sys||issetugid(void); }



CVS commit: [pgoyette-compat] src/sys/kern

2018-03-09 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sat Mar 10 05:09:24 UTC 2018

Modified Files:
src/sys/kern [pgoyette-compat]: syscalls.master

Log Message:
Update module name for sysv_ipc compat syscalls.


To generate a diff of this commit:
cvs rdiff -u -r1.291 -r1.291.2.1 src/sys/kern/syscalls.master

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [pgoyette-compat] src/sys/kern

2018-03-09 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sat Mar 10 03:33:27 UTC 2018

Modified Files:
src/sys/kern [pgoyette-compat]: kern_stub.c

Log Message:
Revert changes from rev 1.44

Now that the kernel compat library is no longer being built and
included as a .o file, the original build-break has gone.

Note that reverting 1.44 will also un-break the autoloading of
the sysv_ipc module.


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.44.2.1 src/sys/kern/kern_stub.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/kern_stub.c
diff -u src/sys/kern/kern_stub.c:1.44 src/sys/kern/kern_stub.c:1.44.2.1
--- src/sys/kern/kern_stub.c:1.44	Sat Dec 16 18:42:22 2017
+++ src/sys/kern/kern_stub.c	Sat Mar 10 03:33:27 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_stub.c,v 1.44 2017/12/16 18:42:22 christos Exp $	*/
+/*	$NetBSD: kern_stub.c,v 1.44.2.1 2018/03/10 03:33:27 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_stub.c,v 1.44 2017/12/16 18:42:22 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_stub.c,v 1.44.2.1 2018/03/10 03:33:27 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ktrace.h"
@@ -87,19 +87,6 @@ bool default_bus_space_handle_is_equal(b
 bus_space_handle_t);
 
 /*
- * SYSV Semaphores, Shared Memory, Message Queues
- */
-#ifndef SYSVMSG
-__strong_alias(msgctl1,enosys);
-#endif
-#ifndef SYSVSHM
-__strong_alias(shmctl1,enosys);
-#endif
-#ifndef SYSVSEM
-__strong_alias(semctl1,enosys);
-#endif
-
-/*
  * ktrace stubs.  ktruser() goes to enosys as we want to fail the syscall,
  * but not kill the process: utrace() is a debugging feature.
  */



CVS commit: [pgoyette-compat] src/sys/kern

2018-03-09 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sat Mar 10 03:33:27 UTC 2018

Modified Files:
src/sys/kern [pgoyette-compat]: kern_stub.c

Log Message:
Revert changes from rev 1.44

Now that the kernel compat library is no longer being built and
included as a .o file, the original build-break has gone.

Note that reverting 1.44 will also un-break the autoloading of
the sysv_ipc module.


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.44.2.1 src/sys/kern/kern_stub.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [pgoyette-compat] src/sys/kern

2018-03-06 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Tue Mar  6 09:43:06 UTC 2018

Modified Files:
src/sys/kern [pgoyette-compat]: files.kern

Log Message:
Routine emulexec() in kern_exec.c needs emul_find_root().  Since
kern_exec.c is included in every kernel, so compat_util.c needs to
be included, too.


To generate a diff of this commit:
cvs rdiff -u -r1.16.2.1 -r1.16.2.2 src/sys/kern/files.kern

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [pgoyette-compat] src/sys/kern

2018-03-06 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Tue Mar  6 09:43:06 UTC 2018

Modified Files:
src/sys/kern [pgoyette-compat]: files.kern

Log Message:
Routine emulexec() in kern_exec.c needs emul_find_root().  Since
kern_exec.c is included in every kernel, so compat_util.c needs to
be included, too.


To generate a diff of this commit:
cvs rdiff -u -r1.16.2.1 -r1.16.2.2 src/sys/kern/files.kern

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/files.kern
diff -u src/sys/kern/files.kern:1.16.2.1 src/sys/kern/files.kern:1.16.2.2
--- src/sys/kern/files.kern:1.16.2.1	Tue Mar  6 05:44:37 2018
+++ src/sys/kern/files.kern	Tue Mar  6 09:43:06 2018
@@ -1,11 +1,11 @@
-#	$NetBSD: files.kern,v 1.16.2.1 2018/03/06 05:44:37 pgoyette Exp $
+#	$NetBSD: files.kern,v 1.16.2.2 2018/03/06 09:43:06 pgoyette Exp $
 
 #
 # kernel sources
 #
 define	kern:	machdep, uvm
 defflag	opt_kern.h			KERN
-#file	compat/common/compat_util.c	kern
+file	compat/common/compat_util.c	kern
 file	conf/debugsyms.c		kern
 file	conf/param.c			kern
 file	kern/bufq_disksort.c		bufq_disksort



CVS commit: [pgoyette-compat] src/sys/kern

2018-03-05 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Tue Mar  6 05:44:37 UTC 2018

Modified Files:
src/sys/kern [pgoyette-compat]: files.kern

Log Message:
Don't include the compat_mod.c here


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.16.2.1 src/sys/kern/files.kern

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [pgoyette-compat] src/sys/kern

2018-03-05 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Tue Mar  6 05:44:37 UTC 2018

Modified Files:
src/sys/kern [pgoyette-compat]: files.kern

Log Message:
Don't include the compat_mod.c here


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.16.2.1 src/sys/kern/files.kern

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/files.kern
diff -u src/sys/kern/files.kern:1.16 src/sys/kern/files.kern:1.16.2.1
--- src/sys/kern/files.kern:1.16	Sat Dec 16 10:15:12 2017
+++ src/sys/kern/files.kern	Tue Mar  6 05:44:37 2018
@@ -1,12 +1,11 @@
-#	$NetBSD: files.kern,v 1.16 2017/12/16 10:15:12 maxv Exp $
+#	$NetBSD: files.kern,v 1.16.2.1 2018/03/06 05:44:37 pgoyette Exp $
 
 #
 # kernel sources
 #
 define	kern:	machdep, uvm
 defflag	opt_kern.h			KERN
-file	compat/common/compat_util.c	kern
-file	compat/common/compat_mod.c	compat_netbsd | compat_netbsd32
+#file	compat/common/compat_util.c	kern
 file	conf/debugsyms.c		kern
 file	conf/param.c			kern
 file	kern/bufq_disksort.c		bufq_disksort