diff options
author | phk <phk@FreeBSD.org> | 2003-08-17 12:06:19 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2003-08-17 12:06:19 +0000 |
commit | ba5950210ceb7ef6fdee168811c8bed7f87fb095 (patch) | |
tree | eb57ac4ae044c7ed701ab8c7014376f24c5f26c7 /sys | |
parent | c4d0d668af1fb1796eb2f4cb6ce2a9347c60267c (diff) | |
download | FreeBSD-src-ba5950210ceb7ef6fdee168811c8bed7f87fb095.zip FreeBSD-src-ba5950210ceb7ef6fdee168811c8bed7f87fb095.tar.gz |
It is not an error to have no devices in the kernel: Return the
generation number and start it from one instead of zero.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/kern/subr_devstat.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/sys/kern/subr_devstat.c b/sys/kern/subr_devstat.c index f7a52ff..6a51745 100644 --- a/sys/kern/subr_devstat.c +++ b/sys/kern/subr_devstat.c @@ -45,7 +45,7 @@ __FBSDID("$FreeBSD$"); #include <machine/atomic.h> static int devstat_num_devs; -static long devstat_generation; +static long devstat_generation = 1; static int devstat_version = DEVSTAT_VERSION; static int devstat_current_devnumber; static struct mtx devstat_mutex; @@ -364,9 +364,6 @@ sysctl_devstat(SYSCTL_HANDLER_ARGS) mtx_assert(&devstat_mutex, MA_NOTOWNED); - if (devstat_num_devs == 0) - return(EINVAL); - /* * XXX devstat_generation should really be "volatile" but that * XXX freaks out the sysctl macro below. The places where we @@ -379,6 +376,9 @@ sysctl_devstat(SYSCTL_HANDLER_ARGS) error = SYSCTL_OUT(req, &mygen, sizeof(mygen)); + if (devstat_num_devs == 0) + return(0); + if (error != 0) return (error); |