summaryrefslogtreecommitdiff
path: root/libbb/module_syscalls.c
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2003-05-26 18:48:56 +0000
committerEric Andersen <andersen@codepoet.org>2003-05-26 18:48:56 +0000
commit82ab3d7c3e65998e0b033347072ee32cf5d61b42 (patch)
tree23318f32d86a7f4c591bd9a8ef895f4e32929243 /libbb/module_syscalls.c
parentb0cfca75442293b4b670584d83c39f9cea9f5a8b (diff)
downloadbusybox-w32-82ab3d7c3e65998e0b033347072ee32cf5d61b42.tar.gz
busybox-w32-82ab3d7c3e65998e0b033347072ee32cf5d61b42.tar.bz2
busybox-w32-82ab3d7c3e65998e0b033347072ee32cf5d61b42.zip
Make all syscall declarations use the syscall() function
Diffstat (limited to 'libbb/module_syscalls.c')
-rw-r--r--libbb/module_syscalls.c47
1 files changed, 26 insertions, 21 deletions
diff --git a/libbb/module_syscalls.c b/libbb/module_syscalls.c
index 8fe9e525c..b0ace74ea 100644
--- a/libbb/module_syscalls.c
+++ b/libbb/module_syscalls.c
@@ -37,42 +37,47 @@
37 37
38#if __GNU_LIBRARY__ < 5 || ((__GLIBC__ <= 2) && (__GLIBC_MINOR__ < 1)) 38#if __GNU_LIBRARY__ < 5 || ((__GLIBC__ <= 2) && (__GLIBC_MINOR__ < 1))
39/* These syscalls are not included as part of libc5 */ 39/* These syscalls are not included as part of libc5 */
40_syscall1(int, delete_module, const char *, name); 40int delete_module(const char *name)
41_syscall1(int, get_kernel_syms, __ptr_t, ks); 41{
42 return(syscall(__NR_delete_module, name));
43}
44int get_kernel_syms(__ptr_t ks)
45{
46 return(syscall(__NR_get_kernel_syms, ks));
47}
42 48
43/* This may have 5 arguments (for old 2.0 kernels) or 2 arguments 49/* This may have 5 arguments (for old 2.0 kernels) or 2 arguments
44 * (for 2.2 and 2.4 kernels). Use the greatest common denominator, 50 * (for 2.2 and 2.4 kernels). Use the greatest common denominator,
45 * and let the kernel cope with whatever it gets. Its good at that. */ 51 * and let the kernel cope with whatever it gets. Its good at that. */
46_syscall5(int, init_module, void *, first, void *, second, void *, third, 52int init_module(void *first, void *second, void *third, void *fourth, void *fifth)
47 void *, fourth, void *, fifth); 53{
54 return(syscall(__NR_init_module, first, second, third, fourth, fifth));
55}
48 56
57int query_module(const char *name, int which, void *buf, size_t bufsize, size_t *ret)
58{
49#ifndef __NR_query_module 59#ifndef __NR_query_module
50#warning This kernel does not support the query_module syscall 60#warning This kernel does not support the query_module syscall
51#warning -> The query_module system call is being stubbed out... 61#warning -> The query_module system call is being stubbed out...
52int query_module(const char *name, int which, void *buf, size_t bufsize, size_t *ret) 62 bb_error_msg("\n\nTo make this application work, you will need to recompile\n"
53{ 63 "BusyBox with a kernel supporting the query_module system call.\n");
54 bb_error_msg("\n\nTo make this application work, you will need to recompile\n" 64 errno=ENOSYS;
55 "with a kernel supporting the query_module system call. -Erik\n"); 65 return -1;
56 errno=ENOSYS;
57 return -1;
58}
59#else 66#else
60_syscall5(int, query_module, const char *, name, int, which, 67 return(syscall(__NR_query_module, name, which, buf, bufsize, ret));
61 void *, buf, size_t, bufsize, size_t*, ret);
62#endif 68#endif
69}
63 70
64/* Jump through hoops to fixup error return codes */ 71/* Jump through hoops to fixup error return codes */
65#define __NR___create_module __NR_create_module
66static inline _syscall2(long, __create_module, const char *, name, size_t, size)
67unsigned long create_module(const char *name, size_t size) 72unsigned long create_module(const char *name, size_t size)
68{ 73{
69 long ret = __create_module(name, size); 74 long ret = syscall(__NR_create_module, name, size);
70 75
71 if (ret == -1 && errno > 125) { 76 if (ret == -1 && errno > 125) {
72 ret = -errno; 77 ret = -errno;
73 errno = 0; 78 errno = 0;
74 } 79 }
75 return ret; 80 return ret;
76} 81}
77 82
78#endif /* __GNU_LIBRARY__ < 5 */ 83#endif /* __GNU_LIBRARY__ < 5 */