git: 7bedc4634d89 - main - virtual_oss(8): Use kldload(2) instead of system(3)
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 11 Nov 2025 12:08:27 UTC
The branch main has been updated by christos:
URL: https://cgit.FreeBSD.org/src/commit/?id=7bedc4634d893174b9cef06c7c13e5f1cb24808b
commit 7bedc4634d893174b9cef06c7c13e5f1cb24808b
Author: Christos Margiolis <christos@FreeBSD.org>
AuthorDate: 2025-11-11 12:07:40 +0000
Commit: Christos Margiolis <christos@FreeBSD.org>
CommitDate: 2025-11-11 12:07:40 +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
---
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");