diff options
author | jkh <jkh@FreeBSD.org> | 2001-10-10 07:46:04 +0000 |
---|---|---|
committer | jkh <jkh@FreeBSD.org> | 2001-10-10 07:46:04 +0000 |
commit | 3ecc09960218d1a88e9cd4b7428a640ca3cef599 (patch) | |
tree | 6ab877c9dd9413268ce3b38a5c324c5ec5536c66 /lib/libdisk | |
parent | 2bf72ff243228d161d922b642e2d73f77d5e5fd1 (diff) | |
download | FreeBSD-src-3ecc09960218d1a88e9cd4b7428a640ca3cef599.zip FreeBSD-src-3ecc09960218d1a88e9cd4b7428a640ca3cef599.tar.gz |
Check to see if the devfs MIB exists and return 1 if it exists rather
than making device node(s).
Submitted by: Hiroo ONO <hiroo@oikumene.gcd.org>
Diffstat (limited to 'lib/libdisk')
-rw-r--r-- | lib/libdisk/create_chunk.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/libdisk/create_chunk.c b/lib/libdisk/create_chunk.c index 46a9807..f87fc1d 100644 --- a/lib/libdisk/create_chunk.c +++ b/lib/libdisk/create_chunk.c @@ -22,6 +22,7 @@ __FBSDID("$FreeBSD$"); #include <sys/diskslice.h> #include <sys/types.h> #include <sys/stat.h> +#include <sys/sysctl.h> #include <grp.h> #include <paths.h> #include <pwd.h> @@ -283,12 +284,20 @@ MakeDev(struct chunk *c1, const char *path) struct passwd *pwd; uid_t owner; gid_t group; + int mib[4]; + size_t miblen; *buf2 = '\0'; + miblen = sizeof(mib)/sizeof(mib[0]); if (isDebug()) msgDebug("MakeDev: Called with %s on path %s\n", p, path); if (!strcmp(p, "X")) return 0; + if (!sysctlnametomib("vfs.devfs.generation", &mib, &miblen)) { + if (isDebug()) + msgDebug("MakeDev: No need to mknod(2) with DEVFS.\n"); + return 1; + } if (!strncmp(p, "ad", 2)) cmaj = 116, p += 2; |