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 /util-linux | |
| 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 'util-linux')
| -rw-r--r-- | util-linux/dmesg.c | 13 | ||||
| -rw-r--r-- | util-linux/mount.c | 6 | ||||
| -rw-r--r-- | util-linux/pivot_root.c | 23 | ||||
| -rw-r--r-- | util-linux/swaponoff.c | 13 |
4 files changed, 14 insertions, 41 deletions
diff --git a/util-linux/dmesg.c b/util-linux/dmesg.c index 2c85ed3e9..73de6d1ae 100644 --- a/util-linux/dmesg.c +++ b/util-linux/dmesg.c | |||
| @@ -20,18 +20,13 @@ | |||
| 20 | #include <getopt.h> | 20 | #include <getopt.h> |
| 21 | 21 | ||
| 22 | #if __GNU_LIBRARY__ < 5 | 22 | #if __GNU_LIBRARY__ < 5 |
| 23 | #include <sys/syscall.h> | 23 | # ifdef __alpha__ |
| 24 | #include <linux/unistd.h> | 24 | # define klogctl syslog |
| 25 | #ifndef __alpha__ | 25 | # endif |
| 26 | # define __NR_klogctl __NR_syslog | ||
| 27 | static inline _syscall3(int, klogctl, int, type, char *, b, int, len); | ||
| 28 | #else /* __alpha__ */ | ||
| 29 | #define klogctl syslog | ||
| 30 | #endif | ||
| 31 | |||
| 32 | #else | 26 | #else |
| 33 | # include <sys/klog.h> | 27 | # include <sys/klog.h> |
| 34 | #endif | 28 | #endif |
| 29 | |||
| 35 | #include "busybox.h" | 30 | #include "busybox.h" |
| 36 | 31 | ||
| 37 | int dmesg_main(int argc, char **argv) | 32 | int dmesg_main(int argc, char **argv) |
diff --git a/util-linux/mount.c b/util-linux/mount.c index 57dc73e55..5b6ec1e71 100644 --- a/util-linux/mount.c +++ b/util-linux/mount.c | |||
| @@ -84,11 +84,7 @@ extern int mount (__const char *__special_file, __const char *__dir, | |||
| 84 | extern int umount (__const char *__special_file); | 84 | extern int umount (__const char *__special_file); |
| 85 | extern int umount2 (__const char *__special_file, int __flags); | 85 | extern int umount2 (__const char *__special_file, int __flags); |
| 86 | 86 | ||
| 87 | #include <sys/syscall.h> | 87 | extern int sysfs( int option, unsigned int fs_index, char * buf); |
| 88 | #include <linux/unistd.h> | ||
| 89 | static int sysfs( int option, unsigned int fs_index, char * buf); | ||
| 90 | _syscall3(int, sysfs, int, option, unsigned int, fs_index, char *, buf); | ||
| 91 | |||
| 92 | 88 | ||
| 93 | extern const char mtab_file[]; /* Defined in utility.c */ | 89 | extern const char mtab_file[]; /* Defined in utility.c */ |
| 94 | 90 | ||
diff --git a/util-linux/pivot_root.c b/util-linux/pivot_root.c index 4d7f8a3d1..ba26b9c58 100644 --- a/util-linux/pivot_root.c +++ b/util-linux/pivot_root.c | |||
| @@ -9,30 +9,9 @@ | |||
| 9 | #include <stdlib.h> | 9 | #include <stdlib.h> |
| 10 | #include <stdio.h> | 10 | #include <stdio.h> |
| 11 | #include <errno.h> | 11 | #include <errno.h> |
| 12 | #include <sys/syscall.h> | ||
| 13 | #include <linux/unistd.h> | ||
| 14 | #include "busybox.h" | 12 | #include "busybox.h" |
| 15 | 13 | ||
| 16 | #ifndef __NR_pivot_root | 14 | extern int pivot_root(const char * new_root,const char * put_old); |
| 17 | #warning This kernel does not support the pivot_root syscall | ||
| 18 | #warning The pivot_root system call is being stubbed out... | ||
| 19 | int pivot_root(const char * new_root,const char * put_old) | ||
| 20 | { | ||
| 21 | /* BusyBox was compiled against a kernel that did not support | ||
| 22 | * the pivot_root system call. To make this application work, | ||
| 23 | * you will need to recompile with a kernel supporting the | ||
| 24 | * pivot_root system call. | ||
| 25 | */ | ||
| 26 | fprintf(stderr, "\n\nTo make this application work, you will need to recompile\n"); | ||
| 27 | fprintf(stderr, "with a kernel supporting the pivot_root system call. -Erik\n\n"); | ||
| 28 | errno=ENOSYS; | ||
| 29 | return -1; | ||
| 30 | } | ||
| 31 | #else | ||
| 32 | static _syscall2(int,pivot_root,const char *,new_root,const char *,put_old) | ||
| 33 | #endif | ||
| 34 | |||
| 35 | |||
| 36 | 15 | ||
| 37 | int pivot_root_main(int argc, char **argv) | 16 | int pivot_root_main(int argc, char **argv) |
| 38 | { | 17 | { |
diff --git a/util-linux/swaponoff.c b/util-linux/swaponoff.c index 55022ae3b..ce0e2c6cc 100644 --- a/util-linux/swaponoff.c +++ b/util-linux/swaponoff.c | |||
| @@ -29,13 +29,16 @@ | |||
| 29 | #include <string.h> | 29 | #include <string.h> |
| 30 | #include <stdlib.h> | 30 | #include <stdlib.h> |
| 31 | #include <sys/mount.h> | 31 | #include <sys/mount.h> |
| 32 | #include <sys/syscall.h> | ||
| 33 | #include <linux/unistd.h> | ||
| 34 | #include "busybox.h" | ||
| 35 | 32 | ||
| 36 | static _syscall2(int, swapon, const char *, path, int, flags); | 33 | #if __GNU_LIBRARY__ < 5 |
| 37 | static _syscall1(int, swapoff, const char *, path); | 34 | /* libc5 doesn't have sys/swap.h, define these here. */ |
| 35 | extern int swapon (__const char *__path, int __flags); | ||
| 36 | extern int swapoff (__const char *__path); | ||
| 37 | #else | ||
| 38 | #include <sys/swap.h> | ||
| 39 | #endif | ||
| 38 | 40 | ||
| 41 | #include "busybox.h" | ||
| 39 | 42 | ||
| 40 | static int whichApp; | 43 | static int whichApp; |
| 41 | 44 | ||
