diff options
author | Eric Andersen <andersen@codepoet.org> | 2001-04-05 06:08:14 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2001-04-05 06:08:14 +0000 |
commit | a2a978ae23e267c24eb7b11662afdcc9ea47e789 (patch) | |
tree | f9927bd24dbc96724b1c0b89327d4c7157ed8eb4 /libbb/module_syscalls.c | |
parent | fdefbbbe85b852ba6de361c8f53d025b09b9abbe (diff) | |
download | busybox-w32-a2a978ae23e267c24eb7b11662afdcc9ea47e789.tar.gz busybox-w32-a2a978ae23e267c24eb7b11662afdcc9ea47e789.tar.bz2 busybox-w32-a2a978ae23e267c24eb7b11662afdcc9ea47e789.zip |
Some further syscall adjustments. Split the module syscalls out of
insmod and into libbb. Only enable them for libc5. glibc and
uClibc don't need them.
-Erik
Diffstat (limited to 'libbb/module_syscalls.c')
-rw-r--r-- | libbb/module_syscalls.c | 88 |
1 files changed, 88 insertions, 0 deletions
diff --git a/libbb/module_syscalls.c b/libbb/module_syscalls.c new file mode 100644 index 000000000..d0c1a36d4 --- /dev/null +++ b/libbb/module_syscalls.c | |||
@@ -0,0 +1,88 @@ | |||
1 | /* vi: set sw=4 ts=4: */ | ||
2 | /* | ||
3 | * some system calls possibly missing from libc | ||
4 | * | ||
5 | * Copyright (C) 1999,2000,2001 by Lineo, inc. | ||
6 | * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License as published by | ||
10 | * the Free Software Foundation; either version 2 of the License, or | ||
11 | * (at your option) any later version. | ||
12 | * | ||
13 | * This program is distributed in the hope that it will be useful, | ||
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
16 | * General Public License for more details. | ||
17 | * | ||
18 | * You should have received a copy of the GNU General Public License | ||
19 | * along with this program; if not, write to the Free Software | ||
20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
21 | * | ||
22 | */ | ||
23 | |||
24 | #include <stdio.h> | ||
25 | #include <errno.h> | ||
26 | #include <unistd.h> | ||
27 | /* Kernel headers before 2.1.mumble need this on the Alpha to get | ||
28 | _syscall* defined. */ | ||
29 | #define __LIBRARY__ | ||
30 | #include <sys/syscall.h> | ||
31 | #include <asm/unistd.h> | ||
32 | #include "libbb.h" | ||
33 | |||
34 | #define __NR_new_sys_init_module __NR_init_module | ||
35 | _syscall2(int, new_sys_init_module, const char *, name, | ||
36 | const struct new_module *, info); | ||
37 | |||
38 | #define __NR_old_sys_init_module __NR_init_module | ||
39 | _syscall5(int, old_sys_init_module, const char *, name, char *, code, | ||
40 | unsigned, codesize, struct old_mod_routines *, routines, | ||
41 | struct old_symbol_table *, symtab); | ||
42 | |||
43 | #if __GNU_LIBRARY__ < 5 | ||
44 | /* These syscalls are not included as part of libc5 */ | ||
45 | _syscall1(int, delete_module, const char *, name); | ||
46 | _syscall1(int, get_kernel_syms, struct old_kernel_sym *, ks); | ||
47 | |||
48 | #ifndef __NR_query_module | ||
49 | #warning This kernel does not support the query_module syscall | ||
50 | #warning -> The query_module system call is being stubbed out... | ||
51 | int query_module(const char *name, int which, void *buf, size_t bufsize, size_t *ret) | ||
52 | { | ||
53 | fprintf(stderr, "\n\nTo make this application work, you will need to recompile\n"); | ||
54 | fprintf(stderr, "with a kernel supporting the query_module system call. -Erik\n\n"); | ||
55 | errno=ENOSYS; | ||
56 | return -1; | ||
57 | } | ||
58 | #else | ||
59 | _syscall5(int, query_module, const char *, name, int, which, | ||
60 | void *, buf, size_t, bufsize, size_t*, ret); | ||
61 | #endif | ||
62 | |||
63 | /* Jump through hoops to fixup error return codes */ | ||
64 | #define __NR__create_module __NR_create_module | ||
65 | static inline _syscall2(long, _create_module, const char *, name, size_t, size) | ||
66 | unsigned long create_module(const char *name, size_t size) | ||
67 | { | ||
68 | long ret = _create_module(name, size); | ||
69 | |||
70 | if (ret == -1 && errno > 125) { | ||
71 | ret = -errno; | ||
72 | errno = 0; | ||
73 | } | ||
74 | return ret; | ||
75 | } | ||
76 | |||
77 | #endif /* __GNU_LIBRARY__ < 5 */ | ||
78 | |||
79 | |||
80 | /* END CODE */ | ||
81 | /* | ||
82 | Local Variables: | ||
83 | c-file-style: "linux" | ||
84 | c-basic-offset: 4 | ||
85 | tab-width: 4 | ||
86 | End: | ||
87 | */ | ||
88 | |||