diff options
author | Eric Andersen <andersen@codepoet.org> | 2001-04-05 03:14:39 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2001-04-05 03:14:39 +0000 |
commit | e76c3b08e105147e3cef7e8d38d65da2fac6b2e1 (patch) | |
tree | 87f705b9e4e4e48700ac61e9538c637ae2b395a7 /libbb | |
parent | 3c0364f3911ec9f43e1c8c96ec2c8e30b1b52c47 (diff) | |
download | busybox-w32-e76c3b08e105147e3cef7e8d38d65da2fac6b2e1.tar.gz busybox-w32-e76c3b08e105147e3cef7e8d38d65da2fac6b2e1.tar.bz2 busybox-w32-e76c3b08e105147e3cef7e8d38d65da2fac6b2e1.zip |
A number of cleanups. Now compiles with libc5, glibc, and uClibc. Fix a few
shadowed variables. Move (almost) all syscalls to libbb/syscalls.c, so I can
handle them sanely and all at once.
-Erik
Diffstat (limited to 'libbb')
-rw-r--r-- | libbb/libbb.h | 1 | ||||
-rw-r--r-- | libbb/syscalls.c | 72 |
2 files changed, 61 insertions, 12 deletions
diff --git a/libbb/libbb.h b/libbb/libbb.h index d850befea..d0896ab86 100644 --- a/libbb/libbb.h +++ b/libbb/libbb.h | |||
@@ -211,5 +211,6 @@ enum { | |||
211 | }; | 211 | }; |
212 | 212 | ||
213 | int ask_confirmation(void); | 213 | int ask_confirmation(void); |
214 | int klogctl(int type, char * b, int len); | ||
214 | 215 | ||
215 | #endif /* __LIBBB_H__ */ | 216 | #endif /* __LIBBB_H__ */ |
diff --git a/libbb/syscalls.c b/libbb/syscalls.c index 021154602..efca39902 100644 --- a/libbb/syscalls.c +++ b/libbb/syscalls.c | |||
@@ -32,18 +32,63 @@ | |||
32 | 32 | ||
33 | #include "libbb.h" | 33 | #include "libbb.h" |
34 | 34 | ||
35 | _syscall3(int, sysfs, int, option, unsigned int, fs_index, char *, buf); | ||
35 | 36 | ||
36 | _syscall1(int, sysinfo, struct sysinfo *, info); | 37 | #ifndef __NR_pivot_root |
38 | #warning This kernel does not support the pivot_root syscall | ||
39 | #warning -> The pivot_root system call is being stubbed out... | ||
40 | int pivot_root(const char * new_root,const char * put_old) | ||
41 | { | ||
42 | /* BusyBox was compiled against a kernel that did not support | ||
43 | * the pivot_root system call. To make this application work, | ||
44 | * you will need to recompile with a kernel supporting the | ||
45 | * pivot_root system call. | ||
46 | */ | ||
47 | fprintf(stderr, "\n\nTo make this application work, you will need to recompile\n"); | ||
48 | fprintf(stderr, "with a kernel supporting the pivot_root system call. -Erik\n\n"); | ||
49 | errno=ENOSYS; | ||
50 | return -1; | ||
51 | } | ||
52 | #else | ||
53 | _syscall2(int,pivot_root,const char *,new_root,const char *,put_old) | ||
54 | #endif | ||
55 | |||
56 | |||
57 | |||
58 | |||
59 | #if __GNU_LIBRARY__ < 5 | ||
60 | /* These syscalls are not included as part of libc5 */ | ||
61 | _syscall2(int, bdflush, int, func, int, data); | ||
62 | _syscall1(int, delete_module, const char *, name) | ||
63 | |||
64 | #ifndef __NR_query_module | ||
65 | #warning This kernel does not support the query_module syscall | ||
66 | #warning -> The query_module system call is being stubbed out... | ||
67 | int query_module(const char *name, int which, void *buf, size_t bufsize, size_t *ret) | ||
68 | { | ||
69 | /* BusyBox was compiled against a kernel that did not support | ||
70 | * the query_module system call. To make this application work, | ||
71 | * you will need to recompile with a kernel supporting the | ||
72 | * query_module system call. | ||
73 | */ | ||
74 | fprintf(stderr, "\n\nTo make this application work, you will need to recompile\n"); | ||
75 | fprintf(stderr, "with a kernel supporting the query_module system call. -Erik\n\n"); | ||
76 | errno=ENOSYS; | ||
77 | return -1; | ||
78 | } | ||
79 | #else | ||
80 | _syscall5(int, query_module, const char *, name, int, which, | ||
81 | void *, buf, size_t, bufsize, size_t*, ret); | ||
82 | #endif | ||
37 | 83 | ||
38 | /* Include our own version of <sys/mount.h>, since libc5 doesn't | 84 | #ifndef __alpha__ |
39 | * know about umount2 */ | 85 | # define __NR_klogctl __NR_syslog |
40 | extern _syscall1(int, umount, const char *, special_file); | 86 | _syscall3(int, klogctl, int, type, char *, b, int, len); |
41 | extern _syscall5(int, mount, const char *, special_file, const char *, dir, | 87 | #endif |
42 | const char *, fstype, unsigned long int, rwflag, const void *, data); | ||
43 | 88 | ||
44 | #ifndef __NR_umount2 | 89 | #ifndef __NR_umount2 |
45 | # warning This kernel does not support the umount2 syscall | 90 | # warning This kernel does not support the umount2 syscall |
46 | # warning The umount2 system call is being stubbed out... | 91 | # warning -> The umount2 system call is being stubbed out... |
47 | int umount2(const char * special_file, int flags) | 92 | int umount2(const char * special_file, int flags) |
48 | { | 93 | { |
49 | /* BusyBox was compiled against a kernel that did not support | 94 | /* BusyBox was compiled against a kernel that did not support |
@@ -57,14 +102,17 @@ int umount2(const char * special_file, int flags) | |||
57 | return -1; | 102 | return -1; |
58 | } | 103 | } |
59 | # else | 104 | # else |
60 | extern _syscall2(int, umount2, const char *, special_file, int, flags); | 105 | _syscall2(int, umount2, const char *, special_file, int, flags); |
61 | #endif | 106 | #endif |
62 | 107 | ||
63 | #ifndef __NR_query_module | 108 | |
64 | static const int __NR_query_module = 167; | 109 | #endif /* __GNU_LIBRARY__ < 5 */ |
110 | |||
111 | |||
112 | #if 0 | ||
113 | _syscall1(int, sysinfo, struct sysinfo *, info); | ||
65 | #endif | 114 | #endif |
66 | _syscall5(int, query_module, const char *, name, int, which, | 115 | |
67 | void *, buf, size_t, bufsize, size_t*, ret); | ||
68 | 116 | ||
69 | /* END CODE */ | 117 | /* END CODE */ |
70 | /* | 118 | /* |