-/* $OpenBSD: kern_sysctl.c,v 1.407 2022/11/05 19:29:46 cheloha Exp $ */
+/* $OpenBSD: kern_sysctl.c,v 1.408 2022/11/07 14:25:44 robert Exp $ */
/* $NetBSD: kern_sysctl.c,v 1.17 1996/05/20 17:49:05 mrg Exp $ */
/*-
extern int allowdt;
extern int audio_record_enable;
extern int video_record_enable;
+extern int autoconf_serial;
int allowkmem;
#ifdef PTRACE
{KERN_GLOBAL_PTRACE, &global_ptrace, 0, 1},
#endif
+ {KERN_AUTOCONF_SERIAL, &autoconf_serial, SYSCTL_INT_READONLY},
};
int
-/* $OpenBSD: subr_autoconf.c,v 1.96 2022/04/07 09:37:32 tb Exp $ */
+/* $OpenBSD: subr_autoconf.c,v 1.97 2022/11/07 14:25:44 robert Exp $ */
/* $NetBSD: subr_autoconf.c,v 1.21 1996/04/04 06:06:18 cgd Exp $ */
/*
*/
int autoconf_attdet;
+/*
+ * Versioned state of the devices tree so that changes can be detected.
+ */
+unsigned int autoconf_serial = 0;
+
/*
* Initialize autoconfiguration data structures. This occurs before console
* initialization as that might require use of this subsystem. Furthermore
mtx_enter(&autoconf_attdet_mtx);
if (--autoconf_attdet == 0)
wakeup(&autoconf_attdet);
+ autoconf_serial++;
mtx_leave(&autoconf_attdet_mtx);
return (dev);
}
mtx_enter(&autoconf_attdet_mtx);
if (++autoconf_attdet == 0)
wakeup(&autoconf_attdet);
+ autoconf_serial++;
mtx_leave(&autoconf_attdet_mtx);
return (rv);
}
-/* $OpenBSD: sysctl.h,v 1.230 2022/11/05 19:29:46 cheloha Exp $ */
+/* $OpenBSD: sysctl.h,v 1.231 2022/11/07 14:25:44 robert Exp $ */
/* $NetBSD: sysctl.h,v 1.16 1996/04/09 20:55:36 cgd Exp $ */
/*
#define KERN_UTC_OFFSET 88 /* int: adjust RTC time to UTC */
#define KERN_VIDEO 89 /* struct: video properties */
#define KERN_CLOCKINTR 90 /* node: clockintr */
-#define KERN_MAXID 91 /* number of valid kern ids */
+#define KERN_AUTOCONF_SERIAL 91 /* int: kernel device tree state serial */
+#define KERN_MAXID 92 /* number of valid kern ids */
#define CTL_KERN_NAMES { \
{ 0, 0 }, \
{ "utc_offset", CTLTYPE_INT }, \
{ "video", CTLTYPE_STRUCT }, \
{ "clockintr", CTLTYPE_NODE }, \
+ { "autoconf_serial", CTLTYPE_INT }, \
}
/*