#include <stdio.h>
#include <errno.h>
#include <unistd.h>
-/* Kernel headers before 2.1.mumble need this on the Alpha to get
- _syscall* defined. */
-#define __LIBRARY__
#include <sys/syscall.h>
#include "libbb.h"
/* These syscalls are not included in very old glibc versions */
-#if ((__GLIBC__ <= 2) && (__GLIBC_MINOR__ < 1))
int delete_module(const char *name)
{
+#ifndef __NR_delete_module
+#warning This kernel does not support the delete_module syscall
+#warning -> The delete_module system call is being stubbed out...
+ errno=ENOSYS;
+ return -1;
+#else
return(syscall(__NR_delete_module, name));
+#endif
}
+
int get_kernel_syms(__ptr_t ks)
{
+#ifndef __NR_get_kernel_syms
+#warning This kernel does not support the get_kernel_syms syscall
+#warning -> The get_kernel_syms system call is being stubbed out...
+ errno=ENOSYS;
+ return -1;
+#else
return(syscall(__NR_get_kernel_syms, ks));
+#endif
}
/* This may have 5 arguments (for old 2.0 kernels) or 2 arguments
* and let the kernel cope with whatever it gets. Its good at that. */
int init_module(void *first, void *second, void *third, void *fourth, void *fifth)
{
+#ifndef __NR_init_module
+#warning This kernel does not support the init_module syscall
+#warning -> The init_module system call is being stubbed out...
+ errno=ENOSYS;
+ return -1;
+#else
return(syscall(__NR_init_module, first, second, third, fourth, fifth));
+#endif
}
int query_module(const char *name, int which, void *buf, size_t bufsize, size_t *ret)
/* Jump through hoops to fixup error return codes */
unsigned long create_module(const char *name, size_t size)
{
+#ifndef __NR_create_module
+#warning This kernel does not support the create_module syscall
+#warning -> The create_module system call is being stubbed out...
+ errno=ENOSYS;
+ return -1;
+#else
long ret = syscall(__NR_create_module, name, size);
if (ret == -1 && errno > 125) {
errno = 0;
}
return ret;
-}
-
#endif
+}
/* END CODE */