Module Name:    src
Committed By:   pgoyette
Date:           Thu Mar 26 13:39:29 UTC 2020

Modified Files:
        src/sys/compat/common: compat_sysctl_09_43.c

Log Message:
When using SYSCTL_SETUP there is no guarantee of the order in which
the set-up functions will be called, so it is perfectly acceptable
for a compat code's routine to be called ahead of the code in other
parts of the kernel.

So make sure that the 2nd level sysctl node ``vfs.generic'' exists
before trying to add the 3rd level entries.

XXX Rather than creating the 2nd level node in two places, we could
XXX add the shared ``vfs.generic'' node to sysctl_init_base.c but
XXX this is left for another day.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/compat/common/compat_sysctl_09_43.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/compat/common/compat_sysctl_09_43.c
diff -u src/sys/compat/common/compat_sysctl_09_43.c:1.5 src/sys/compat/common/compat_sysctl_09_43.c:1.6
--- src/sys/compat/common/compat_sysctl_09_43.c:1.5	Thu Feb 27 17:42:33 2020
+++ src/sys/compat/common/compat_sysctl_09_43.c	Thu Mar 26 13:39:29 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat_sysctl_09_43.c,v 1.5 2020/02/27 17:42:33 pgoyette Exp $	*/
+/*	$NetBSD: compat_sysctl_09_43.c,v 1.6 2020/03/26 13:39:29 pgoyette Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: compat_sysctl_09_43.c,v 1.5 2020/02/27 17:42:33 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: compat_sysctl_09_43.c,v 1.6 2020/03/26 13:39:29 pgoyette Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -106,6 +106,17 @@ SYSCTL_SETUP(compat_sysctl_vfs, "Top-lev
 	int error;
 
 	error = sysctl_createv(clog, 0, NULL, NULL,
+			CTLFLAG_PERMANENT, 
+			CTLTYPE_NODE, "generic",
+			SYSCTL_DESCR("Non-specific vfs related information"),
+			NULL, 0, NULL, 0,
+			CTL_VFS, VFS_GENERIC, CTL_EOL);
+	if (error == EEXIST)
+		error = 0;
+	if (error != 0)
+		return;
+
+	error = sysctl_createv(clog, 0, NULL, NULL,
 		       CTLFLAG_PERMANENT|CTLFLAG_IMMEDIATE,
 		       CTLTYPE_INT, "maxtypenum",
 		       SYSCTL_DESCR("Highest valid filesystem type number"),

Reply via email to