aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Eric Andersen <andersen@codepoet.org>2001-04-05 03:14:39 +0000
committerGravatar Eric Andersen <andersen@codepoet.org>2001-04-05 03:14:39 +0000
commite76c3b08e105147e3cef7e8d38d65da2fac6b2e1 (patch)
tree87f705b9e4e4e48700ac61e9538c637ae2b395a7
parent3c0364f3911ec9f43e1c8c96ec2c8e30b1b52c47 (diff)
downloadbusybox-e76c3b08e105147e3cef7e8d38d65da2fac6b2e1.tar.gz
busybox-e76c3b08e105147e3cef7e8d38d65da2fac6b2e1.tar.bz2
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
-rw-r--r--adjtimex.c9
-rw-r--r--archival/dpkg.c13
-rw-r--r--coreutils/dd.c4
-rw-r--r--coreutils/ls.c2
-rw-r--r--dd.c4
-rw-r--r--dmesg.c13
-rw-r--r--dpkg.c13
-rw-r--r--include/libbb.h1
-rw-r--r--init.c4
-rw-r--r--init/init.c4
-rw-r--r--insmod.c24
-rw-r--r--klogd.c16
-rw-r--r--libbb/libbb.h1
-rw-r--r--libbb/syscalls.c72
-rw-r--r--ls.c2
-rw-r--r--lsmod.c3
-rw-r--r--miscutils/adjtimex.c9
-rw-r--r--miscutils/update.c8
-rw-r--r--modutils/insmod.c24
-rw-r--r--modutils/lsmod.c3
-rw-r--r--modutils/rmmod.c7
-rw-r--r--mount.c6
-rw-r--r--networking/tftp.c2
-rw-r--r--pivot_root.c23
-rw-r--r--rmmod.c7
-rw-r--r--swaponoff.c13
-rw-r--r--sysklogd/klogd.c16
-rw-r--r--tftp.c2
-rw-r--r--update.c8
-rw-r--r--util-linux/dmesg.c13
-rw-r--r--util-linux/mount.c6
-rw-r--r--util-linux/pivot_root.c23
-rw-r--r--util-linux/swaponoff.c13
33 files changed, 166 insertions, 202 deletions
diff --git a/adjtimex.c b/adjtimex.c
index 02b6e89b0..e3c160d87 100644
--- a/adjtimex.c
+++ b/adjtimex.c
@@ -44,7 +44,14 @@
#include <sys/types.h>
#include <stdlib.h>
#include <unistd.h>
+
+#if __GNU_LIBRARY__ < 5
+#include <sys/timex.h>
+extern int adjtimex(struct timex *buf);
+#else
#include <sys/timex.h>
+#endif
+
#ifdef BB_VER
#include "busybox.h"
#endif
@@ -163,7 +170,7 @@ int main(int argc, char ** argv)
" return value: %d (%s)\n",
txc.constant,
txc.precision, txc.tolerance, txc.tick,
- txc.time.tv_sec, txc.time.tv_usec, ret, descript);
+ (long)txc.time.tv_sec, (long)txc.time.tv_usec, ret, descript);
}
return (ret<0);
}
diff --git a/archival/dpkg.c b/archival/dpkg.c
index d65081715..dc0b23e8e 100644
--- a/archival/dpkg.c
+++ b/archival/dpkg.c
@@ -12,14 +12,6 @@
#include "busybox.h"
-/* Stupid libc doesn't have a reliable way for use to know
- * that libc5 is being used. Assume this is good enough */
-#if !defined __GLIBC__ && !defined __UCLIBC__
-#error It looks like you are using libc5, which does not support
-#error tfind(). tfind() is used by busybox dpkg.
-#error Please disable BB_DPKG. Sorry.
-#endif
-
#define DEPENDSMAX 64 /* maximum number of depends we can handle */
/* Should we do full dependency checking? */
@@ -591,6 +583,7 @@ static int dpkg_dounpack(package_t *pkg)
char *adminscripts[] = { "/prerm", "/postrm", "/preinst", "/postinst",
"/conffiles", "/md5sums", "/shlibs", "/templates" };
char buf[1024], buf2[1024];
+ FILE *myfile = stdout;
DPRINTF("Unpacking %s\n", pkg->package);
@@ -622,9 +615,9 @@ static int dpkg_dounpack(package_t *pkg)
strcpy(lst_file, infodir);
strcat(lst_file, pkg->package);
strcat(lst_file, ".list");
- outfp = freopen(lst_file, "w", stdout);
+ outfp = freopen(lst_file, "w", myfile);
deb_extract(dpkg_deb_list, NULL, pkg->file);
- stdout = freopen(NULL, "w", outfp);
+ myfile = freopen(NULL, "w", outfp);
printf("done\n");
getchar();
diff --git a/coreutils/dd.c b/coreutils/dd.c
index 3f58929ba..297d0ab51 100644
--- a/coreutils/dd.c
+++ b/coreutils/dd.c
@@ -151,8 +151,8 @@ int dd_main(int argc, char **argv)
out_part++;
}
- fprintf(statusfp, "%d+%d records in\n", in_full, in_part);
- fprintf(statusfp, "%d+%d records out\n", out_full, out_part);
+ fprintf(statusfp, "%ld+%ld records in\n", (long)in_full, (long)in_part);
+ fprintf(statusfp, "%ld+%ld records out\n", (long)out_full, (long)out_part);
return EXIT_SUCCESS;
}
diff --git a/coreutils/ls.c b/coreutils/ls.c
index 49470e9f7..0b89ecce1 100644
--- a/coreutils/ls.c
+++ b/coreutils/ls.c
@@ -626,7 +626,7 @@ static int list_single(struct dnode *dn)
column += 10;
break;
case LIST_NLINKS:
- printf("%4d ", dn->dstat.st_nlink);
+ printf("%4ld ", (long)dn->dstat.st_nlink);
column += 10;
break;
case LIST_ID_NAME:
diff --git a/dd.c b/dd.c
index 3f58929ba..297d0ab51 100644
--- a/dd.c
+++ b/dd.c
@@ -151,8 +151,8 @@ int dd_main(int argc, char **argv)
out_part++;
}
- fprintf(statusfp, "%d+%d records in\n", in_full, in_part);
- fprintf(statusfp, "%d+%d records out\n", out_full, out_part);
+ fprintf(statusfp, "%ld+%ld records in\n", (long)in_full, (long)in_part);
+ fprintf(statusfp, "%ld+%ld records out\n", (long)out_full, (long)out_part);
return EXIT_SUCCESS;
}
diff --git a/dmesg.c b/dmesg.c
index 2c85ed3e9..73de6d1ae 100644
--- a/dmesg.c
+++ b/dmesg.c
@@ -20,18 +20,13 @@
#include <getopt.h>
#if __GNU_LIBRARY__ < 5
-#include <sys/syscall.h>
-#include <linux/unistd.h>
-#ifndef __alpha__
-# define __NR_klogctl __NR_syslog
-static inline _syscall3(int, klogctl, int, type, char *, b, int, len);
-#else /* __alpha__ */
-#define klogctl syslog
-#endif
-
+# ifdef __alpha__
+# define klogctl syslog
+# endif
#else
# include <sys/klog.h>
#endif
+
#include "busybox.h"
int dmesg_main(int argc, char **argv)
diff --git a/dpkg.c b/dpkg.c
index d65081715..dc0b23e8e 100644
--- a/dpkg.c
+++ b/dpkg.c
@@ -12,14 +12,6 @@
#include "busybox.h"
-/* Stupid libc doesn't have a reliable way for use to know
- * that libc5 is being used. Assume this is good enough */
-#if !defined __GLIBC__ && !defined __UCLIBC__
-#error It looks like you are using libc5, which does not support
-#error tfind(). tfind() is used by busybox dpkg.
-#error Please disable BB_DPKG. Sorry.
-#endif
-
#define DEPENDSMAX 64 /* maximum number of depends we can handle */
/* Should we do full dependency checking? */
@@ -591,6 +583,7 @@ static int dpkg_dounpack(package_t *pkg)
char *adminscripts[] = { "/prerm", "/postrm", "/preinst", "/postinst",
"/conffiles", "/md5sums", "/shlibs", "/templates" };
char buf[1024], buf2[1024];
+ FILE *myfile = stdout;
DPRINTF("Unpacking %s\n", pkg->package);
@@ -622,9 +615,9 @@ static int dpkg_dounpack(package_t *pkg)
strcpy(lst_file, infodir);
strcat(lst_file, pkg->package);
strcat(lst_file, ".list");
- outfp = freopen(lst_file, "w", stdout);
+ outfp = freopen(lst_file, "w", myfile);
deb_extract(dpkg_deb_list, NULL, pkg->file);
- stdout = freopen(NULL, "w", outfp);
+ myfile = freopen(NULL, "w", outfp);
printf("done\n");
getchar();
diff --git a/include/libbb.h b/include/libbb.h
index d850befea..d0896ab86 100644
--- a/include/libbb.h
+++ b/include/libbb.h
@@ -211,5 +211,6 @@ enum {
};
int ask_confirmation(void);
+int klogctl(int type, char * b, int len);
#endif /* __LIBBB_H__ */
diff --git a/init.c b/init.c
index 570b8a697..bf992b52c 100644
--- a/init.c
+++ b/init.c
@@ -115,9 +115,7 @@ static const int RB_AUTOBOOT = 0x01234567;
#if defined(__GLIBC__)
#include <sys/kdaemon.h>
#else
-#include <sys/syscall.h>
-#include <linux/unistd.h>
-static _syscall2(int, bdflush, int, func, int, data);
+extern int bdflush (int func, long int data);
#endif /* __GLIBC__ */
diff --git a/init/init.c b/init/init.c
index 570b8a697..bf992b52c 100644
--- a/init/init.c
+++ b/init/init.c
@@ -115,9 +115,7 @@ static const int RB_AUTOBOOT = 0x01234567;
#if defined(__GLIBC__)
#include <sys/kdaemon.h>
#else
-#include <sys/syscall.h>
-#include <linux/unistd.h>
-static _syscall2(int, bdflush, int, func, int, data);
+extern int bdflush (int func, long int data);
#endif /* __GLIBC__ */
diff --git a/insmod.c b/insmod.c
index 0a7cb1e4a..ad1486b7b 100644
--- a/insmod.c
+++ b/insmod.c
@@ -119,7 +119,7 @@
#ifndef MODUTILS_MODULE_H
static const int MODUTILS_MODULE_H = 1;
-#ident "$Id: insmod.c,v 1.53 2001/03/22 19:01:16 andersen Exp $"
+#ident "$Id: insmod.c,v 1.54 2001/04/05 03:14:39 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
@@ -325,7 +325,7 @@ int delete_module(const char *);
#ifndef MODUTILS_OBJ_H
static const int MODUTILS_OBJ_H = 1;
-#ident "$Id: insmod.c,v 1.53 2001/03/22 19:01:16 andersen Exp $"
+#ident "$Id: insmod.c,v 1.54 2001/04/05 03:14:39 andersen Exp $"
/* The relocatable object is manipulated using elfin types. */
@@ -1210,18 +1210,18 @@ int arch_create_got(struct obj_file *f)
#if defined(BB_USE_GOT_ENTRIES)
if (got_offset) {
- struct obj_section* relsec = obj_find_section(f, ".got");
+ struct obj_section* myrelsec = obj_find_section(f, ".got");
- if (relsec) {
- obj_extend_section(relsec, got_offset);
+ if (myrelsec) {
+ obj_extend_section(myrelsec, got_offset);
} else {
- relsec = obj_create_alloced_section(f, ".got",
+ myrelsec = obj_create_alloced_section(f, ".got",
BB_GOT_ENTRY_SIZE,
got_offset);
- assert(relsec);
+ assert(myrelsec);
}
- ifile->got = relsec;
+ ifile->got = myrelsec;
}
#endif
@@ -1748,19 +1748,19 @@ old_process_module_arguments(struct obj_file *f, int argc, char **argv)
while (*q++ == ',');
} else {
char *contents = f->sections[sym->secidx]->contents;
- char *loc = contents + sym->value;
+ char *myloc = contents + sym->value;
char *r; /* To search for commas */
/* Break the string with comas */
while ((r = strchr(q, ',')) != (char *) NULL) {
*r++ = '\0';
- obj_string_patch(f, sym->secidx, loc - contents, q);
- loc += sizeof(char *);
+ obj_string_patch(f, sym->secidx, myloc - contents, q);
+ myloc += sizeof(char *);
q = r;
}
/* last part */
- obj_string_patch(f, sym->secidx, loc - contents, q);
+ obj_string_patch(f, sym->secidx, myloc - contents, q);
}
argc--, argv++;
diff --git a/klogd.c b/klogd.c
index 95d4eea65..241a99175 100644
--- a/klogd.c
+++ b/klogd.c
@@ -40,20 +40,14 @@
#include <ctype.h>
#include <sys/syslog.h>
-#if ! defined __GLIBC__ && ! defined __UCLIBC__
-#include <sys/syscall.h>
-#include <linux/unistd.h>
-
-#ifndef __alpha__
-# define __NR_klogctl __NR_syslog
-static inline _syscall3(int, klogctl, int, type, char *, b, int, len);
-#else /* __alpha__ */
-#define klogctl syslog
-#endif
-
+#if __GNU_LIBRARY__ < 5
+# ifdef __alpha__
+# define klogctl syslog
+# endif
#else
# include <sys/klog.h>
#endif
+
#include "busybox.h"
static void klogd_signal(int sig)
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 {
};
int ask_confirmation(void);
+int klogctl(int type, char * b, int len);
#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 @@
#include "libbb.h"
+_syscall3(int, sysfs, int, option, unsigned int, fs_index, char *, buf);
-_syscall1(int, sysinfo, struct sysinfo *, info);
+#ifndef __NR_pivot_root
+#warning This kernel does not support the pivot_root syscall
+#warning -> The pivot_root system call is being stubbed out...
+int pivot_root(const char * new_root,const char * put_old)
+{
+ /* BusyBox was compiled against a kernel that did not support
+ * the pivot_root system call. To make this application work,
+ * you will need to recompile with a kernel supporting the
+ * pivot_root system call.
+ */
+ fprintf(stderr, "\n\nTo make this application work, you will need to recompile\n");
+ fprintf(stderr, "with a kernel supporting the pivot_root system call. -Erik\n\n");
+ errno=ENOSYS;
+ return -1;
+}
+#else
+_syscall2(int,pivot_root,const char *,new_root,const char *,put_old)
+#endif
+
+
+
+
+#if __GNU_LIBRARY__ < 5
+/* These syscalls are not included as part of libc5 */
+_syscall2(int, bdflush, int, func, int, data);
+_syscall1(int, delete_module, const char *, name)
+
+#ifndef __NR_query_module
+#warning This kernel does not support the query_module syscall
+#warning -> The query_module system call is being stubbed out...
+int query_module(const char *name, int which, void *buf, size_t bufsize, size_t *ret)
+{
+ /* BusyBox was compiled against a kernel that did not support
+ * the query_module system call. To make this application work,
+ * you will need to recompile with a kernel supporting the
+ * query_module system call.
+ */
+ fprintf(stderr, "\n\nTo make this application work, you will need to recompile\n");
+ fprintf(stderr, "with a kernel supporting the query_module system call. -Erik\n\n");
+ errno=ENOSYS;
+ return -1;
+}
+#else
+_syscall5(int, query_module, const char *, name, int, which,
+ void *, buf, size_t, bufsize, size_t*, ret);
+#endif
-/* Include our own version of <sys/mount.h>, since libc5 doesn't
- * know about umount2 */
-extern _syscall1(int, umount, const char *, special_file);
-extern _syscall5(int, mount, const char *, special_file, const char *, dir,
- const char *, fstype, unsigned long int, rwflag, const void *, data);
+#ifndef __alpha__
+# define __NR_klogctl __NR_syslog
+ _syscall3(int, klogctl, int, type, char *, b, int, len);
+#endif
#ifndef __NR_umount2
# warning This kernel does not support the umount2 syscall
-# warning The umount2 system call is being stubbed out...
+# warning -> The umount2 system call is being stubbed out...
int umount2(const char * special_file, int flags)
{
/* BusyBox was compiled against a kernel that did not support
@@ -57,14 +102,17 @@ int umount2(const char * special_file, int flags)
return -1;
}
# else
-extern _syscall2(int, umount2, const char *, special_file, int, flags);
+_syscall2(int, umount2, const char *, special_file, int, flags);
#endif
-#ifndef __NR_query_module
-static const int __NR_query_module = 167;
+
+#endif /* __GNU_LIBRARY__ < 5 */
+
+
+#if 0
+_syscall1(int, sysinfo, struct sysinfo *, info);
#endif
-_syscall5(int, query_module, const char *, name, int, which,
- void *, buf, size_t, bufsize, size_t*, ret);
+
/* END CODE */
/*
diff --git a/ls.c b/ls.c
index 49470e9f7..0b89ecce1 100644
--- a/ls.c
+++ b/ls.c
@@ -626,7 +626,7 @@ static int list_single(struct dnode *dn)
column += 10;
break;
case LIST_NLINKS:
- printf("%4d ", dn->dstat.st_nlink);
+ printf("%4ld ", (long)dn->dstat.st_nlink);
column += 10;
break;
case LIST_ID_NAME:
diff --git a/lsmod.c b/lsmod.c
index 8251705de..0f1b09b9e 100644
--- a/lsmod.c
+++ b/lsmod.c
@@ -52,8 +52,7 @@ struct module_info
};
-int query_module(const char *name, int which, void *buf, size_t bufsize,
- size_t *ret);
+int query_module(const char *name, int which, void *buf, size_t bufsize, size_t *ret);
/* Values for query_module's which. */
static const int QM_MODULES = 1;
diff --git a/miscutils/adjtimex.c b/miscutils/adjtimex.c
index 02b6e89b0..e3c160d87 100644
--- a/miscutils/adjtimex.c
+++ b/miscutils/adjtimex.c
@@ -44,7 +44,14 @@
#include <sys/types.h>
#include <stdlib.h>
#include <unistd.h>
+
+#if __GNU_LIBRARY__ < 5
+#include <sys/timex.h>
+extern int adjtimex(struct timex *buf);
+#else
#include <sys/timex.h>
+#endif
+
#ifdef BB_VER
#include "busybox.h"
#endif
@@ -163,7 +170,7 @@ int main(int argc, char ** argv)
" return value: %d (%s)\n",
txc.constant,
txc.precision, txc.tolerance, txc.tick,
- txc.time.tv_sec, txc.time.tv_usec, ret, descript);
+ (long)txc.time.tv_sec, (long)txc.time.tv_usec, ret, descript);
}
return (ret<0);
}
diff --git a/miscutils/update.c b/miscutils/update.c
index b282b9e18..ce2b6cf08 100644
--- a/miscutils/update.c
+++ b/miscutils/update.c
@@ -33,14 +33,12 @@
#include <unistd.h> /* for getopt() */
#include <stdlib.h>
-
#if defined(__GLIBC__)
#include <sys/kdaemon.h>
#else
-#include <sys/syscall.h>
-#include <linux/unistd.h>
-static _syscall2(int, bdflush, int, func, int, data);
-#endif /* __GLIBC__ */
+extern int bdflush (int func, long int data);
+#endif /* __GLIBC__ */
+
#include "busybox.h"
static unsigned int sync_duration = 30;
diff --git a/modutils/insmod.c b/modutils/insmod.c
index 0a7cb1e4a..ad1486b7b 100644
--- a/modutils/insmod.c
+++ b/modutils/insmod.c
@@ -119,7 +119,7 @@
#ifndef MODUTILS_MODULE_H
static const int MODUTILS_MODULE_H = 1;
-#ident "$Id: insmod.c,v 1.53 2001/03/22 19:01:16 andersen Exp $"
+#ident "$Id: insmod.c,v 1.54 2001/04/05 03:14:39 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
@@ -325,7 +325,7 @@ int delete_module(const char *);
#ifndef MODUTILS_OBJ_H
static const int MODUTILS_OBJ_H = 1;
-#ident "$Id: insmod.c,v 1.53 2001/03/22 19:01:16 andersen Exp $"
+#ident "$Id: insmod.c,v 1.54 2001/04/05 03:14:39 andersen Exp $"
/* The relocatable object is manipulated using elfin types. */
@@ -1210,18 +1210,18 @@ int arch_create_got(struct obj_file *f)
#if defined(BB_USE_GOT_ENTRIES)
if (got_offset) {
- struct obj_section* relsec = obj_find_section(f, ".got");
+ struct obj_section* myrelsec = obj_find_section(f, ".got");
- if (relsec) {
- obj_extend_section(relsec, got_offset);
+ if (myrelsec) {
+ obj_extend_section(myrelsec, got_offset);
} else {
- relsec = obj_create_alloced_section(f, ".got",
+ myrelsec = obj_create_alloced_section(f, ".got",
BB_GOT_ENTRY_SIZE,
got_offset);
- assert(relsec);
+ assert(myrelsec);
}
- ifile->got = relsec;
+ ifile->got = myrelsec;
}
#endif
@@ -1748,19 +1748,19 @@ old_process_module_arguments(struct obj_file *f, int argc, char **argv)
while (*q++ == ',');
} else {
char *contents = f->sections[sym->secidx]->contents;
- char *loc = contents + sym->value;
+ char *myloc = contents + sym->value;
char *r; /* To search for commas */
/* Break the string with comas */
while ((r = strchr(q, ',')) != (char *) NULL) {
*r++ = '\0';
- obj_string_patch(f, sym->secidx, loc - contents, q);
- loc += sizeof(char *);
+ obj_string_patch(f, sym->secidx, myloc - contents, q);
+ myloc += sizeof(char *);
q = r;
}
/* last part */
- obj_string_patch(f, sym->secidx, loc - contents, q);
+ obj_string_patch(f, sym->secidx, myloc - contents, q);
}
argc--, argv++;
diff --git a/modutils/lsmod.c b/modutils/lsmod.c
index 8251705de..0f1b09b9e 100644
--- a/modutils/lsmod.c
+++ b/modutils/lsmod.c
@@ -52,8 +52,7 @@ struct module_info
};
-int query_module(const char *name, int which, void *buf, size_t bufsize,
- size_t *ret);
+int query_module(const char *name, int which, void *buf, size_t bufsize, size_t *ret);
/* Values for query_module's which. */
static const int QM_MODULES = 1;
diff --git a/modutils/rmmod.c b/modutils/rmmod.c
index 36857e02c..7596d0232 100644
--- a/modutils/rmmod.c
+++ b/modutils/rmmod.c
@@ -26,16 +26,11 @@
#include <unistd.h>
#include <stdlib.h>
#include <getopt.h>
-#include <sys/syscall.h>
-#include <linux/unistd.h>
#include "busybox.h"
-#define __LIBRARY__
+extern int delete_module(const char * name);
-/* And the system call of the day is... */
-_syscall1(int, delete_module, const char *, name)
-
extern int rmmod_main(int argc, char **argv)
{
int n, ret = EXIT_SUCCESS;
diff --git a/mount.c b/mount.c
index 57dc73e55..5b6ec1e71 100644
--- a/mount.c
+++ b/mount.c
@@ -84,11 +84,7 @@ extern int mount (__const char *__special_file, __const char *__dir,
extern int umount (__const char *__special_file);
extern int umount2 (__const char *__special_file, int __flags);
-#include <sys/syscall.h>
-#include <linux/unistd.h>
-static int sysfs( int option, unsigned int fs_index, char * buf);
-_syscall3(int, sysfs, int, option, unsigned int, fs_index, char *, buf);
-
+extern int sysfs( int option, unsigned int fs_index, char * buf);
extern const char mtab_file[]; /* Defined in utility.c */
diff --git a/networking/tftp.c b/networking/tftp.c
index 309df36b3..466851c1b 100644
--- a/networking/tftp.c
+++ b/networking/tftp.c
@@ -116,7 +116,7 @@ static inline int tftp(int cmd, struct hostent *host,
len = sizeof(sa);
memset(&sa, 0, len);
- bind(socketfd, &sa, len);
+ bind(socketfd, (struct sockaddr *)&sa, len);
sa.sin_family = host->h_addrtype;
sa.sin_port = htons(port);
diff --git a/pivot_root.c b/pivot_root.c
index 4d7f8a3d1..ba26b9c58 100644
--- a/pivot_root.c
+++ b/pivot_root.c
@@ -9,30 +9,9 @@
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
-#include <sys/syscall.h>
-#include <linux/unistd.h>
#include "busybox.h"
-#ifndef __NR_pivot_root
-#warning This kernel does not support the pivot_root syscall
-#warning The pivot_root system call is being stubbed out...
-int pivot_root(const char * new_root,const char * put_old)
-{
- /* BusyBox was compiled against a kernel that did not support
- * the pivot_root system call. To make this application work,
- * you will need to recompile with a kernel supporting the
- * pivot_root system call.
- */
- fprintf(stderr, "\n\nTo make this application work, you will need to recompile\n");
- fprintf(stderr, "with a kernel supporting the pivot_root system call. -Erik\n\n");
- errno=ENOSYS;
- return -1;
-}
-#else
-static _syscall2(int,pivot_root,const char *,new_root,const char *,put_old)
-#endif
-
-
+extern int pivot_root(const char * new_root,const char * put_old);
int pivot_root_main(int argc, char **argv)
{
diff --git a/rmmod.c b/rmmod.c
index 36857e02c..7596d0232 100644
--- a/rmmod.c
+++ b/rmmod.c
@@ -26,16 +26,11 @@
#include <unistd.h>
#include <stdlib.h>
#include <getopt.h>
-#include <sys/syscall.h>
-#include <linux/unistd.h>
#include "busybox.h"
-#define __LIBRARY__
+extern int delete_module(const char * name);
-/* And the system call of the day is... */
-_syscall1(int, delete_module, const char *, name)
-
extern int rmmod_main(int argc, char **argv)
{
int n, ret = EXIT_SUCCESS;
diff --git a/swaponoff.c b/swaponoff.c
index 55022ae3b..ce0e2c6cc 100644
--- a/swaponoff.c
+++ b/swaponoff.c
@@ -29,13 +29,16 @@
#include <string.h>
#include <stdlib.h>
#include <sys/mount.h>
-#include <sys/syscall.h>
-#include <linux/unistd.h>
-#include "busybox.h"
-static _syscall2(int, swapon, const char *, path, int, flags);
-static _syscall1(int, swapoff, const char *, path);
+#if __GNU_LIBRARY__ < 5
+/* libc5 doesn't have sys/swap.h, define these here. */
+extern int swapon (__const char *__path, int __flags);
+extern int swapoff (__const char *__path);
+#else
+#include <sys/swap.h>
+#endif
+#include "busybox.h"
static int whichApp;
diff --git a/sysklogd/klogd.c b/sysklogd/klogd.c
index 95d4eea65..241a99175 100644
--- a/sysklogd/klogd.c
+++ b/sysklogd/klogd.c
@@ -40,20 +40,14 @@
#include <ctype.h>
#include <sys/syslog.h>
-#if ! defined __GLIBC__ && ! defined __UCLIBC__
-#include <sys/syscall.h>
-#include <linux/unistd.h>
-
-#ifndef __alpha__
-# define __NR_klogctl __NR_syslog
-static inline _syscall3(int, klogctl, int, type, char *, b, int, len);
-#else /* __alpha__ */
-#define klogctl syslog
-#endif
-
+#if __GNU_LIBRARY__ < 5
+# ifdef __alpha__
+# define klogctl syslog
+# endif
#else
# include <sys/klog.h>
#endif
+
#include "busybox.h"
static void klogd_signal(int sig)
diff --git a/tftp.c b/tftp.c
index 309df36b3..466851c1b 100644
--- a/tftp.c
+++ b/tftp.c
@@ -116,7 +116,7 @@ static inline int tftp(int cmd, struct hostent *host,
len = sizeof(sa);
memset(&sa, 0, len);
- bind(socketfd, &sa, len);
+ bind(socketfd, (struct sockaddr *)&sa, len);
sa.sin_family = host->h_addrtype;
sa.sin_port = htons(port);
diff --git a/update.c b/update.c
index b282b9e18..ce2b6cf08 100644
--- a/update.c
+++ b/update.c
@@ -33,14 +33,12 @@
#include <unistd.h> /* for getopt() */
#include <stdlib.h>
-
#if defined(__GLIBC__)
#include <sys/kdaemon.h>
#else
-#include <sys/syscall.h>
-#include <linux/unistd.h>
-static _syscall2(int, bdflush, int, func, int, data);
-#endif /* __GLIBC__ */
+extern int bdflush (int func, long int data);
+#endif /* __GLIBC__ */
+
#include "busybox.h"
static unsigned int sync_duration = 30;
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 @@
#include <getopt.h>
#if __GNU_LIBRARY__ < 5
-#include <sys/syscall.h>
-#include <linux/unistd.h>
-#ifndef __alpha__
-# define __NR_klogctl __NR_syslog
-static inline _syscall3(int, klogctl, int, type, char *, b, int, len);
-#else /* __alpha__ */
-#define klogctl syslog
-#endif
-
+# ifdef __alpha__
+# define klogctl syslog
+# endif
#else
# include <sys/klog.h>
#endif
+
#include "busybox.h"
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,
extern int umount (__const char *__special_file);
extern int umount2 (__const char *__special_file, int __flags);
-#include <sys/syscall.h>
-#include <linux/unistd.h>
-static int sysfs( int option, unsigned int fs_index, char * buf);
-_syscall3(int, sysfs, int, option, unsigned int, fs_index, char *, buf);
-
+extern int sysfs( int option, unsigned int fs_index, char * buf);
extern const char mtab_file[]; /* Defined in utility.c */
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 @@
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
-#include <sys/syscall.h>
-#include <linux/unistd.h>
#include "busybox.h"
-#ifndef __NR_pivot_root
-#warning This kernel does not support the pivot_root syscall
-#warning The pivot_root system call is being stubbed out...
-int pivot_root(const char * new_root,const char * put_old)
-{
- /* BusyBox was compiled against a kernel that did not support
- * the pivot_root system call. To make this application work,
- * you will need to recompile with a kernel supporting the
- * pivot_root system call.
- */
- fprintf(stderr, "\n\nTo make this application work, you will need to recompile\n");
- fprintf(stderr, "with a kernel supporting the pivot_root system call. -Erik\n\n");
- errno=ENOSYS;
- return -1;
-}
-#else
-static _syscall2(int,pivot_root,const char *,new_root,const char *,put_old)
-#endif
-
-
+extern int pivot_root(const char * new_root,const char * put_old);
int pivot_root_main(int argc, char **argv)
{
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 @@
#include <string.h>
#include <stdlib.h>
#include <sys/mount.h>
-#include <sys/syscall.h>
-#include <linux/unistd.h>
-#include "busybox.h"
-static _syscall2(int, swapon, const char *, path, int, flags);
-static _syscall1(int, swapoff, const char *, path);
+#if __GNU_LIBRARY__ < 5
+/* libc5 doesn't have sys/swap.h, define these here. */
+extern int swapon (__const char *__path, int __flags);
+extern int swapoff (__const char *__path);
+#else
+#include <sys/swap.h>
+#endif
+#include "busybox.h"
static int whichApp;