Kmod (SunOS): adds support

This commit is contained in:
李通洲 committed 2026-03-01 14:44:29 +08:00
1 parent 67ca907e38
commit 86458ab32a
2 files changed
+25 -1

No files matched your search

+24
View File
@@ -0,0 +1,24 @@
#include "common/kmod.h"
#include "common/stringUtils.h"
#include <sys/modctl.h>
#include <errno.h>
bool ffKmodLoaded(const char* modName)
{
struct modinfo modinfo = {
.mi_id = -1,
.mi_nextid = -1,
.mi_info = MI_INFO_ALL,
};
for (int id = -1; modctl(MODINFO, id, &modinfo) == 0; id = modinfo.mi_id)
{
modinfo.mi_name[MODMAXNAMELEN - 1] = '\0';
if (ffStrEquals(modinfo.mi_name, modName))
return true;
}
return !(errno == EINVAL || errno == ENOENT);
}