diff options
| author | Christos Margiolis <christos@FreeBSD.org> | 2025-11-11 12:07:40 +0000 |
|---|---|---|
| committer | Christos Margiolis <christos@FreeBSD.org> | 2025-11-11 12:07:40 +0000 |
| commit | 7bedc4634d893174b9cef06c7c13e5f1cb24808b (patch) | |
| tree | 7519b86b744259aef85d642a7c82a11906bb762c | |
| parent | ac2aa9e869a16b28095364b2e14683df9885ac34 (diff) | |
virtual_oss(8): Use kldload(2) instead of system(3)
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Reviewed by: imp, markj, emaste
Differential Revision: https://reviews.freebsd.org/D53617
| -rw-r--r-- | usr.sbin/virtual_oss/virtual_oss/main.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/usr.sbin/virtual_oss/virtual_oss/main.c b/usr.sbin/virtual_oss/virtual_oss/main.c index afa4ad0727ca..f2fd085664ed 100644 --- a/usr.sbin/virtual_oss/virtual_oss/main.c +++ b/usr.sbin/virtual_oss/virtual_oss/main.c @@ -26,12 +26,14 @@ #include <sys/queue.h> #include <sys/types.h> #include <sys/filio.h> +#include <sys/linker.h> #include <sys/rtprio.h> #include <sys/nv.h> #include <sys/sndstat.h> #include <sys/soundcard.h> #include <dlfcn.h> +#include <errno.h> #include <stdio.h> #include <stdint.h> #include <stdlib.h> @@ -2539,11 +2541,8 @@ main(int argc, char **argv) atomic_init(); - /* automagically load the cuse.ko module, if any */ - if (feature_present("cuse") == 0) { - if (system("kldload cuse") == -1) - warn("Failed to kldload cuse"); - } + if (kldload("cuse.ko") < 0 && errno != EEXIST) + err(1, "Failed to load cuse kernel module"); if (cuse_init() != 0) errx(EX_USAGE, "Could not connect to cuse module"); |
