git: 4804bb0d4588 - stable/15 - virtual_oss(8): Use kldload(2) instead of system(3)
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 18 Nov 2025 00:52:17 UTC
The branch stable/15 has been updated by christos:
URL: https://cgit.FreeBSD.org/src/commit/?id=4804bb0d4588d5e0a456b7009295c4e031aa7316
commit 4804bb0d4588d5e0a456b7009295c4e031aa7316
Author: Christos Margiolis <christos@FreeBSD.org>
AuthorDate: 2025-11-11 12:07:40 +0000
Commit: Christos Margiolis <christos@FreeBSD.org>
CommitDate: 2025-11-18 00:51:24 +0000
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
(cherry picked from commit 7bedc4634d893174b9cef06c7c13e5f1cb24808b)
---
usr.sbin/virtual_oss/virtual_oss/main.c | 9 ++++-----
1 file 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");