Depending on kernel header and simply not passing the flags in
finit_module() if this header is not found is not good.
Add a missing.h header in which stuff like this should be added.
libkmod/libkmod.h \
libkmod/libkmod-private.h \
libkmod/macro.h \
+ libkmod/missing.h \
libkmod/libkmod.c \
libkmod/libkmod-list.c \
libkmod/libkmod-config.c \
if (kmod_file_get_direct(file)) {
unsigned int kernel_flags = 0;
-#ifdef HAVE_LINUX_MODULE_H
if (flags & KMOD_INSERT_FORCE_VERMAGIC)
kernel_flags |= MODULE_INIT_IGNORE_VERMAGIC;
if (flags & KMOD_INSERT_FORCE_MODVERSION)
kernel_flags |= MODULE_INIT_IGNORE_MODVERSIONS;
-#endif
err = finit_module(kmod_file_get_fd(file), args, kernel_flags);
if (err == 0 || errno != ENOSYS)
#include <syslog.h>
#include <limits.h>
+#include "missing.h"
#include "macro.h"
#include "libkmod.h"
--- /dev/null
+#pragma once
+
+#ifdef HAVE_LINUX_MODULE_H
+#include <linux/module.h>
+#endif
+
+#ifndef MODULE_INIT_IGNORE_MODVERSIONS
+# define MODULE_INIT_IGNORE_MODVERSIONS 1
+#endif
+
+#ifndef MODULE_INIT_IGNORE_VERMAGIC
+# define MODULE_INIT_IGNORE_VERMAGIC 2
+#endif