aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWarner Losh <imp@FreeBSD.org>2021-07-08 19:53:18 +0000
committerWarner Losh <imp@FreeBSD.org>2021-07-08 21:22:22 +0000
commit5549c6a62f0f4fc5d7e80973b28ebcf7f556edf8 (patch)
tree8d56421e68d48541a30c24d054f6add0d0b24d2c
parentb29ebb9c65b350e78aedfc790bfcaf9717059b70 (diff)
downloadsrc-5549c6a62f0f4fc5d7e80973b28ebcf7f556edf8.tar.gz
src-5549c6a62f0f4fc5d7e80973b28ebcf7f556edf8.zip
devmatch: don't announce autoloading so much
devmatch rc script would announce it was loading a module multiple times. It used kldload -n so it really wasn't loading it that many times, but the message is confusing. Use kldstat to see if we need to load the module before saying we do. This fixes the vast majority of the problems. It may be possible to race devmatch with a user invocation and devd, though quite hard. In that case we'll announce things twice, but still only load it once. No attempt is made to fix this. PR: 232782 MFC After: 2 weeks Sponsored by: Netflix
-rwxr-xr-xlibexec/rc/rc.d/devmatch4
1 files changed, 2 insertions, 2 deletions
diff --git a/libexec/rc/rc.d/devmatch b/libexec/rc/rc.d/devmatch
index f7f677b968e7..f5b8e8e51071 100755
--- a/libexec/rc/rc.d/devmatch
+++ b/libexec/rc/rc.d/devmatch
@@ -71,8 +71,8 @@ devmatch_start()
case "${x}" in
*"#${m}#"*) continue ;;
esac
- echo "Autoloading module: ${m}"
- kldload -n ${m}
+ kldstat -q -n ${m} || \
+ (echo "Autoloading module: ${m}"; kldload -n ${m})
done
devctl thaw
}