aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2003-07-22 08:56:55 +0000
committerEric Andersen <andersen@codepoet.org>2003-07-22 08:56:55 +0000
commit85e5e72bc1acd9d58c11bde6e14c8270cd9f169f (patch)
tree9971c6951256dd0bba5ff2a7db08ed6f65ef218d
parent0a14c9f924eaf6a64e78959a190d187d646b3c0c (diff)
downloadbusybox-w32-85e5e72bc1acd9d58c11bde6e14c8270cd9f169f.tar.gz
busybox-w32-85e5e72bc1acd9d58c11bde6e14c8270cd9f169f.tar.bz2
busybox-w32-85e5e72bc1acd9d58c11bde6e14c8270cd9f169f.zip
Remove remaining libc5 support code
-rw-r--r--coreutils/chgrp.c2
-rw-r--r--coreutils/chown.c2
-rw-r--r--include/busybox.h17
-rw-r--r--include/libbb.h12
-rw-r--r--init/init.c8
-rw-r--r--init/reboot.c13
-rw-r--r--libbb/Makefile.in4
-rw-r--r--libbb/dirname.c69
-rw-r--r--libbb/interface.c7
-rw-r--r--libbb/libc5.c184
-rw-r--r--libbb/module_syscalls.c10
-rw-r--r--libbb/syscalls.c10
-rw-r--r--libpwdgrp/setgroups.c11
-rw-r--r--miscutils/adjtimex.c7
-rw-r--r--miscutils/dutmp.c17
-rw-r--r--miscutils/update.c7
-rw-r--r--modutils/insmod.c6
-rw-r--r--networking/ping.c81
-rw-r--r--networking/traceroute.c91
-rw-r--r--networking/wget.c15
-rw-r--r--shell/cmdedit.c5
-rw-r--r--sysklogd/klogd.c9
-rw-r--r--sysklogd/logread.c7
-rw-r--r--sysklogd/syslogd.c6
-rw-r--r--util-linux/dmesg.c9
-rw-r--r--util-linux/swaponoff.c7
26 files changed, 35 insertions, 581 deletions
diff --git a/coreutils/chgrp.c b/coreutils/chgrp.c
index 78593ae76..2f3fa4197 100644
--- a/coreutils/chgrp.c
+++ b/coreutils/chgrp.c
@@ -29,7 +29,7 @@
29#include <unistd.h> 29#include <unistd.h>
30#include "busybox.h" 30#include "busybox.h"
31 31
32/* Don't use lchown for libc5 or glibc older then 2.1.x */ 32/* Don't use lchown glibc older then 2.1.x */
33#if (__GLIBC__ <= 2) && (__GLIBC_MINOR__ < 1) 33#if (__GLIBC__ <= 2) && (__GLIBC_MINOR__ < 1)
34#define lchown chown 34#define lchown chown
35#endif 35#endif
diff --git a/coreutils/chown.c b/coreutils/chown.c
index 5b1b89e79..7b9ea9175 100644
--- a/coreutils/chown.c
+++ b/coreutils/chown.c
@@ -30,7 +30,7 @@
30#include <string.h> 30#include <string.h>
31#include "busybox.h" 31#include "busybox.h"
32 32
33/* Don't use lchown for libc5 or glibc older then 2.1.x */ 33/* Don't use lchown for glibc older then 2.1.x */
34#if (__GLIBC__ <= 2) && (__GLIBC_MINOR__ < 1) 34#if (__GLIBC__ <= 2) && (__GLIBC_MINOR__ < 1)
35#define lchown chown 35#define lchown chown
36#endif 36#endif
diff --git a/include/busybox.h b/include/busybox.h
index 8285494ef..aaa844f43 100644
--- a/include/busybox.h
+++ b/include/busybox.h
@@ -31,6 +31,12 @@
31#include <sys/stat.h> 31#include <sys/stat.h>
32#include <sys/types.h> 32#include <sys/types.h>
33 33
34#if __GNU_LIBRARY__ < 5
35#ifndef __dietlibc__
36#error "Sorry, libc5 is not supported"
37#endif
38#endif
39
34#define BB_BANNER "BusyBox v" BB_VER " (" BB_BT ")" 40#define BB_BANNER "BusyBox v" BB_VER " (" BB_BT ")"
35 41
36#ifdef DMALLOC 42#ifdef DMALLOC
@@ -93,17 +99,6 @@ extern const struct BB_applet applets[];
93#endif 99#endif
94 100
95 101
96/* Bit map related macros -- libc5 doens't provide these... sigh. */
97#ifndef setbit
98#ifndef NBBY
99#define NBBY CHAR_BIT
100#endif
101#define setbit(a,i) ((a)[(i)/NBBY] |= 1<<((i)%NBBY))
102#define clrbit(a,i) ((a)[(i)/NBBY] &= ~(1<<((i)%NBBY)))
103#define isset(a,i) ((a)[(i)/NBBY] & (1<<((i)%NBBY)))
104#define isclr(a,i) (((a)[(i)/NBBY] & (1<<((i)%NBBY))) == 0)
105#endif
106
107#ifndef RB_POWER_OFF 102#ifndef RB_POWER_OFF
108/* Stop system and switch power off if possible. */ 103/* Stop system and switch power off if possible. */
109#define RB_POWER_OFF 0x4321fedc 104#define RB_POWER_OFF 0x4321fedc
diff --git a/include/libbb.h b/include/libbb.h
index 6bd096c7f..a4d8c7196 100644
--- a/include/libbb.h
+++ b/include/libbb.h
@@ -57,18 +57,6 @@
57# define inline 57# define inline
58#endif 58#endif
59 59
60#if (__GNU_LIBRARY__ < 5) && (!defined __dietlibc__)
61/* libc5 doesn't define socklen_t */
62#ifndef _SOCKLEN_T
63#define _SOCKLEN_T
64typedef unsigned int socklen_t;
65#endif
66/* libc5 doesn't implement BSD 4.4 daemon() */
67extern int daemon (int nochdir, int noclose);
68/* libc5 doesn't implement strtok_r */
69char *strtok_r(char *s, const char *delim, char **ptrptr);
70#endif
71
72/* Convenience macros to test the version of gcc. */ 60/* Convenience macros to test the version of gcc. */
73#if defined __GNUC__ && defined __GNUC_MINOR__ 61#if defined __GNUC__ && defined __GNUC_MINOR__
74# define __GNUC_PREREQ(maj, min) \ 62# define __GNUC_PREREQ(maj, min) \
diff --git a/init/init.c b/init/init.c
index 69ce4b2c9..1f0bd4aec 100644
--- a/init/init.c
+++ b/init/init.c
@@ -42,6 +42,7 @@
42#include <sys/mount.h> 42#include <sys/mount.h>
43#include <sys/types.h> 43#include <sys/types.h>
44#include <sys/wait.h> 44#include <sys/wait.h>
45#include <sys/reboot.h>
45#include "busybox.h" 46#include "busybox.h"
46 47
47#include "init_shared.h" 48#include "init_shared.h"
@@ -50,9 +51,6 @@
50#ifdef CONFIG_SYSLOGD 51#ifdef CONFIG_SYSLOGD
51# include <sys/syslog.h> 52# include <sys/syslog.h>
52#endif 53#endif
53#if (__GNU_LIBRARY__ > 5) || defined(__dietlibc__)
54#include <sys/reboot.h>
55#endif
56 54
57 55
58#if defined(__UCLIBC__) && !defined(__UCLIBC_HAS_MMU__) 56#if defined(__UCLIBC__) && !defined(__UCLIBC_HAS_MMU__)
@@ -665,11 +663,7 @@ static void init_reboot(unsigned long magic)
665 * linux/kernel/sys.c, which can cause the machine to panic when 663 * linux/kernel/sys.c, which can cause the machine to panic when
666 * the init process is killed.... */ 664 * the init process is killed.... */
667 if ((pid = fork()) == 0) { 665 if ((pid = fork()) == 0) {
668#if (__GNU_LIBRARY__ > 5) || defined(__dietlibc__)
669 reboot(magic); 666 reboot(magic);
670#else
671 reboot(0xfee1dead, 672274793, magic);
672#endif
673 _exit(0); 667 _exit(0);
674 } 668 }
675 waitpid (pid, NULL, 0); 669 waitpid (pid, NULL, 0);
diff --git a/init/reboot.c b/init/reboot.c
index e9f9ff831..5ca8b588a 100644
--- a/init/reboot.c
+++ b/init/reboot.c
@@ -25,18 +25,11 @@
25#include <stdlib.h> 25#include <stdlib.h>
26#include <unistd.h> 26#include <unistd.h>
27#include <getopt.h> 27#include <getopt.h>
28 28#include <sys/reboot.h>
29#include "busybox.h" 29#include "busybox.h"
30#include "init_shared.h" 30#include "init_shared.h"
31 31
32 32
33#if (__GNU_LIBRARY__ > 5) || defined(__dietlibc__)
34 #include <sys/reboot.h>
35 #define init_reboot(magic) reboot(magic)
36#else
37 #define init_reboot(magic) reboot(0xfee1dead, 672274793, magic)
38#endif
39
40#ifndef RB_ENABLE_CAD 33#ifndef RB_ENABLE_CAD
41static const int RB_ENABLE_CAD = 0x89abcdef; 34static const int RB_ENABLE_CAD = 0x89abcdef;
42static const int RB_AUTOBOOT = 0x01234567; 35static const int RB_AUTOBOOT = 0x01234567;
@@ -57,7 +50,7 @@ extern int reboot_main(int argc, char **argv)
57 setpgrp(); 50 setpgrp();
58 51
59 /* Allow Ctrl-Alt-Del to reboot system. */ 52 /* Allow Ctrl-Alt-Del to reboot system. */
60 init_reboot(RB_ENABLE_CAD); 53 reboot(RB_ENABLE_CAD);
61 54
62 message(CONSOLE|LOG, "\n\rThe system is going down NOW !!\n"); 55 message(CONSOLE|LOG, "\n\rThe system is going down NOW !!\n");
63 sync(); 56 sync();
@@ -74,7 +67,7 @@ extern int reboot_main(int argc, char **argv)
74 67
75 sync(); 68 sync();
76 69
77 init_reboot(RB_AUTOBOOT); 70 reboot(RB_AUTOBOOT);
78 return 0; /* Shrug */ 71 return 0; /* Shrug */
79#else 72#else
80 return kill_init(SIGTERM); 73 return kill_init(SIGTERM);
diff --git a/libbb/Makefile.in b/libbb/Makefile.in
index cde3fb2fa..c4886e3ff 100644
--- a/libbb/Makefile.in
+++ b/libbb/Makefile.in
@@ -27,12 +27,12 @@ LIBBB_SRC:= \
27 arith.c bb_asprintf.c ask_confirmation.c change_identity.c chomp.c \ 27 arith.c bb_asprintf.c ask_confirmation.c change_identity.c chomp.c \
28 compare_string_array.c concat_path_file.c copy_file.c \ 28 compare_string_array.c concat_path_file.c copy_file.c \
29 copyfd.c correct_password.c create_icmp_socket.c \ 29 copyfd.c correct_password.c create_icmp_socket.c \
30 create_icmp6_socket.c device_open.c dirname.c dump.c error_msg.c \ 30 create_icmp6_socket.c device_open.c dump.c error_msg.c \
31 error_msg_and_die.c find_mount_point.c find_pid_by_name.c \ 31 error_msg_and_die.c find_mount_point.c find_pid_by_name.c \
32 find_root_device.c fgets_str.c full_read.c full_write.c get_console.c \ 32 find_root_device.c fgets_str.c full_read.c full_write.c get_console.c \
33 get_last_path_component.c get_line_from_file.c herror_msg.c \ 33 get_last_path_component.c get_line_from_file.c herror_msg.c \
34 herror_msg_and_die.c human_readable.c inet_common.c inode_hash.c \ 34 herror_msg_and_die.c human_readable.c inet_common.c inode_hash.c \
35 interface.c isdirectory.c kernel_version.c last_char_is.c libc5.c \ 35 interface.c isdirectory.c kernel_version.c last_char_is.c \
36 llist_add_to.c login.c loop.c make_directory.c mode_string.c \ 36 llist_add_to.c login.c loop.c make_directory.c mode_string.c \
37 module_syscalls.c mtab.c mtab_file.c my_getgrgid.c my_getgrnam.c \ 37 module_syscalls.c mtab.c mtab_file.c my_getgrgid.c my_getgrnam.c \
38 my_getpwnam.c my_getpwnamegid.c my_getpwuid.c obscure.c parse_mode.c \ 38 my_getpwnam.c my_getpwnamegid.c my_getpwuid.c obscure.c parse_mode.c \
diff --git a/libbb/dirname.c b/libbb/dirname.c
deleted file mode 100644
index 81298730b..000000000
--- a/libbb/dirname.c
+++ /dev/null
@@ -1,69 +0,0 @@
1/* vi: set sw=4 ts=4: */
2/*
3 * dirname implementation for busybox (for libc's missing one)
4 *
5 * Copyright (C) 2003 Manuel Novoa III <mjn3@codepoet.org>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 *
21 */
22
23/* Note: The previous busybox implementation did not handle NULL path
24 * and also moved a pointer before path, which is not portable in C.
25 * So I replaced it with my uClibc version.
26 */
27
28#include <string.h>
29#include "libbb.h"
30
31#if __GNU_LIBRARY__ < 5
32
33extern
34char *dirname(char *path)
35{
36 static const char null_or_empty_or_noslash[] = ".";
37 register char *s;
38 register char *last;
39 char *first;
40
41 last = s = path;
42
43 if (s != NULL) {
44
45 LOOP:
46 while (*s && (*s != '/')) ++s;
47 first = s;
48 while (*s == '/') ++s;
49 if (*s) {
50 last = first;
51 goto LOOP;
52 }
53
54 if (last == path) {
55 if (*last != '/') {
56 goto DOT;
57 }
58 if ((*++last == '/') && (last[1] == 0)) {
59 ++last;
60 }
61 }
62 *last = 0;
63 return path;
64 }
65 DOT:
66 return (char *) null_or_empty_or_noslash;
67}
68
69#endif
diff --git a/libbb/interface.c b/libbb/interface.c
index fb3a42a0c..46c3ba96c 100644
--- a/libbb/interface.c
+++ b/libbb/interface.c
@@ -15,7 +15,7 @@
15 * that either displays or sets the characteristics of 15 * that either displays or sets the characteristics of
16 * one or more of the system's networking interfaces. 16 * one or more of the system's networking interfaces.
17 * 17 *
18 * Version: $Id: interface.c,v 1.16 2003/07/14 21:20:55 andersen Exp $ 18 * Version: $Id: interface.c,v 1.17 2003/07/22 08:56:46 andersen Exp $
19 * 19 *
20 * Author: Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org> 20 * Author: Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org>
21 * and others. Copyright 1993 MicroWalt Corporation 21 * and others. Copyright 1993 MicroWalt Corporation
@@ -76,6 +76,7 @@
76#include <fcntl.h> 76#include <fcntl.h>
77#include <ctype.h> 77#include <ctype.h>
78#include <sys/ioctl.h> 78#include <sys/ioctl.h>
79#include <sys/types.h>
79#include <net/if.h> 80#include <net/if.h>
80#include <net/if_arp.h> 81#include <net/if_arp.h>
81#include "libbb.h" 82#include "libbb.h"
@@ -88,10 +89,6 @@
88 89
89static int procnetdev_vsn = 1; 90static int procnetdev_vsn = 1;
90 91
91/* Ugh. But libc5 doesn't provide POSIX types. */
92#include <asm/types.h>
93
94
95#ifdef HAVE_HWSLIP 92#ifdef HAVE_HWSLIP
96#include <net/if_slip.h> 93#include <net/if_slip.h>
97#endif 94#endif
diff --git a/libbb/libc5.c b/libbb/libc5.c
deleted file mode 100644
index ac7919626..000000000
--- a/libbb/libc5.c
+++ /dev/null
@@ -1,184 +0,0 @@
1/* vi: set sw=4 ts=4: */
2
3
4#include <features.h>
5#include <string.h>
6#include <stdio.h>
7#include <fcntl.h>
8#include <paths.h>
9#include <unistd.h>
10
11
12#if ! defined __dietlibc__ && __GNU_LIBRARY__ < 5
13
14/*
15 * Some systems already have updwtmp(). Some don't... This is
16 * the updwtmp() implementation from uClibc, Copyright 2002 by
17 * Erik Andersen <andersen@codepoet.org>
18 */
19extern void updwtmp(const char *wtmp_file, const struct utmp *lutmp)
20{
21 int fd;
22
23 fd = open(wtmp_file, O_APPEND | O_WRONLY, 0);
24 if (fd >= 0) {
25 if (lockf(fd, F_LOCK, 0)==0) {
26 write(fd, (const char *) lutmp, sizeof(struct utmp));
27 lockf(fd, F_ULOCK, 0);
28 close(fd);
29 }
30 }
31}
32
33/* Copyright (C) 1991 Free Software Foundation, Inc.
34This file is part of the GNU C Library.
35
36The GNU C Library is free software; you can redistribute it and/or
37modify it under the terms of the GNU Library General Public License as
38published by the Free Software Foundation; either version 2 of the
39License, or (at your option) any later version.
40
41The GNU C Library is distributed in the hope that it will be useful,
42but WITHOUT ANY WARRANTY; without even the implied warranty of
43MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
44Library General Public License for more details.
45
46You should have received a copy of the GNU Library General Public
47License along with the GNU C Library; see the file COPYING.LIB. If
48not, write to the Free Software Foundation, Inc., 675 Mass Ave,
49Cambridge, MA 02139, USA. */
50
51/*
52 * Modified by Manuel Novoa III Mar 1, 2001
53 *
54 * Converted original strtok.c code of strtok to __strtok_r.
55 * Cleaned up logic and reduced code size.
56 */
57
58
59char *strtok_r(char *s, const char *delim, char **save_ptr)
60{
61 char *token;
62
63 token = 0; /* Initialize to no token. */
64
65 if (s == 0) { /* If not first time called... */
66 s = *save_ptr; /* restart from where we left off. */
67 }
68
69 if (s != 0) { /* If not finished... */
70 *save_ptr = 0;
71
72 s += strspn(s, delim); /* Skip past any leading delimiters. */
73 if (*s != '\0') { /* We have a token. */
74 token = s;
75 *save_ptr = strpbrk(token, delim); /* Find token's end. */
76 if (*save_ptr != 0) {
77 /* Terminate the token and make SAVE_PTR point past it. */
78 *(*save_ptr)++ = '\0';
79 }
80 }
81 }
82
83 return token;
84}
85
86/* Basically getdelim() with the delimiter hard wired to '\n' */
87ssize_t getline(char **linebuf, size_t *n, FILE *file)
88{
89 return (getdelim (linebuf, n, '\n', file));
90}
91
92
93/*
94 * daemon implementation for uClibc
95 *
96 * Copyright (c) 1991, 1993
97 * The Regents of the University of California. All rights reserved.
98 *
99 * Modified for uClibc by Erik Andersen <andersen@codepoet.org>
100 *
101 * The uClibc Library is free software; you can redistribute it and/or
102 * modify it under the terms of the GNU Library General Public License as
103 * published by the Free Software Foundation; either version 2 of the
104 * License, or (at your option) any later version.
105 *
106 * The GNU C Library is distributed in the hope that it will be useful,
107 * but WITHOUT ANY WARRANTY; without even the implied warranty of
108 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
109 * Library General Public License for more details.
110 *
111 * You should have received a copy of the GNU Library General Public
112 * License along with the GNU C Library; see the file COPYING.LIB. If not,
113 * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
114 * Boston, MA 02111-1307, USA.
115 *
116 * Original copyright notice is retained at the end of this file.
117 */
118
119int daemon( int nochdir, int noclose )
120{
121 int fd;
122
123 switch (fork()) {
124 case -1:
125 return(-1);
126 case 0:
127 break;
128 default:
129 _exit(0);
130 }
131
132 if (setsid() == -1)
133 return(-1);
134
135 if (!nochdir)
136 chdir("/");
137
138 if (!noclose && (fd = open(_PATH_DEVNULL, O_RDWR, 0)) != -1) {
139 dup2(fd, STDIN_FILENO);
140 dup2(fd, STDOUT_FILENO);
141 dup2(fd, STDERR_FILENO);
142 if (fd > 2)
143 close(fd);
144 }
145 return(0);
146}
147
148
149/*-
150 * Copyright (c) 1990, 1993
151 * The Regents of the University of California. All rights reserved.
152 *
153 * Redistribution and use in source and binary forms, with or without
154 * modification, are permitted provided that the following conditions
155 * are met:
156 * 1. Redistributions of source code must retain the above copyright
157 * notice, this list of conditions and the following disclaimer.
158 * 2. Redistributions in binary form must reproduce the above copyright
159 * notice, this list of conditions and the following disclaimer in the
160 * documentation and/or other materials provided with the distribution.
161 *
162 * 3. <BSD Advertising Clause omitted per the July 22, 1999 licensing change
163 * ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change>
164 *
165 * 4. Neither the name of the University nor the names of its contributors
166 * may be used to endorse or promote products derived from this software
167 * without specific prior written permission.
168 *
169 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
170 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
171 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
172 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
173 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
174 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
175 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
176 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
177 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
178 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
179 * SUCH DAMAGE.
180 */
181
182
183#endif
184
diff --git a/libbb/module_syscalls.c b/libbb/module_syscalls.c
index 6b6ebed06..cb9258af2 100644
--- a/libbb/module_syscalls.c
+++ b/libbb/module_syscalls.c
@@ -27,15 +27,11 @@
27 _syscall* defined. */ 27 _syscall* defined. */
28#define __LIBRARY__ 28#define __LIBRARY__
29#include <sys/syscall.h> 29#include <sys/syscall.h>
30#if __GNU_LIBRARY__ < 5
31/* This is needed for libc5 */
32#include <asm/unistd.h>
33#endif
34#include "libbb.h" 30#include "libbb.h"
35 31
36 32
37#if __GNU_LIBRARY__ < 5 || ((__GLIBC__ <= 2) && (__GLIBC_MINOR__ < 1)) 33/* These syscalls are not included in very old glibc versions */
38/* These syscalls are not included as part of libc5 */ 34#if ((__GLIBC__ <= 2) && (__GLIBC_MINOR__ < 1))
39int delete_module(const char *name) 35int delete_module(const char *name)
40{ 36{
41 return(syscall(__NR_delete_module, name)); 37 return(syscall(__NR_delete_module, name));
@@ -79,7 +75,7 @@ unsigned long create_module(const char *name, size_t size)
79 return ret; 75 return ret;
80} 76}
81 77
82#endif /* __GNU_LIBRARY__ < 5 */ 78#endif
83 79
84 80
85/* END CODE */ 81/* END CODE */
diff --git a/libbb/syscalls.c b/libbb/syscalls.c
index ee58d3674..8ceb35695 100644
--- a/libbb/syscalls.c
+++ b/libbb/syscalls.c
@@ -27,10 +27,6 @@
27 _syscall* defined. */ 27 _syscall* defined. */
28#define __LIBRARY__ 28#define __LIBRARY__
29#include <sys/syscall.h> 29#include <sys/syscall.h>
30#if __GNU_LIBRARY__ < 5
31/* This is needed for libc5 */
32#include <asm/unistd.h>
33#endif
34#include "libbb.h" 30#include "libbb.h"
35 31
36int sysfs( int option, unsigned int fs_index, char * buf) 32int sysfs( int option, unsigned int fs_index, char * buf)
@@ -59,9 +55,9 @@ int pivot_root(const char * new_root,const char * put_old)
59 55
60 56
61 57
62#if __GNU_LIBRARY__ < 5 || ((__GLIBC__ <= 2) && (__GLIBC_MINOR__ < 1)) 58/* These syscalls are not included in ancient glibc versions */
59#if ((__GLIBC__ <= 2) && (__GLIBC_MINOR__ < 1))
63 60
64/* These syscalls are not included as part of libc5 */
65int bdflush(int func, int data) 61int bdflush(int func, int data)
66{ 62{
67 return(syscall(__NR_bdflush, func, data)); 63 return(syscall(__NR_bdflush, func, data));
@@ -96,7 +92,7 @@ int umount2(const char * special_file, int flags)
96} 92}
97 93
98 94
99#endif /* __GNU_LIBRARY__ < 5 */ 95#endif
100 96
101 97
102/* END CODE */ 98/* END CODE */
diff --git a/libpwdgrp/setgroups.c b/libpwdgrp/setgroups.c
index c133849e8..449e811dc 100644
--- a/libpwdgrp/setgroups.c
+++ b/libpwdgrp/setgroups.c
@@ -30,12 +30,11 @@
30 _syscall* defined. */ 30 _syscall* defined. */
31#define __LIBRARY__ 31#define __LIBRARY__
32#include <sys/syscall.h> 32#include <sys/syscall.h>
33#if __GNU_LIBRARY__ < 5
34/* This is needed for libc5 */
35#include <asm/unistd.h>
36#endif
37#include "grp_.h" 33#include "grp_.h"
38 34
39//#define __NR_setgroups 81 35int setgroups(size_t size, const gid_t * list)
40_syscall2(int, setgroups, size_t, size, const gid_t *, list); 36{
37 return(syscall(__NR_setgroups, size, list));
38}
39
41 40
diff --git a/miscutils/adjtimex.c b/miscutils/adjtimex.c
index d541848f0..e941f6b4f 100644
--- a/miscutils/adjtimex.c
+++ b/miscutils/adjtimex.c
@@ -44,14 +44,7 @@
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
52#include <sys/timex.h> 47#include <sys/timex.h>
53#endif
54
55#include "busybox.h" 48#include "busybox.h"
56 49
57static struct {int bit; char *name;} statlist[] = { 50static struct {int bit; char *name;} statlist[] = {
diff --git a/miscutils/dutmp.c b/miscutils/dutmp.c
index 113f850fe..86d7ce4b3 100644
--- a/miscutils/dutmp.c
+++ b/miscutils/dutmp.c
@@ -28,13 +28,9 @@
28 * Do what we can while still keeping this reasonably small. 28 * Do what we can while still keeping this reasonably small.
29 * Note: We are assuming the ut_id[] size is fixed at 4. */ 29 * Note: We are assuming the ut_id[] size is fixed at 4. */
30 30
31#if __GNU_LIBRARY__ < 5
32#warning the format string needs to be changed
33#else
34#if (UT_LINESIZE != 32) || (UT_NAMESIZE != 32) || (UT_HOSTSIZE != 256) 31#if (UT_LINESIZE != 32) || (UT_NAMESIZE != 32) || (UT_HOSTSIZE != 256)
35#error struct utmp member char[] size(s) have changed! 32#error struct utmp member char[] size(s) have changed!
36#endif 33#endif
37#endif
38 34
39extern int dutmp_main(int argc, char **argv) 35extern int dutmp_main(int argc, char **argv)
40{ 36{
@@ -57,18 +53,6 @@ extern int dutmp_main(int argc, char **argv)
57 bb_perror_msg_and_die("short read"); 53 bb_perror_msg_and_die("short read");
58 } 54 }
59 55
60 /* Kludge around the fact that the binary format for utmp has changed. */
61#if __GNU_LIBRARY__ < 5
62 /* Linux libc5 */
63
64 bb_printf("%d|%d|%s|%s|%s|%s|%s|%lx\n",
65 ut.ut_type, ut.ut_pid, ut.ut_line,
66 ut.ut_id, ut.ut_user, ut.ut_host,
67 ctime(&(ut.ut_time)),
68 (long)ut.ut_addr);
69#else
70 /* Glibc, uClibc, etc. */
71
72 bb_printf("%d|%d|%.32s|%.4s|%.32s|%.256s|%d|%d|%ld|%ld|%ld|%x\n", 56 bb_printf("%d|%d|%.32s|%.4s|%.32s|%.256s|%d|%d|%ld|%ld|%ld|%x\n",
73 ut.ut_type, ut.ut_pid, ut.ut_line, 57 ut.ut_type, ut.ut_pid, ut.ut_line,
74 ut.ut_id, ut.ut_user, ut.ut_host, 58 ut.ut_id, ut.ut_user, ut.ut_host,
@@ -76,7 +60,6 @@ extern int dutmp_main(int argc, char **argv)
76 ut.ut_session, 60 ut.ut_session,
77 ut.ut_tv.tv_sec, ut.ut_tv.tv_usec, 61 ut.ut_tv.tv_sec, ut.ut_tv.tv_usec,
78 ut.ut_addr); 62 ut.ut_addr);
79#endif
80 } 63 }
81 64
82 bb_fflush_stdout_and_exit(EXIT_SUCCESS); 65 bb_fflush_stdout_and_exit(EXIT_SUCCESS);
diff --git a/miscutils/update.c b/miscutils/update.c
index 48ea02deb..c51f42183 100644
--- a/miscutils/update.c
+++ b/miscutils/update.c
@@ -32,12 +32,7 @@
32#include <sys/syslog.h> 32#include <sys/syslog.h>
33#include <unistd.h> /* for getopt() */ 33#include <unistd.h> /* for getopt() */
34#include <stdlib.h> 34#include <stdlib.h>
35 35#include <sys/kdaemon.h>
36#if __GNU_LIBRARY__ > 5
37 #include <sys/kdaemon.h>
38#else
39 extern int bdflush (int func, long int data);
40#endif
41 36
42#include "busybox.h" 37#include "busybox.h"
43 38
diff --git a/modutils/insmod.c b/modutils/insmod.c
index 1f5965e0a..84617fa48 100644
--- a/modutils/insmod.c
+++ b/modutils/insmod.c
@@ -247,7 +247,7 @@
247#ifndef MODUTILS_MODULE_H 247#ifndef MODUTILS_MODULE_H
248static const int MODUTILS_MODULE_H = 1; 248static const int MODUTILS_MODULE_H = 1;
249 249
250#ident "$Id: insmod.c,v 1.98 2003/07/14 21:21:00 andersen Exp $" 250#ident "$Id: insmod.c,v 1.99 2003/07/22 08:56:50 andersen Exp $"
251 251
252/* This file contains the structures used by the 2.0 and 2.1 kernels. 252/* This file contains the structures used by the 2.0 and 2.1 kernels.
253 We do not use the kernel headers directly because we do not wish 253 We do not use the kernel headers directly because we do not wish
@@ -468,7 +468,7 @@ int delete_module(const char *);
468#ifndef MODUTILS_OBJ_H 468#ifndef MODUTILS_OBJ_H
469static const int MODUTILS_OBJ_H = 1; 469static const int MODUTILS_OBJ_H = 1;
470 470
471#ident "$Id: insmod.c,v 1.98 2003/07/14 21:21:00 andersen Exp $" 471#ident "$Id: insmod.c,v 1.99 2003/07/22 08:56:50 andersen Exp $"
472 472
473/* The relocatable object is manipulated using elfin types. */ 473/* The relocatable object is manipulated using elfin types. */
474 474
@@ -492,7 +492,7 @@ static const int MODUTILS_OBJ_H = 1;
492# endif 492# endif
493#endif 493#endif
494 494
495/* For some reason this is missing from libc5. */ 495/* For some reason this is missing from some ancient C libraries.... */
496#ifndef ELF32_ST_INFO 496#ifndef ELF32_ST_INFO
497# define ELF32_ST_INFO(bind, type) (((bind) << 4) + ((type) & 0xf)) 497# define ELF32_ST_INFO(bind, type) (((bind) << 4) + ((type) & 0xf))
498#endif 498#endif
diff --git a/networking/ping.c b/networking/ping.c
index 28b38db14..a38f356d6 100644
--- a/networking/ping.c
+++ b/networking/ping.c
@@ -1,6 +1,6 @@
1/* vi: set sw=4 ts=4: */ 1/* vi: set sw=4 ts=4: */
2/* 2/*
3 * $Id: ping.c,v 1.54 2003/03/19 09:12:38 mjn3 Exp $ 3 * $Id: ping.c,v 1.55 2003/07/22 08:56:51 andersen Exp $
4 * Mini ping implementation for busybox 4 * Mini ping implementation for busybox
5 * 5 *
6 * Copyright (C) 1999 by Randolph Chung <tausq@debian.org> 6 * Copyright (C) 1999 by Randolph Chung <tausq@debian.org>
@@ -52,85 +52,6 @@
52#include "busybox.h" 52#include "busybox.h"
53 53
54 54
55/* It turns out that libc5 doesn't have proper icmp support
56 * built into it header files, so we have to supplement it */
57#if __GNU_LIBRARY__ < 5
58static const int ICMP_MINLEN = 8; /* abs minimum */
59
60struct icmp_ra_addr
61{
62 u_int32_t ira_addr;
63 u_int32_t ira_preference;
64};
65
66
67struct icmp
68{
69 u_int8_t icmp_type; /* type of message, see below */
70 u_int8_t icmp_code; /* type sub code */
71 u_int16_t icmp_cksum; /* ones complement checksum of struct */
72 union
73 {
74 u_char ih_pptr; /* ICMP_PARAMPROB */
75 struct in_addr ih_gwaddr; /* gateway address */
76 struct ih_idseq /* echo datagram */
77 {
78 u_int16_t icd_id;
79 u_int16_t icd_seq;
80 } ih_idseq;
81 u_int32_t ih_void;
82
83 /* ICMP_UNREACH_NEEDFRAG -- Path MTU Discovery (RFC1191) */
84 struct ih_pmtu
85 {
86 u_int16_t ipm_void;
87 u_int16_t ipm_nextmtu;
88 } ih_pmtu;
89
90 struct ih_rtradv
91 {
92 u_int8_t irt_num_addrs;
93 u_int8_t irt_wpa;
94 u_int16_t irt_lifetime;
95 } ih_rtradv;
96 } icmp_hun;
97#define icmp_pptr icmp_hun.ih_pptr
98#define icmp_gwaddr icmp_hun.ih_gwaddr
99#define icmp_id icmp_hun.ih_idseq.icd_id
100#define icmp_seq icmp_hun.ih_idseq.icd_seq
101#define icmp_void icmp_hun.ih_void
102#define icmp_pmvoid icmp_hun.ih_pmtu.ipm_void
103#define icmp_nextmtu icmp_hun.ih_pmtu.ipm_nextmtu
104#define icmp_num_addrs icmp_hun.ih_rtradv.irt_num_addrs
105#define icmp_wpa icmp_hun.ih_rtradv.irt_wpa
106#define icmp_lifetime icmp_hun.ih_rtradv.irt_lifetime
107 union
108 {
109 struct
110 {
111 u_int32_t its_otime;
112 u_int32_t its_rtime;
113 u_int32_t its_ttime;
114 } id_ts;
115 struct
116 {
117 struct ip idi_ip;
118 /* options and then 64 bits of data */
119 } id_ip;
120 struct icmp_ra_addr id_radv;
121 u_int32_t id_mask;
122 u_int8_t id_data[1];
123 } icmp_dun;
124#define icmp_otime icmp_dun.id_ts.its_otime
125#define icmp_rtime icmp_dun.id_ts.its_rtime
126#define icmp_ttime icmp_dun.id_ts.its_ttime
127#define icmp_ip icmp_dun.id_ip.idi_ip
128#define icmp_radv icmp_dun.id_radv
129#define icmp_mask icmp_dun.id_mask
130#define icmp_data icmp_dun.id_data
131};
132#endif
133
134static const int DEFDATALEN = 56; 55static const int DEFDATALEN = 56;
135static const int MAXIPLEN = 60; 56static const int MAXIPLEN = 60;
136static const int MAXICMPLEN = 76; 57static const int MAXICMPLEN = 76;
diff --git a/networking/traceroute.c b/networking/traceroute.c
index be9ea1d95..5f8989fd1 100644
--- a/networking/traceroute.c
+++ b/networking/traceroute.c
@@ -76,97 +76,6 @@
76#include <netinet/ip_icmp.h> 76#include <netinet/ip_icmp.h>
77 77
78 78
79 /* It turns out that libc5 doesn't have proper icmp support
80 * built into it header files, so we have to supplement it */
81#if __GNU_LIBRARY__ < 5
82static const int ICMP_MINLEN = 8; /* abs minimum */
83
84struct icmp_ra_addr
85{
86 u_int32_t ira_addr;
87 u_int32_t ira_preference;
88};
89
90
91struct icmp
92{
93 u_int8_t icmp_type; /* type of message, see below */
94 u_int8_t icmp_code; /* type sub code */
95 u_int16_t icmp_cksum; /* ones complement checksum of struct */
96 union
97 {
98 u_char ih_pptr; /* ICMP_PARAMPROB */
99 struct in_addr ih_gwaddr; /* gateway address */
100 struct ih_idseq /* echo datagram */
101 {
102 u_int16_t icd_id;
103 u_int16_t icd_seq;
104 } ih_idseq;
105 u_int32_t ih_void;
106
107 /* ICMP_UNREACH_NEEDFRAG -- Path MTU Discovery (RFC1191) */
108 struct ih_pmtu
109 {
110 u_int16_t ipm_void;
111 u_int16_t ipm_nextmtu;
112 } ih_pmtu;
113
114 struct ih_rtradv
115 {
116 u_int8_t irt_num_addrs;
117 u_int8_t irt_wpa;
118 u_int16_t irt_lifetime;
119 } ih_rtradv;
120 } icmp_hun;
121#define icmp_pptr icmp_hun.ih_pptr
122#define icmp_gwaddr icmp_hun.ih_gwaddr
123#define icmp_id icmp_hun.ih_idseq.icd_id
124#define icmp_seq icmp_hun.ih_idseq.icd_seq
125#define icmp_void icmp_hun.ih_void
126#define icmp_pmvoid icmp_hun.ih_pmtu.ipm_void
127#define icmp_nextmtu icmp_hun.ih_pmtu.ipm_nextmtu
128#define icmp_num_addrs icmp_hun.ih_rtradv.irt_num_addrs
129#define icmp_wpa icmp_hun.ih_rtradv.irt_wpa
130#define icmp_lifetime icmp_hun.ih_rtradv.irt_lifetime
131 union
132 {
133 struct
134 {
135 u_int32_t its_otime;
136 u_int32_t its_rtime;
137 u_int32_t its_ttime;
138 } id_ts;
139 struct
140 {
141 struct ip idi_ip;
142 /* options and then 64 bits of data */
143 } id_ip;
144 struct icmp_ra_addr id_radv;
145 u_int32_t id_mask;
146 u_int8_t id_data[1];
147 } icmp_dun;
148#define icmp_otime icmp_dun.id_ts.its_otime
149#define icmp_rtime icmp_dun.id_ts.its_rtime
150#define icmp_ttime icmp_dun.id_ts.its_ttime
151#define icmp_ip icmp_dun.id_ip.idi_ip
152#define icmp_radv icmp_dun.id_radv
153#define icmp_mask icmp_dun.id_mask
154#define icmp_data icmp_dun.id_data
155};
156
157#define ICMP_MINLEN 8 /* abs minimum */
158#define ICMP_UNREACH 3 /* dest unreachable, codes: */
159#define ICMP_TIMXCEED 11 /* time exceeded, code: */
160#define ICMP_TIMXCEED_INTRANS 0 /* ttl==0 in transit */
161#define ICMP_UNREACH_NET 0 /* bad net */
162#define ICMP_UNREACH_HOST 1 /* bad host */
163#define ICMP_UNREACH_PROTOCOL 2 /* bad protocol */
164#define ICMP_UNREACH_PORT 3 /* bad port */
165#define ICMP_UNREACH_NEEDFRAG 4 /* IP_DF caused drop */
166#define ICMP_UNREACH_SRCFAIL 5 /* src route failed */
167#endif
168
169
170#define MAXPACKET 65535 /* max ip packet size */ 79#define MAXPACKET 65535 /* max ip packet size */
171#ifndef MAXHOSTNAMELEN 80#ifndef MAXHOSTNAMELEN
172#define MAXHOSTNAMELEN 64 81#define MAXHOSTNAMELEN 64
diff --git a/networking/wget.c b/networking/wget.c
index d68b16524..a9ead7fc2 100644
--- a/networking/wget.c
+++ b/networking/wget.c
@@ -31,19 +31,6 @@
31 31
32#include "busybox.h" 32#include "busybox.h"
33 33
34/* Stupid libc5 doesn't define this... */
35#ifndef timersub
36#define timersub(a, b, result) \
37 do { \
38 (result)->tv_sec = (a)->tv_sec - (b)->tv_sec; \
39 (result)->tv_usec = (a)->tv_usec - (b)->tv_usec; \
40 if ((result)->tv_usec < 0) { \
41 --(result)->tv_sec; \
42 (result)->tv_usec += 1000000; \
43 } \
44 } while (0)
45#endif
46
47struct host_info { 34struct host_info {
48 char *host; 35 char *host;
49 int port; 36 int port;
@@ -824,7 +811,7 @@ progressmeter(int flag)
824 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 811 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
825 * SUCH DAMAGE. 812 * SUCH DAMAGE.
826 * 813 *
827 * $Id: wget.c,v 1.53 2003/03/19 09:12:39 mjn3 Exp $ 814 * $Id: wget.c,v 1.54 2003/07/22 08:56:51 andersen Exp $
828 */ 815 */
829 816
830 817
diff --git a/shell/cmdedit.c b/shell/cmdedit.c
index 350c0fd86..843f73fef 100644
--- a/shell/cmdedit.c
+++ b/shell/cmdedit.c
@@ -163,11 +163,6 @@ static int my_gid;
163 163
164#endif /* CONFIG_FEATURE_COMMAND_TAB_COMPLETION */ 164#endif /* CONFIG_FEATURE_COMMAND_TAB_COMPLETION */
165 165
166/* It seems that libc5 doesn't know what a sighandler_t is... */
167#if (__GLIBC__ <= 2) && (__GLIBC_MINOR__ < 1)
168typedef void (*sighandler_t) (int);
169#endif
170
171static void cmdedit_setwidth(int w, int redraw_flg); 166static void cmdedit_setwidth(int w, int redraw_flg);
172 167
173static void win_changed(int nsig) 168static void win_changed(int nsig)
diff --git a/sysklogd/klogd.c b/sysklogd/klogd.c
index d32882d33..f537a4bb8 100644
--- a/sysklogd/klogd.c
+++ b/sysklogd/klogd.c
@@ -38,14 +38,7 @@
38#include <unistd.h> 38#include <unistd.h>
39#include <ctype.h> 39#include <ctype.h>
40#include <sys/syslog.h> 40#include <sys/syslog.h>
41 41#include <sys/klog.h>
42#if __GNU_LIBRARY__ < 5
43# ifdef __alpha__
44# define klogctl syslog
45# endif
46#else
47# include <sys/klog.h>
48#endif
49 42
50#include "busybox.h" 43#include "busybox.h"
51 44
diff --git a/sysklogd/logread.c b/sysklogd/logread.c
index ae8dbae3a..2692efbee 100644
--- a/sysklogd/logread.c
+++ b/sysklogd/logread.c
@@ -35,13 +35,6 @@
35#include <setjmp.h> 35#include <setjmp.h>
36#include "busybox.h" 36#include "busybox.h"
37 37
38#if __GNU_LIBRARY__ < 5
39#error Sorry. Looks like you are using libc5.
40#error libc5 shm support isnt good enough.
41#error Please disable CONFIG_FEATURE_IPC_SYSLOG
42#endif
43
44
45static const long KEY_ID = 0x414e4547; /*"GENA"*/ 38static const long KEY_ID = 0x414e4547; /*"GENA"*/
46 39
47static struct shbuf_ds { 40static struct shbuf_ds {
diff --git a/sysklogd/syslogd.c b/sysklogd/syslogd.c
index 06dfca6d8..89f8d60ca 100644
--- a/sysklogd/syslogd.c
+++ b/sysklogd/syslogd.c
@@ -86,12 +86,6 @@ static int local_logging = FALSE;
86 86
87/* circular buffer variables/structures */ 87/* circular buffer variables/structures */
88#ifdef CONFIG_FEATURE_IPC_SYSLOG 88#ifdef CONFIG_FEATURE_IPC_SYSLOG
89#if __GNU_LIBRARY__ < 5
90#error Sorry. Looks like you are using libc5.
91#error libc5 shm support isnt good enough.
92#error Please disable CONFIG_FEATURE_IPC_SYSLOG
93#endif
94
95#include <sys/ipc.h> 89#include <sys/ipc.h>
96#include <sys/sem.h> 90#include <sys/sem.h>
97#include <sys/shm.h> 91#include <sys/shm.h>
diff --git a/util-linux/dmesg.c b/util-linux/dmesg.c
index 6e0d6947f..0c0d2d7c0 100644
--- a/util-linux/dmesg.c
+++ b/util-linux/dmesg.c
@@ -22,14 +22,7 @@
22#include <stdlib.h> 22#include <stdlib.h>
23#include <getopt.h> 23#include <getopt.h>
24#include <errno.h> 24#include <errno.h>
25 25#include <sys/klog.h>
26#if __GNU_LIBRARY__ < 5
27# ifdef __alpha__
28# define klogctl syslog
29# endif
30#else
31# include <sys/klog.h>
32#endif
33 26
34#include "busybox.h" 27#include "busybox.h"
35 28
diff --git a/util-linux/swaponoff.c b/util-linux/swaponoff.c
index 1f3e930a1..9da70756e 100644
--- a/util-linux/swaponoff.c
+++ b/util-linux/swaponoff.c
@@ -28,14 +28,7 @@
28#include <string.h> 28#include <string.h>
29#include <stdlib.h> 29#include <stdlib.h>
30#include <sys/mount.h> 30#include <sys/mount.h>
31
32#if __GNU_LIBRARY__ < 5
33/* libc5 doesn't have sys/swap.h, define these here. */
34extern int swapon (__const char *__path, int __flags);
35extern int swapoff (__const char *__path);
36#else
37#include <sys/swap.h> 31#include <sys/swap.h>
38#endif
39 32
40#include "busybox.h" 33#include "busybox.h"
41 34