aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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 @@
44#include <sys/types.h> 44#include <sys/types.h>
45#include <stdlib.h> 45#include <stdlib.h>
46#include <unistd.h> 46#include <unistd.h>
47
48#if __GNU_LIBRARY__ < 5
49#include <sys/timex.h>
50extern int adjtimex(struct timex *buf);
51#else
47#include <sys/timex.h> 52#include <sys/timex.h>
53#endif
54
48#ifdef BB_VER 55#ifdef BB_VER
49#include "busybox.h" 56#include "busybox.h"
50#endif 57#endif
@@ -163,7 +170,7 @@ int main(int argc, char ** argv)
163 " return value: %d (%s)\n", 170 " return value: %d (%s)\n",
164 txc.constant, 171 txc.constant,
165 txc.precision, txc.tolerance, txc.tick, 172 txc.precision, txc.tolerance, txc.tick,
166 txc.time.tv_sec, txc.time.tv_usec, ret, descript); 173 (long)txc.time.tv_sec, (long)txc.time.tv_usec, ret, descript);
167 } 174 }
168 return (ret<0); 175 return (ret<0);
169} 176}
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 @@
12#include "busybox.h" 12#include "busybox.h"
13 13
14 14
15/* Stupid libc doesn't have a reliable way for use to know
16 * that libc5 is being used. Assume this is good enough */
17#if !defined __GLIBC__ && !defined __UCLIBC__
18#error It looks like you are using libc5, which does not support
19#error tfind(). tfind() is used by busybox dpkg.
20#error Please disable BB_DPKG. Sorry.
21#endif
22
23#define DEPENDSMAX 64 /* maximum number of depends we can handle */ 15#define DEPENDSMAX 64 /* maximum number of depends we can handle */
24 16
25/* Should we do full dependency checking? */ 17/* Should we do full dependency checking? */
@@ -591,6 +583,7 @@ static int dpkg_dounpack(package_t *pkg)
591 char *adminscripts[] = { "/prerm", "/postrm", "/preinst", "/postinst", 583 char *adminscripts[] = { "/prerm", "/postrm", "/preinst", "/postinst",
592 "/conffiles", "/md5sums", "/shlibs", "/templates" }; 584 "/conffiles", "/md5sums", "/shlibs", "/templates" };
593 char buf[1024], buf2[1024]; 585 char buf[1024], buf2[1024];
586 FILE *myfile = stdout;
594 587
595 DPRINTF("Unpacking %s\n", pkg->package); 588 DPRINTF("Unpacking %s\n", pkg->package);
596 589
@@ -622,9 +615,9 @@ static int dpkg_dounpack(package_t *pkg)
622 strcpy(lst_file, infodir); 615 strcpy(lst_file, infodir);
623 strcat(lst_file, pkg->package); 616 strcat(lst_file, pkg->package);
624 strcat(lst_file, ".list"); 617 strcat(lst_file, ".list");
625 outfp = freopen(lst_file, "w", stdout); 618 outfp = freopen(lst_file, "w", myfile);
626 deb_extract(dpkg_deb_list, NULL, pkg->file); 619 deb_extract(dpkg_deb_list, NULL, pkg->file);
627 stdout = freopen(NULL, "w", outfp); 620 myfile = freopen(NULL, "w", outfp);
628 621
629 printf("done\n"); 622 printf("done\n");
630 getchar(); 623 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)
151 out_part++; 151 out_part++;
152 } 152 }
153 153
154 fprintf(statusfp, "%d+%d records in\n", in_full, in_part); 154 fprintf(statusfp, "%ld+%ld records in\n", (long)in_full, (long)in_part);
155 fprintf(statusfp, "%d+%d records out\n", out_full, out_part); 155 fprintf(statusfp, "%ld+%ld records out\n", (long)out_full, (long)out_part);
156 156
157 return EXIT_SUCCESS; 157 return EXIT_SUCCESS;
158} 158}
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)
626 column += 10; 626 column += 10;
627 break; 627 break;
628 case LIST_NLINKS: 628 case LIST_NLINKS:
629 printf("%4d ", dn->dstat.st_nlink); 629 printf("%4ld ", (long)dn->dstat.st_nlink);
630 column += 10; 630 column += 10;
631 break; 631 break;
632 case LIST_ID_NAME: 632 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)
151 out_part++; 151 out_part++;
152 } 152 }
153 153
154 fprintf(statusfp, "%d+%d records in\n", in_full, in_part); 154 fprintf(statusfp, "%ld+%ld records in\n", (long)in_full, (long)in_part);
155 fprintf(statusfp, "%d+%d records out\n", out_full, out_part); 155 fprintf(statusfp, "%ld+%ld records out\n", (long)out_full, (long)out_part);
156 156
157 return EXIT_SUCCESS; 157 return EXIT_SUCCESS;
158} 158}
diff --git a/dmesg.c b/dmesg.c
index 2c85ed3e9..73de6d1ae 100644
--- a/dmesg.c
+++ b/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
27static 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
37int dmesg_main(int argc, char **argv) 32int 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 @@
12#include "busybox.h" 12#include "busybox.h"
13 13
14 14
15/* Stupid libc doesn't have a reliable way for use to know
16 * that libc5 is being used. Assume this is good enough */
17#if !defined __GLIBC__ && !defined __UCLIBC__
18#error It looks like you are using libc5, which does not support
19#error tfind(). tfind() is used by busybox dpkg.
20#error Please disable BB_DPKG. Sorry.
21#endif
22
23#define DEPENDSMAX 64 /* maximum number of depends we can handle */ 15#define DEPENDSMAX 64 /* maximum number of depends we can handle */
24 16
25/* Should we do full dependency checking? */ 17/* Should we do full dependency checking? */
@@ -591,6 +583,7 @@ static int dpkg_dounpack(package_t *pkg)
591 char *adminscripts[] = { "/prerm", "/postrm", "/preinst", "/postinst", 583 char *adminscripts[] = { "/prerm", "/postrm", "/preinst", "/postinst",
592 "/conffiles", "/md5sums", "/shlibs", "/templates" }; 584 "/conffiles", "/md5sums", "/shlibs", "/templates" };
593 char buf[1024], buf2[1024]; 585 char buf[1024], buf2[1024];
586 FILE *myfile = stdout;
594 587
595 DPRINTF("Unpacking %s\n", pkg->package); 588 DPRINTF("Unpacking %s\n", pkg->package);
596 589
@@ -622,9 +615,9 @@ static int dpkg_dounpack(package_t *pkg)
622 strcpy(lst_file, infodir); 615 strcpy(lst_file, infodir);
623 strcat(lst_file, pkg->package); 616 strcat(lst_file, pkg->package);
624 strcat(lst_file, ".list"); 617 strcat(lst_file, ".list");
625 outfp = freopen(lst_file, "w", stdout); 618 outfp = freopen(lst_file, "w", myfile);
626 deb_extract(dpkg_deb_list, NULL, pkg->file); 619 deb_extract(dpkg_deb_list, NULL, pkg->file);
627 stdout = freopen(NULL, "w", outfp); 620 myfile = freopen(NULL, "w", outfp);
628 621
629 printf("done\n"); 622 printf("done\n");
630 getchar(); 623 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 {
211}; 211};
212 212
213int ask_confirmation(void); 213int ask_confirmation(void);
214int klogctl(int type, char * b, int len);
214 215
215#endif /* __LIBBB_H__ */ 216#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;
115#if defined(__GLIBC__) 115#if defined(__GLIBC__)
116#include <sys/kdaemon.h> 116#include <sys/kdaemon.h>
117#else 117#else
118#include <sys/syscall.h> 118extern int bdflush (int func, long int data);
119#include <linux/unistd.h>
120static _syscall2(int, bdflush, int, func, int, data);
121#endif /* __GLIBC__ */ 119#endif /* __GLIBC__ */
122 120
123 121
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;
115#if defined(__GLIBC__) 115#if defined(__GLIBC__)
116#include <sys/kdaemon.h> 116#include <sys/kdaemon.h>
117#else 117#else
118#include <sys/syscall.h> 118extern int bdflush (int func, long int data);
119#include <linux/unistd.h>
120static _syscall2(int, bdflush, int, func, int, data);
121#endif /* __GLIBC__ */ 119#endif /* __GLIBC__ */
122 120
123 121
diff --git a/insmod.c b/insmod.c
index 0a7cb1e4a..ad1486b7b 100644
--- a/insmod.c
+++ b/insmod.c
@@ -119,7 +119,7 @@
119#ifndef MODUTILS_MODULE_H 119#ifndef MODUTILS_MODULE_H
120static const int MODUTILS_MODULE_H = 1; 120static const int MODUTILS_MODULE_H = 1;
121 121
122#ident "$Id: insmod.c,v 1.53 2001/03/22 19:01:16 andersen Exp $" 122#ident "$Id: insmod.c,v 1.54 2001/04/05 03:14:39 andersen Exp $"
123 123
124/* This file contains the structures used by the 2.0 and 2.1 kernels. 124/* This file contains the structures used by the 2.0 and 2.1 kernels.
125 We do not use the kernel headers directly because we do not wish 125 We do not use the kernel headers directly because we do not wish
@@ -325,7 +325,7 @@ int delete_module(const char *);
325#ifndef MODUTILS_OBJ_H 325#ifndef MODUTILS_OBJ_H
326static const int MODUTILS_OBJ_H = 1; 326static const int MODUTILS_OBJ_H = 1;
327 327
328#ident "$Id: insmod.c,v 1.53 2001/03/22 19:01:16 andersen Exp $" 328#ident "$Id: insmod.c,v 1.54 2001/04/05 03:14:39 andersen Exp $"
329 329
330/* The relocatable object is manipulated using elfin types. */ 330/* The relocatable object is manipulated using elfin types. */
331 331
@@ -1210,18 +1210,18 @@ int arch_create_got(struct obj_file *f)
1210 1210
1211#if defined(BB_USE_GOT_ENTRIES) 1211#if defined(BB_USE_GOT_ENTRIES)
1212 if (got_offset) { 1212 if (got_offset) {
1213 struct obj_section* relsec = obj_find_section(f, ".got"); 1213 struct obj_section* myrelsec = obj_find_section(f, ".got");
1214 1214
1215 if (relsec) { 1215 if (myrelsec) {
1216 obj_extend_section(relsec, got_offset); 1216 obj_extend_section(myrelsec, got_offset);
1217 } else { 1217 } else {
1218 relsec = obj_create_alloced_section(f, ".got", 1218 myrelsec = obj_create_alloced_section(f, ".got",
1219 BB_GOT_ENTRY_SIZE, 1219 BB_GOT_ENTRY_SIZE,
1220 got_offset); 1220 got_offset);
1221 assert(relsec); 1221 assert(myrelsec);
1222 } 1222 }
1223 1223
1224 ifile->got = relsec; 1224 ifile->got = myrelsec;
1225 } 1225 }
1226#endif 1226#endif
1227 1227
@@ -1748,19 +1748,19 @@ old_process_module_arguments(struct obj_file *f, int argc, char **argv)
1748 while (*q++ == ','); 1748 while (*q++ == ',');
1749 } else { 1749 } else {
1750 char *contents = f->sections[sym->secidx]->contents; 1750 char *contents = f->sections[sym->secidx]->contents;
1751 char *loc = contents + sym->value; 1751 char *myloc = contents + sym->value;
1752 char *r; /* To search for commas */ 1752 char *r; /* To search for commas */
1753 1753
1754 /* Break the string with comas */ 1754 /* Break the string with comas */
1755 while ((r = strchr(q, ',')) != (char *) NULL) { 1755 while ((r = strchr(q, ',')) != (char *) NULL) {
1756 *r++ = '\0'; 1756 *r++ = '\0';
1757 obj_string_patch(f, sym->secidx, loc - contents, q); 1757 obj_string_patch(f, sym->secidx, myloc - contents, q);
1758 loc += sizeof(char *); 1758 myloc += sizeof(char *);
1759 q = r; 1759 q = r;
1760 } 1760 }
1761 1761
1762 /* last part */ 1762 /* last part */
1763 obj_string_patch(f, sym->secidx, loc - contents, q); 1763 obj_string_patch(f, sym->secidx, myloc - contents, q);
1764 } 1764 }
1765 1765
1766 argc--, argv++; 1766 argc--, argv++;
diff --git a/klogd.c b/klogd.c
index 95d4eea65..241a99175 100644
--- a/klogd.c
+++ b/klogd.c
@@ -40,20 +40,14 @@
40#include <ctype.h> 40#include <ctype.h>
41#include <sys/syslog.h> 41#include <sys/syslog.h>
42 42
43#if ! defined __GLIBC__ && ! defined __UCLIBC__ 43#if __GNU_LIBRARY__ < 5
44#include <sys/syscall.h> 44# ifdef __alpha__
45#include <linux/unistd.h> 45# define klogctl syslog
46 46# endif
47#ifndef __alpha__
48# define __NR_klogctl __NR_syslog
49static inline _syscall3(int, klogctl, int, type, char *, b, int, len);
50#else /* __alpha__ */
51#define klogctl syslog
52#endif
53
54#else 47#else
55# include <sys/klog.h> 48# include <sys/klog.h>
56#endif 49#endif
50
57#include "busybox.h" 51#include "busybox.h"
58 52
59static void klogd_signal(int sig) 53static 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 {
211}; 211};
212 212
213int ask_confirmation(void); 213int ask_confirmation(void);
214int 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...
40int 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...
67int 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
40extern _syscall1(int, umount, const char *, special_file); 86 _syscall3(int, klogctl, int, type, char *, b, int, len);
41extern _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...
47int umount2(const char * special_file, int flags) 92int 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
60extern _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
64static 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/*
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)
626 column += 10; 626 column += 10;
627 break; 627 break;
628 case LIST_NLINKS: 628 case LIST_NLINKS:
629 printf("%4d ", dn->dstat.st_nlink); 629 printf("%4ld ", (long)dn->dstat.st_nlink);
630 column += 10; 630 column += 10;
631 break; 631 break;
632 case LIST_ID_NAME: 632 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
52}; 52};
53 53
54 54
55int query_module(const char *name, int which, void *buf, size_t bufsize, 55int query_module(const char *name, int which, void *buf, size_t bufsize, size_t *ret);
56 size_t *ret);
57 56
58/* Values for query_module's which. */ 57/* Values for query_module's which. */
59static const int QM_MODULES = 1; 58static 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 @@
44#include <sys/types.h> 44#include <sys/types.h>
45#include <stdlib.h> 45#include <stdlib.h>
46#include <unistd.h> 46#include <unistd.h>
47
48#if __GNU_LIBRARY__ < 5
49#include <sys/timex.h>
50extern int adjtimex(struct timex *buf);
51#else
47#include <sys/timex.h> 52#include <sys/timex.h>
53#endif
54
48#ifdef BB_VER 55#ifdef BB_VER
49#include "busybox.h" 56#include "busybox.h"
50#endif 57#endif
@@ -163,7 +170,7 @@ int main(int argc, char ** argv)
163 " return value: %d (%s)\n", 170 " return value: %d (%s)\n",
164 txc.constant, 171 txc.constant,
165 txc.precision, txc.tolerance, txc.tick, 172 txc.precision, txc.tolerance, txc.tick,
166 txc.time.tv_sec, txc.time.tv_usec, ret, descript); 173 (long)txc.time.tv_sec, (long)txc.time.tv_usec, ret, descript);
167 } 174 }
168 return (ret<0); 175 return (ret<0);
169} 176}
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 @@
33#include <unistd.h> /* for getopt() */ 33#include <unistd.h> /* for getopt() */
34#include <stdlib.h> 34#include <stdlib.h>
35 35
36
37#if defined(__GLIBC__) 36#if defined(__GLIBC__)
38#include <sys/kdaemon.h> 37#include <sys/kdaemon.h>
39#else 38#else
40#include <sys/syscall.h> 39extern int bdflush (int func, long int data);
41#include <linux/unistd.h> 40#endif /* __GLIBC__ */
42static _syscall2(int, bdflush, int, func, int, data); 41
43#endif /* __GLIBC__ */
44#include "busybox.h" 42#include "busybox.h"
45 43
46static unsigned int sync_duration = 30; 44static 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 @@
119#ifndef MODUTILS_MODULE_H 119#ifndef MODUTILS_MODULE_H
120static const int MODUTILS_MODULE_H = 1; 120static const int MODUTILS_MODULE_H = 1;
121 121
122#ident "$Id: insmod.c,v 1.53 2001/03/22 19:01:16 andersen Exp $" 122#ident "$Id: insmod.c,v 1.54 2001/04/05 03:14:39 andersen Exp $"
123 123
124/* This file contains the structures used by the 2.0 and 2.1 kernels. 124/* This file contains the structures used by the 2.0 and 2.1 kernels.
125 We do not use the kernel headers directly because we do not wish 125 We do not use the kernel headers directly because we do not wish
@@ -325,7 +325,7 @@ int delete_module(const char *);
325#ifndef MODUTILS_OBJ_H 325#ifndef MODUTILS_OBJ_H
326static const int MODUTILS_OBJ_H = 1; 326static const int MODUTILS_OBJ_H = 1;
327 327
328#ident "$Id: insmod.c,v 1.53 2001/03/22 19:01:16 andersen Exp $" 328#ident "$Id: insmod.c,v 1.54 2001/04/05 03:14:39 andersen Exp $"
329 329
330/* The relocatable object is manipulated using elfin types. */ 330/* The relocatable object is manipulated using elfin types. */
331 331
@@ -1210,18 +1210,18 @@ int arch_create_got(struct obj_file *f)
1210 1210
1211#if defined(BB_USE_GOT_ENTRIES) 1211#if defined(BB_USE_GOT_ENTRIES)
1212 if (got_offset) { 1212 if (got_offset) {
1213 struct obj_section* relsec = obj_find_section(f, ".got"); 1213 struct obj_section* myrelsec = obj_find_section(f, ".got");
1214 1214
1215 if (relsec) { 1215 if (myrelsec) {
1216 obj_extend_section(relsec, got_offset); 1216 obj_extend_section(myrelsec, got_offset);
1217 } else { 1217 } else {
1218 relsec = obj_create_alloced_section(f, ".got", 1218 myrelsec = obj_create_alloced_section(f, ".got",
1219 BB_GOT_ENTRY_SIZE, 1219 BB_GOT_ENTRY_SIZE,
1220 got_offset); 1220 got_offset);
1221 assert(relsec); 1221 assert(myrelsec);
1222 } 1222 }
1223 1223
1224 ifile->got = relsec; 1224 ifile->got = myrelsec;
1225 } 1225 }
1226#endif 1226#endif
1227 1227
@@ -1748,19 +1748,19 @@ old_process_module_arguments(struct obj_file *f, int argc, char **argv)
1748 while (*q++ == ','); 1748 while (*q++ == ',');
1749 } else { 1749 } else {
1750 char *contents = f->sections[sym->secidx]->contents; 1750 char *contents = f->sections[sym->secidx]->contents;
1751 char *loc = contents + sym->value; 1751 char *myloc = contents + sym->value;
1752 char *r; /* To search for commas */ 1752 char *r; /* To search for commas */
1753 1753
1754 /* Break the string with comas */ 1754 /* Break the string with comas */
1755 while ((r = strchr(q, ',')) != (char *) NULL) { 1755 while ((r = strchr(q, ',')) != (char *) NULL) {
1756 *r++ = '\0'; 1756 *r++ = '\0';
1757 obj_string_patch(f, sym->secidx, loc - contents, q); 1757 obj_string_patch(f, sym->secidx, myloc - contents, q);
1758 loc += sizeof(char *); 1758 myloc += sizeof(char *);
1759 q = r; 1759 q = r;
1760 } 1760 }
1761 1761
1762 /* last part */ 1762 /* last part */
1763 obj_string_patch(f, sym->secidx, loc - contents, q); 1763 obj_string_patch(f, sym->secidx, myloc - contents, q);
1764 } 1764 }
1765 1765
1766 argc--, argv++; 1766 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
52}; 52};
53 53
54 54
55int query_module(const char *name, int which, void *buf, size_t bufsize, 55int query_module(const char *name, int which, void *buf, size_t bufsize, size_t *ret);
56 size_t *ret);
57 56
58/* Values for query_module's which. */ 57/* Values for query_module's which. */
59static const int QM_MODULES = 1; 58static 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 @@
26#include <unistd.h> 26#include <unistd.h>
27#include <stdlib.h> 27#include <stdlib.h>
28#include <getopt.h> 28#include <getopt.h>
29#include <sys/syscall.h>
30#include <linux/unistd.h>
31#include "busybox.h" 29#include "busybox.h"
32#define __LIBRARY__
33 30
31extern int delete_module(const char * name);
34 32
35 33
36/* And the system call of the day is... */
37_syscall1(int, delete_module, const char *, name)
38
39extern int rmmod_main(int argc, char **argv) 34extern int rmmod_main(int argc, char **argv)
40{ 35{
41 int n, ret = EXIT_SUCCESS; 36 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,
84extern int umount (__const char *__special_file); 84extern int umount (__const char *__special_file);
85extern int umount2 (__const char *__special_file, int __flags); 85extern int umount2 (__const char *__special_file, int __flags);
86 86
87#include <sys/syscall.h> 87extern int sysfs( int option, unsigned int fs_index, char * buf);
88#include <linux/unistd.h>
89static 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
93extern const char mtab_file[]; /* Defined in utility.c */ 89extern const char mtab_file[]; /* Defined in utility.c */
94 90
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,
116 len = sizeof(sa); 116 len = sizeof(sa);
117 117
118 memset(&sa, 0, len); 118 memset(&sa, 0, len);
119 bind(socketfd, &sa, len); 119 bind(socketfd, (struct sockaddr *)&sa, len);
120 120
121 sa.sin_family = host->h_addrtype; 121 sa.sin_family = host->h_addrtype;
122 sa.sin_port = htons(port); 122 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 @@
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 14extern 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...
19int 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
32static _syscall2(int,pivot_root,const char *,new_root,const char *,put_old)
33#endif
34
35
36 15
37int pivot_root_main(int argc, char **argv) 16int pivot_root_main(int argc, char **argv)
38{ 17{
diff --git a/rmmod.c b/rmmod.c
index 36857e02c..7596d0232 100644
--- a/rmmod.c
+++ b/rmmod.c
@@ -26,16 +26,11 @@
26#include <unistd.h> 26#include <unistd.h>
27#include <stdlib.h> 27#include <stdlib.h>
28#include <getopt.h> 28#include <getopt.h>
29#include <sys/syscall.h>
30#include <linux/unistd.h>
31#include "busybox.h" 29#include "busybox.h"
32#define __LIBRARY__
33 30
31extern int delete_module(const char * name);
34 32
35 33
36/* And the system call of the day is... */
37_syscall1(int, delete_module, const char *, name)
38
39extern int rmmod_main(int argc, char **argv) 34extern int rmmod_main(int argc, char **argv)
40{ 35{
41 int n, ret = EXIT_SUCCESS; 36 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 @@
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
36static _syscall2(int, swapon, const char *, path, int, flags); 33#if __GNU_LIBRARY__ < 5
37static _syscall1(int, swapoff, const char *, path); 34/* libc5 doesn't have sys/swap.h, define these here. */
35extern int swapon (__const char *__path, int __flags);
36extern int swapoff (__const char *__path);
37#else
38#include <sys/swap.h>
39#endif
38 40
41#include "busybox.h"
39 42
40static int whichApp; 43static int whichApp;
41 44
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 @@
40#include <ctype.h> 40#include <ctype.h>
41#include <sys/syslog.h> 41#include <sys/syslog.h>
42 42
43#if ! defined __GLIBC__ && ! defined __UCLIBC__ 43#if __GNU_LIBRARY__ < 5
44#include <sys/syscall.h> 44# ifdef __alpha__
45#include <linux/unistd.h> 45# define klogctl syslog
46 46# endif
47#ifndef __alpha__
48# define __NR_klogctl __NR_syslog
49static inline _syscall3(int, klogctl, int, type, char *, b, int, len);
50#else /* __alpha__ */
51#define klogctl syslog
52#endif
53
54#else 47#else
55# include <sys/klog.h> 48# include <sys/klog.h>
56#endif 49#endif
50
57#include "busybox.h" 51#include "busybox.h"
58 52
59static void klogd_signal(int sig) 53static 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,
116 len = sizeof(sa); 116 len = sizeof(sa);
117 117
118 memset(&sa, 0, len); 118 memset(&sa, 0, len);
119 bind(socketfd, &sa, len); 119 bind(socketfd, (struct sockaddr *)&sa, len);
120 120
121 sa.sin_family = host->h_addrtype; 121 sa.sin_family = host->h_addrtype;
122 sa.sin_port = htons(port); 122 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 @@
33#include <unistd.h> /* for getopt() */ 33#include <unistd.h> /* for getopt() */
34#include <stdlib.h> 34#include <stdlib.h>
35 35
36
37#if defined(__GLIBC__) 36#if defined(__GLIBC__)
38#include <sys/kdaemon.h> 37#include <sys/kdaemon.h>
39#else 38#else
40#include <sys/syscall.h> 39extern int bdflush (int func, long int data);
41#include <linux/unistd.h> 40#endif /* __GLIBC__ */
42static _syscall2(int, bdflush, int, func, int, data); 41
43#endif /* __GLIBC__ */
44#include "busybox.h" 42#include "busybox.h"
45 43
46static unsigned int sync_duration = 30; 44static 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 @@
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
27static 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
37int dmesg_main(int argc, char **argv) 32int 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,
84extern int umount (__const char *__special_file); 84extern int umount (__const char *__special_file);
85extern int umount2 (__const char *__special_file, int __flags); 85extern int umount2 (__const char *__special_file, int __flags);
86 86
87#include <sys/syscall.h> 87extern int sysfs( int option, unsigned int fs_index, char * buf);
88#include <linux/unistd.h>
89static 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
93extern const char mtab_file[]; /* Defined in utility.c */ 89extern 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 14extern 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...
19int 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
32static _syscall2(int,pivot_root,const char *,new_root,const char *,put_old)
33#endif
34
35
36 15
37int pivot_root_main(int argc, char **argv) 16int 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
36static _syscall2(int, swapon, const char *, path, int, flags); 33#if __GNU_LIBRARY__ < 5
37static _syscall1(int, swapoff, const char *, path); 34/* libc5 doesn't have sys/swap.h, define these here. */
35extern int swapon (__const char *__path, int __flags);
36extern int swapoff (__const char *__path);
37#else
38#include <sys/swap.h>
39#endif
38 40
41#include "busybox.h"
39 42
40static int whichApp; 43static int whichApp;
41 44