Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/compat/common When using SYSCTL_SETUP there is no guaran...



details:   https://anonhg.NetBSD.org/src/rev/c4caf9737bf3
branches:  trunk
changeset: 970515:c4caf9737bf3
user:      pgoyette <pgoyette%NetBSD.org@localhost>
date:      Thu Mar 26 13:39:29 2020 +0000

description:
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.

diffstat:

 sys/compat/common/compat_sysctl_09_43.c |  15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)

diffs (36 lines):

diff -r 5bb4bbcfe456 -r c4caf9737bf3 sys/compat/common/compat_sysctl_09_43.c
--- a/sys/compat/common/compat_sysctl_09_43.c   Thu Mar 26 13:37:44 2020 +0000
+++ b/sys/compat/common/compat_sysctl_09_43.c   Thu Mar 26 13:39:29 2020 +0000
@@ -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 @@
        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"),



Home | Main Index | Thread Index | Old Index