mirror of
https://github.com/AuxXxilium/kmod.git
synced 2024-12-26 21:35:26 +07:00
5eac795b8b
At least in qemu 1.4.1 for vexpress/arm-cortexa9, this resulted in an illegal instruction error. Solve that by returning an error when __NR_finit_module is -1.
35 lines
604 B
C
35 lines
604 B
C
#pragma once
|
|
|
|
#include <unistd.h>
|
|
#include <sys/syscall.h>
|
|
|
|
#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
|
|
|
|
#ifndef __NR_finit_module
|
|
# define __NR_finit_module -1
|
|
#endif
|
|
|
|
#ifndef HAVE_FINIT_MODULE
|
|
#include <errno.h>
|
|
|
|
static inline int finit_module(int fd, const char *uargs, int flags)
|
|
{
|
|
if (__NR_finit_module == -1) {
|
|
errno = ENOSYS;
|
|
return -1;
|
|
}
|
|
|
|
return syscall(__NR_finit_module, fd, uargs, flags);
|
|
}
|
|
#endif
|