Another iteration -- adjust the init_module syscall a bit.

-Erik
This commit is contained in:
Eric Andersen 2001-04-05 07:33:10 +00:00
parent acc7757312
commit 64c8b1762c
3 changed files with 29 additions and 43 deletions

View File

@ -62,6 +62,12 @@
#include <sys/utsname.h>
#include "busybox.h"
#ifdef BB_FEATURE_NEW_MODULE_INTERFACE
# define new_sys_init_module init_module
#else
# define old_sys_init_module init_module
#endif
#if defined(__powerpc__)
#define BB_USE_PLT_ENTRIES
#define BB_PLT_ENTRY_SIZE 16
@ -117,7 +123,7 @@
#ifndef MODUTILS_MODULE_H
static const int MODUTILS_MODULE_H = 1;
#ident "$Id: insmod.c,v 1.56 2001/04/05 06:24:27 andersen Exp $"
#ident "$Id: insmod.c,v 1.57 2001/04/05 07:33:10 andersen Exp $"
/* This file contains the structures used by the 2.0 and 2.1 kernels.
We do not use the kernel headers directly because we do not wish
@ -267,7 +273,7 @@ static const int NEW_MOD_AUTOCLEAN = 4;
static const int NEW_MOD_VISITED = 8;
static const int NEW_MOD_USED_ONCE = 16;
int init_module(const char *name, const struct new_module *);
int new_sys_init_module(const char *name, const struct new_module *);
int query_module(const char *name, int which, void *buf, size_t bufsize,
size_t *ret);
@ -323,7 +329,7 @@ int delete_module(const char *);
#ifndef MODUTILS_OBJ_H
static const int MODUTILS_OBJ_H = 1;
#ident "$Id: insmod.c,v 1.56 2001/04/05 06:24:27 andersen Exp $"
#ident "$Id: insmod.c,v 1.57 2001/04/05 07:33:10 andersen Exp $"
/* The relocatable object is manipulated using elfin types. */
@ -2515,7 +2521,7 @@ new_init_module(const char *m_name, struct obj_file *f,
image = xmalloc(m_size);
obj_create_image(f, image);
ret = init_module(m_name, (struct new_module *) image);
ret = new_sys_init_module(m_name, (struct new_module *) image);
if (ret)
perror_msg("init_module: %s", m_name);

View File

@ -32,43 +32,17 @@
#include "libbb.h"
struct old_module_ref
{
unsigned long module; /* kernel addresses */
unsigned long next;
};
struct old_module_symbol
{
unsigned long addr;
unsigned long name;
};
struct old_symbol_table
{
int size; /* total, including string table!!! */
int n_symbols;
int n_refs;
struct old_module_symbol symbol[0]; /* actual size defined by n_symbols */
struct old_module_ref ref[0]; /* actual size defined by n_refs */
};
struct old_mod_routines
{
unsigned long init;
unsigned long cleanup;
};
#define __NR_old_sys_init_module __NR_init_module
_syscall5(int, old_sys_init_module, const char *, name, char *, code,
unsigned, codesize, struct old_mod_routines *, routines,
struct old_symbol_table *, symtab);
#if __GNU_LIBRARY__ < 5
/* These syscalls are not included as part of libc5 */
_syscall1(int, delete_module, const char *, name);
_syscall1(int, get_kernel_syms, struct old_kernel_sym *, ks);
/* This may have 5 arguments (for old 2.0 kernels) or 2 arguments
* (for 2.2 and 2.4 kernels). Use the greatest common denominator,
* and let the kernel cope with whatever it gets. Its good at that. */
_syscall5(int, init_module, void *, first, void *, second, void *, third,
void *, fourth, void *, fifth);
#ifndef __NR_query_module
#warning This kernel does not support the query_module syscall
#warning -> The query_module system call is being stubbed out...
@ -85,11 +59,11 @@ _syscall5(int, query_module, const char *, name, int, which,
#endif
/* Jump through hoops to fixup error return codes */
#define __NR__create_module __NR_create_module
static inline _syscall2(long, _create_module, const char *, name, size_t, size)
#define __NR___create_module __NR_create_module
static inline _syscall2(long, __create_module, const char *, name, size_t, size)
unsigned long create_module(const char *name, size_t size)
{
long ret = _create_module(name, size);
long ret = __create_module(name, size);
if (ret == -1 && errno > 125) {
ret = -errno;

View File

@ -62,6 +62,12 @@
#include <sys/utsname.h>
#include "busybox.h"
#ifdef BB_FEATURE_NEW_MODULE_INTERFACE
# define new_sys_init_module init_module
#else
# define old_sys_init_module init_module
#endif
#if defined(__powerpc__)
#define BB_USE_PLT_ENTRIES
#define BB_PLT_ENTRY_SIZE 16
@ -117,7 +123,7 @@
#ifndef MODUTILS_MODULE_H
static const int MODUTILS_MODULE_H = 1;
#ident "$Id: insmod.c,v 1.56 2001/04/05 06:24:27 andersen Exp $"
#ident "$Id: insmod.c,v 1.57 2001/04/05 07:33:10 andersen Exp $"
/* This file contains the structures used by the 2.0 and 2.1 kernels.
We do not use the kernel headers directly because we do not wish
@ -267,7 +273,7 @@ static const int NEW_MOD_AUTOCLEAN = 4;
static const int NEW_MOD_VISITED = 8;
static const int NEW_MOD_USED_ONCE = 16;
int init_module(const char *name, const struct new_module *);
int new_sys_init_module(const char *name, const struct new_module *);
int query_module(const char *name, int which, void *buf, size_t bufsize,
size_t *ret);
@ -323,7 +329,7 @@ int delete_module(const char *);
#ifndef MODUTILS_OBJ_H
static const int MODUTILS_OBJ_H = 1;
#ident "$Id: insmod.c,v 1.56 2001/04/05 06:24:27 andersen Exp $"
#ident "$Id: insmod.c,v 1.57 2001/04/05 07:33:10 andersen Exp $"
/* The relocatable object is manipulated using elfin types. */
@ -2515,7 +2521,7 @@ new_init_module(const char *m_name, struct obj_file *f,
image = xmalloc(m_size);
obj_create_image(f, image);
ret = init_module(m_name, (struct new_module *) image);
ret = new_sys_init_module(m_name, (struct new_module *) image);
if (ret)
perror_msg("init_module: %s", m_name);