It is not an error to have no devices in the kernel: Return the

generation number and start it from one instead of zero.
This commit is contained in:
Poul-Henning Kamp 2003-08-17 12:06:19 +00:00
parent 96316581fc
commit 037c3d0fb0
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=119028

View File

@ -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);