#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
" 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);
}
#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? */
char *adminscripts[] = { "/prerm", "/postrm", "/preinst", "/postinst",
"/conffiles", "/md5sums", "/shlibs", "/templates" };
char buf[1024], buf2[1024];
+ FILE *myfile = stdout;
DPRINTF("Unpacking %s\n", pkg->package);
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();
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;
}
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:
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;
}
#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)
#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? */
char *adminscripts[] = { "/prerm", "/postrm", "/preinst", "/postinst",
"/conffiles", "/md5sums", "/shlibs", "/templates" };
char buf[1024], buf2[1024];
+ FILE *myfile = stdout;
DPRINTF("Unpacking %s\n", pkg->package);
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();
};
int ask_confirmation(void);
+int klogctl(int type, char * b, int len);
#endif /* __LIBBB_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);
+extern int bdflush (int func, long int data);
#endif /* __GLIBC__ */
#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__ */
#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
#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. */
#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
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++;
#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)
};
int ask_confirmation(void);
+int klogctl(int type, char * b, int len);
#endif /* __LIBBB_H__ */
#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
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 */
/*
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:
};
-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;
#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
" 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);
}
#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;
#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
#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. */
#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
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++;
};
-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;
#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;
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 */
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);
#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)
{
#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;
#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;
#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)
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);
#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;
#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)
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 */
#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)
{
#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;