diff options
author | Erik Andersen | 1999-12-17 18:44:15 +0000 |
---|---|---|
committer | Erik Andersen | 1999-12-17 18:44:15 +0000 |
commit | 4d1d0113fd3309aac30b2dd1d443bf7c7d5f0a3d (patch) | |
tree | 1d18bbba8f8a1d78d7ff13e7a87ee2aab165125f | |
parent | 6da0ae8183a31d4faab745d534a363c7e66ef864 (diff) | |
download | busybox-4d1d0113fd3309aac30b2dd1d443bf7c7d5f0a3d.zip busybox-4d1d0113fd3309aac30b2dd1d443bf7c7d5f0a3d.tar.gz |
Reworked the source so it will compile and run under glibc 2.0.7
and linux kernel 2.0.36 (though the dubious reasons why someone
would want to do that defy imagination ;)
-Erik
-rw-r--r-- | Changelog | 4 | ||||
-rw-r--r-- | Makefile | 6 | ||||
-rw-r--r-- | archival/gunzip.c | 4 | ||||
-rw-r--r-- | archival/gzip.c | 4 | ||||
-rw-r--r-- | busybox.spec | 2 | ||||
-rw-r--r-- | coreutils/dd.c | 2 | ||||
-rw-r--r-- | coreutils/du.c | 5 | ||||
-rw-r--r-- | coreutils/tail.c | 1 | ||||
-rw-r--r-- | dd.c | 2 | ||||
-rw-r--r-- | du.c | 5 | ||||
-rw-r--r-- | examples/busybox.spec | 2 | ||||
-rw-r--r-- | fbset.c | 12 | ||||
-rw-r--r-- | gunzip.c | 4 | ||||
-rw-r--r-- | gzip.c | 4 | ||||
-rw-r--r-- | init.c | 7 | ||||
-rw-r--r-- | init/init.c | 7 | ||||
-rw-r--r-- | tail.c | 1 | ||||
-rw-r--r-- | util-linux/fbset.c | 12 | ||||
-rw-r--r-- | utility.c | 8 |
19 files changed, 71 insertions, 21 deletions
@@ -1,10 +1,12 @@ 0.40 * Added the -s option to du -beppu * Fixed an embarrasing segfault in head -beppu + * Fixed an bug in syslogd causing it to stop logging after 20 minutes. -erik * New Apps: lsmod, rmmod -erik * New Apps: fbset contributed by Randolph Chung <tausq@debian.org>. - * Fixed an bug in syslogd causing it to stop logging after 20 minutes. -erik * Fixed the embarrasing failure of the -p opition in the logger app. -erik + * Re-worked the whole source tree a bit so it will compile under glibc 2.0.7 + with the 2.0.x Linux kernel. -Erik Andersen @@ -17,7 +17,7 @@ PROG=busybox -VERSION=0.39 +VERSION=0.40 BUILDTIME=$(shell date "+%Y%m%d-%H%M") # Comment out the following to make a debuggable build @@ -31,8 +31,8 @@ DOSTATIC=false #This will choke on a non-debian system ARCH=`uname -m | sed -e 's/i.86/i386/' | sed -e 's/sparc.*/sparc/'` -GCCMAJVERSION=`$(CC) --version | sed -n "s/^\([0-9]\)\.\([0-9].*\)[\.].*/\1/p"` -GCCMINVERSION=`$(CC) --version | sed -n "s/^\([0-9]\)\.\([0-9].*\)[\.].*/\2/p"` +GCCMAJVERSION=$(shell $(CC) --version | sed -n "s/^\([^\.]*\).*/\1/p" ) +GCCMINVERSION=$(shell $(CC) --version | sed -n "s/^[^\.]*\.\([^\.]*\)[\.].*/\1/p" ) GCCSUPPORTSOPTSIZE=$(shell \ if ( test $(GCCMAJVERSION) -eq 2 ) ; then \ diff --git a/archival/gunzip.c b/archival/gunzip.c index a809fed..61391a3 100644 --- a/archival/gunzip.c +++ b/archival/gunzip.c @@ -805,7 +805,11 @@ int gunzip_main (int argc, char** argv) } /* Open output fille */ +#if (__GLIBC__ >= 2) && (__GLIBC_MINOR__ >= 1) outFileNum=open( ofname, O_RDWR|O_CREAT|O_EXCL|O_NOFOLLOW); +#else + outFileNum=open( ofname, O_RDWR|O_CREAT|O_EXCL); +#endif if (outFileNum < 0) { perror(ofname); do_exit(WARNING); diff --git a/archival/gzip.c b/archival/gzip.c index 983f673..76df3ad 100644 --- a/archival/gzip.c +++ b/archival/gzip.c @@ -1877,7 +1877,11 @@ int gzip_main(int argc, char ** argv) /* Open output fille */ +#if (__GLIBC__ >= 2) && (__GLIBC_MINOR__ >= 1) outFileNum=open( ofname, O_RDWR|O_CREAT|O_EXCL|O_NOFOLLOW); +#else + outFileNum=open( ofname, O_RDWR|O_CREAT|O_EXCL); +#endif if (outFileNum < 0) { perror(ofname); do_exit(WARNING); diff --git a/busybox.spec b/busybox.spec index 5e9df9d..a0351a0 100644 --- a/busybox.spec +++ b/busybox.spec @@ -1,5 +1,5 @@ Name: busybox -Version: 0.39 +Version: 0.40 Release: 1 Group: System/Utilities Summary: BusyBox is a tiny suite of Unix utilities in a multi-call binary. diff --git a/coreutils/dd.c b/coreutils/dd.c index 90c1004..bc01eed 100644 --- a/coreutils/dd.c +++ b/coreutils/dd.c @@ -33,7 +33,7 @@ #include <stdio.h> #include <fcntl.h> #include <errno.h> -#if (__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 1) +#if (__GLIBC__ >= 2) && (__GLIBC_MINOR__ >= 1) #include <inttypes.h> #else typedef unsigned long long int uintmax_t; diff --git a/coreutils/du.c b/coreutils/du.c index ed90bc4..ec03afd 100644 --- a/coreutils/du.c +++ b/coreutils/du.c @@ -44,9 +44,6 @@ static int du_depth = 0; static Display *print; static void -print_null(size_t size, char *filename) { } - -static void print_normal(size_t size, char *filename) { fprintf(stdout, "%-7d %s\n", (size >> 1), filename); @@ -143,4 +140,4 @@ du_main(int argc, char **argv) exit(0); } -/* $Id: du.c,v 1.7 1999/12/16 21:16:47 beppu Exp $ */ +/* $Id: du.c,v 1.8 1999/12/17 18:44:15 erik Exp $ */ diff --git a/coreutils/tail.c b/coreutils/tail.c index 7a64c4c..697177d 100644 --- a/coreutils/tail.c +++ b/coreutils/tail.c @@ -27,6 +27,7 @@ #include "internal.h" #include <stdio.h> +#include <stdarg.h> #include <assert.h> #include <errno.h> #include <sys/types.h> @@ -33,7 +33,7 @@ #include <stdio.h> #include <fcntl.h> #include <errno.h> -#if (__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 1) +#if (__GLIBC__ >= 2) && (__GLIBC_MINOR__ >= 1) #include <inttypes.h> #else typedef unsigned long long int uintmax_t; @@ -44,9 +44,6 @@ static int du_depth = 0; static Display *print; static void -print_null(size_t size, char *filename) { } - -static void print_normal(size_t size, char *filename) { fprintf(stdout, "%-7d %s\n", (size >> 1), filename); @@ -143,4 +140,4 @@ du_main(int argc, char **argv) exit(0); } -/* $Id: du.c,v 1.7 1999/12/16 21:16:47 beppu Exp $ */ +/* $Id: du.c,v 1.8 1999/12/17 18:44:15 erik Exp $ */ diff --git a/examples/busybox.spec b/examples/busybox.spec index 5e9df9d..a0351a0 100644 --- a/examples/busybox.spec +++ b/examples/busybox.spec @@ -1,5 +1,5 @@ Name: busybox -Version: 0.39 +Version: 0.40 Release: 1 Group: System/Utilities Summary: BusyBox is a tiny suite of Unix utilities in a multi-call binary. @@ -32,9 +32,14 @@ #include <ctype.h> #include <sys/ioctl.h> #include <linux/fb.h> +#include <linux/version.h> #define PERROR(ctx) do { perror(ctx); exit(1); } while(0) +#ifndef KERNEL_VERSION +#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) +#endif + #define DEFAULTFBDEV "/dev/fb0" #define DEFAULTFBMODE "/etc/fb.modes" @@ -185,10 +190,16 @@ static void showmode(struct fb_var_screeninfo *v) #endif printf("\tgeometry %u %u %u %u %u\n", v->xres, v->yres, v->xres_virtual, v->yres_virtual, v->bits_per_pixel); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,0) printf("\ttimings %u %u %u %u %u %u %u\n", v->pixclock, v->left_margin, v->right_margin, v->upper_margin, v->lower_margin, v->hsync_len, v->vsync_len); printf("\taccel %s\n", (v->accel_flags > 0 ? "true" : "false")); +#else + printf("\ttimings %lu %lu %lu %lu %lu %lu %lu\n", v->pixclock, v->left_margin, + v->right_margin, v->upper_margin, v->lower_margin, v->hsync_len, + v->vsync_len); +#endif printf("\trgba %u/%u,%u/%u,%u/%u,%u/%u\n", v->red.length, v->red.offset, v->green.length, v->green.offset, v->blue.length, v->blue.offset, v->transp.length, v->transp.offset); @@ -215,7 +226,6 @@ extern int fbset_main(int argc, char **argv) #endif { struct fb_var_screeninfo var, varset; - struct fb_fix_screeninfo fix; int fh, i; char *fbdev = DEFAULTFBDEV; char *modefile = DEFAULTFBMODE; @@ -805,7 +805,11 @@ int gunzip_main (int argc, char** argv) } /* Open output fille */ +#if (__GLIBC__ >= 2) && (__GLIBC_MINOR__ >= 1) outFileNum=open( ofname, O_RDWR|O_CREAT|O_EXCL|O_NOFOLLOW); +#else + outFileNum=open( ofname, O_RDWR|O_CREAT|O_EXCL); +#endif if (outFileNum < 0) { perror(ofname); do_exit(WARNING); @@ -1877,7 +1877,11 @@ int gzip_main(int argc, char ** argv) /* Open output fille */ +#if (__GLIBC__ >= 2) && (__GLIBC_MINOR__ >= 1) outFileNum=open( ofname, O_RDWR|O_CREAT|O_EXCL|O_NOFOLLOW); +#else + outFileNum=open( ofname, O_RDWR|O_CREAT|O_EXCL); +#endif if (outFileNum < 0) { perror(ofname); do_exit(WARNING); @@ -41,6 +41,7 @@ #include <linux/serial.h> /* for serial_struct */ #include <sys/vt.h> /* for vt_stat */ #include <sys/ioctl.h> +#include <linux/version.h> #ifdef BB_SYSLOGD #include <sys/syslog.h> #endif @@ -49,6 +50,10 @@ #error Sorry, I depend on the /proc filesystem right now. #endif +#ifndef KERNEL_VERSION +#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) +#endif + #define VT_PRIMARY "/dev/tty1" /* Primary virtual console */ #define VT_SECONDARY "/dev/tty2" /* Virtual console */ @@ -418,9 +423,11 @@ static void halt_signal(int sig) "The system is halted. Press CTRL-ALT-DEL or turn off power\r\n"); sync(); #ifndef DEBUG_INIT +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,0) if (sig == SIGUSR2) reboot(RB_POWER_OFF); else +#endif reboot(RB_HALT_SYSTEM); #endif exit(0); diff --git a/init/init.c b/init/init.c index 5203713..ba65f51 100644 --- a/init/init.c +++ b/init/init.c @@ -41,6 +41,7 @@ #include <linux/serial.h> /* for serial_struct */ #include <sys/vt.h> /* for vt_stat */ #include <sys/ioctl.h> +#include <linux/version.h> #ifdef BB_SYSLOGD #include <sys/syslog.h> #endif @@ -49,6 +50,10 @@ #error Sorry, I depend on the /proc filesystem right now. #endif +#ifndef KERNEL_VERSION +#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) +#endif + #define VT_PRIMARY "/dev/tty1" /* Primary virtual console */ #define VT_SECONDARY "/dev/tty2" /* Virtual console */ @@ -418,9 +423,11 @@ static void halt_signal(int sig) "The system is halted. Press CTRL-ALT-DEL or turn off power\r\n"); sync(); #ifndef DEBUG_INIT +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,0) if (sig == SIGUSR2) reboot(RB_POWER_OFF); else +#endif reboot(RB_HALT_SYSTEM); #endif exit(0); @@ -27,6 +27,7 @@ #include "internal.h" #include <stdio.h> +#include <stdarg.h> #include <assert.h> #include <errno.h> #include <sys/types.h> diff --git a/util-linux/fbset.c b/util-linux/fbset.c index 3f7e455..c29145e 100644 --- a/util-linux/fbset.c +++ b/util-linux/fbset.c @@ -32,9 +32,14 @@ #include <ctype.h> #include <sys/ioctl.h> #include <linux/fb.h> +#include <linux/version.h> #define PERROR(ctx) do { perror(ctx); exit(1); } while(0) +#ifndef KERNEL_VERSION +#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) +#endif + #define DEFAULTFBDEV "/dev/fb0" #define DEFAULTFBMODE "/etc/fb.modes" @@ -185,10 +190,16 @@ static void showmode(struct fb_var_screeninfo *v) #endif printf("\tgeometry %u %u %u %u %u\n", v->xres, v->yres, v->xres_virtual, v->yres_virtual, v->bits_per_pixel); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,0) printf("\ttimings %u %u %u %u %u %u %u\n", v->pixclock, v->left_margin, v->right_margin, v->upper_margin, v->lower_margin, v->hsync_len, v->vsync_len); printf("\taccel %s\n", (v->accel_flags > 0 ? "true" : "false")); +#else + printf("\ttimings %lu %lu %lu %lu %lu %lu %lu\n", v->pixclock, v->left_margin, + v->right_margin, v->upper_margin, v->lower_margin, v->hsync_len, + v->vsync_len); +#endif printf("\trgba %u/%u,%u/%u,%u/%u,%u/%u\n", v->red.length, v->red.offset, v->green.length, v->green.offset, v->blue.length, v->blue.offset, v->transp.length, v->transp.offset); @@ -215,7 +226,6 @@ extern int fbset_main(int argc, char **argv) #endif { struct fb_var_screeninfo var, varset; - struct fb_fix_screeninfo fix; int fh, i; char *fbdev = DEFAULTFBDEV; char *modefile = DEFAULTFBMODE; @@ -217,10 +217,12 @@ copyFile( const char *srcName, const char *destName, if (setModes == TRUE) { //fprintf(stderr, "Setting permissions for %s\n", destName); chmod(destName, srcStatBuf.st_mode); - if (followLinks == TRUE) - chown(destName, srcStatBuf.st_uid, srcStatBuf.st_gid); - else +#if (__GLIBC__ >= 2) && (__GLIBC_MINOR__ >= 1) + if (followLinks == FALSE) lchown(destName, srcStatBuf.st_uid, srcStatBuf.st_gid); + else +#endif + chown(destName, srcStatBuf.st_uid, srcStatBuf.st_gid); times.actime = srcStatBuf.st_atime; times.modtime = srcStatBuf.st_mtime; |