diff options
30 files changed, 1087 insertions, 2 deletions
diff --git a/busybox/busybox-1.00-rc1/add-getkey-applet.patch b/busybox/busybox-1.00-rc1/add-getkey-applet.patch new file mode 100644 index 0000000000..fb68133556 --- /dev/null +++ b/busybox/busybox-1.00-rc1/add-getkey-applet.patch @@ -0,0 +1,133 @@ + +# +# Patch managed by http://www.mn-logistik.de/unsupported/pxa250/patcher +# + +--- /dev/null 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.00-pre10/console-tools/getkey.c 2004-06-11 22:22:54.402329312 +0200 +@@ -0,0 +1,70 @@ ++/* vi: set sw=4 ts=4: */ ++/* ++ * getkey.c - Michael 'Mickey' Lauer ++ * ++ * Version 0.1 ++ * ++ * A simple keygrapper. Displays a configurable message and waits a dedicated number ++ * of seconds for a keypress. Sets the exit code accordingly (SUCCESS on keypress). ++ */ ++#include <stdio.h> ++#include <fcntl.h> ++#include <memory.h> ++#include <stdlib.h> ++#include <unistd.h> ++#include <sys/types.h> ++#include <errno.h> ++#include <sys/ioctl.h> ++#include <sys/kd.h> ++#include "busybox.h" ++ ++extern int getkey_main(int argc, char **argv) ++{ ++ int status = EXIT_FAILURE; ++ ++ if ( argc < 2 ) { ++ bb_show_usage(); ++ } ++ ++ //bb_printf( "DEBUG: time = '%s'\n", argv[1] ); ++ //bb_printf( "DEBUG: mesg = '%s'\n", argv[2] ); ++ ++ struct termios orig; ++ struct termios attr; ++ ++ tcgetattr(STDIN_FILENO, &orig); ++ attr = orig; ++ attr.c_cc[VMIN] = 0; ++ attr.c_cc[VTIME] = 0; ++ attr.c_iflag |= INLCR; ++ attr.c_oflag |= OPOST|ONLCR; ++ attr.c_cflag &= ~PARENB; ++ attr.c_lflag &= ~(ICANON/*|ECHO*/); ++ tcsetattr(STDIN_FILENO,TCSANOW,&attr); ++ ++ fd_set rfds; ++ struct timeval tv; ++ int retval; ++ ++ FD_ZERO(&rfds); ++ FD_SET(0, &rfds); ++ ++ tv.tv_sec = atoi( argv[1] ); ++ tv.tv_usec = 0; ++ ++ if ( argc == 3 ) ++ { ++ bb_printf( argv[2], tv.tv_sec ); ++ bb_printf( "\n" ); ++ fflush(stdout); ++ } ++ retval = select(1, &rfds, NULL, NULL, &tv); ++ if (retval) ++ { ++ status = EXIT_SUCCESS; ++ } ++ ++ tcsetattr(STDIN_FILENO,TCSANOW,&orig); ++ return status; ++}; ++ +--- busybox-1.00-pre10/console-tools/Makefile.in~getkey 2004-03-15 09:28:17.000000000 +0100 ++++ busybox-1.00-pre10/console-tools/Makefile.in 2004-06-10 16:31:03.000000000 +0200 +@@ -27,6 +27,7 @@ + CONSOLETOOLS_DIR-$(CONFIG_CLEAR) += clear.o + CONSOLETOOLS_DIR-$(CONFIG_DEALLOCVT) += deallocvt.o + CONSOLETOOLS_DIR-$(CONFIG_DUMPKMAP) += dumpkmap.o ++CONSOLETOOLS_DIR-$(CONFIG_GETKEY) += getkey.o + CONSOLETOOLS_DIR-$(CONFIG_LOADFONT) += loadfont.o + CONSOLETOOLS_DIR-$(CONFIG_LOADKMAP) += loadkmap.o + CONSOLETOOLS_DIR-$(CONFIG_OPENVT) += openvt.o +--- busybox-1.00-pre10/console-tools/Config.in~getkey 2003-12-20 08:07:22.000000000 +0100 ++++ busybox-1.00-pre10/console-tools/Config.in 2004-06-10 16:34:39.000000000 +0200 +@@ -31,6 +31,14 @@ + This program dumps the kernel's keyboard translation table to + stdout, in binary format. You can then use loadkmap to load it. + ++config CONFIG_GETKEY ++ bool "getkey" ++ default n ++ help ++ This program displays a configurable message and waits ++ a dedicated number of seconds for a keypress. It sets ++ the exit code accordingly, i.e. SUCCESS if there was a keypress. ++ + config CONFIG_LOADFONT + bool "loadfont" + default n +--- busybox-1.00-pre10/include/applets.h~getkey 2004-04-06 18:59:43.000000000 +0200 ++++ busybox-1.00-pre10/include/applets.h 2004-06-10 16:40:23.000000000 +0200 +@@ -223,6 +223,9 @@ + #ifdef CONFIG_FTPPUT + APPLET(ftpput, ftpgetput_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER) + #endif ++#ifdef CONFIG_GETKEY ++ APPLET(getkey, getkey_main, _BB_DIR_SBIN, _BB_SUID_NEVER) ++#endif + #ifdef CONFIG_GETOPT + APPLET(getopt, getopt_main, _BB_DIR_BIN, _BB_SUID_NEVER) + #endif +--- busybox-1.00-pre10/include/usage.h~getkey 2004-04-13 21:27:20.000000000 +0200 ++++ busybox-1.00-pre10/include/usage.h 2004-06-11 22:23:29.593979368 +0200 +@@ -729,6 +729,13 @@ + "\t-p, --password Password to be used\n" \ + "\t-P, --port Port number to be used" + ++#define getkey_trivial_usage \ ++ "time [message]" ++#define getkey_full_usage \ ++ "Display a message and wait for a keypress." ++#define getkey_example_usage \ ++ "$ getkey 5 'Press a key within %d seconds to interrupt autoboot.'" ++ + #define getopt_trivial_usage \ + "[OPTIONS]..." + #define getopt_full_usage \ diff --git a/busybox/busybox-1.00-rc1/awk.patch b/busybox/busybox-1.00-rc1/awk.patch new file mode 100644 index 0000000000..9342dada82 --- /dev/null +++ b/busybox/busybox-1.00-rc1/awk.patch @@ -0,0 +1,10 @@ +--- editors/awk.c~ 2004-03-15 08:28:31.000000000 +0000 ++++ editors/awk.c 2004-07-05 19:16:14.000000000 +0100 +@@ -1211,6 +1211,7 @@ + + if (c & TC_GRPSTART) { + while(next_token(TC_GRPSEQ | TC_GRPTERM) != TC_GRPTERM) { ++ if (t.tclass & TC_NEWLINE) continue; + rollback_token(); + chain_group(); + } diff --git a/busybox/busybox-1.00-rc1/bb-iproute-iftunnel.patch b/busybox/busybox-1.00-rc1/bb-iproute-iftunnel.patch new file mode 100644 index 0000000000..93b3ea07dd --- /dev/null +++ b/busybox/busybox-1.00-rc1/bb-iproute-iftunnel.patch @@ -0,0 +1,36 @@ +diff -Nur include/linux-new/if_tunnel.h include/linux/if_tunnel.h +--- ./include/linux/if_tunnel.h 1970-01-01 01:00:00.000000000 +0100 ++++ ./include/linux/if_tunnel.h 2004-05-06 14:36:38.000000000 +0200 +@@ -0,0 +1,32 @@ ++#ifndef _IF_TUNNEL_H_ ++#define _IF_TUNNEL_H_ ++ ++#include <net/if.h> ++#include <asm/types.h> ++ ++#define SIOCGETTUNNEL (SIOCDEVPRIVATE + 0) ++#define SIOCADDTUNNEL (SIOCDEVPRIVATE + 1) ++#define SIOCDELTUNNEL (SIOCDEVPRIVATE + 2) ++#define SIOCCHGTUNNEL (SIOCDEVPRIVATE + 3) ++ ++#define GRE_CSUM __constant_htons(0x8000) ++#define GRE_ROUTING __constant_htons(0x4000) ++#define GRE_KEY __constant_htons(0x2000) ++#define GRE_SEQ __constant_htons(0x1000) ++#define GRE_STRICT __constant_htons(0x0800) ++#define GRE_REC __constant_htons(0x0700) ++#define GRE_FLAGS __constant_htons(0x00F8) ++#define GRE_VERSION __constant_htons(0x0007) ++ ++struct ip_tunnel_parm ++{ ++ char name[IFNAMSIZ]; ++ int link; ++ __u16 i_flags; ++ __u16 o_flags; ++ __u32 i_key; ++ __u32 o_key; ++ struct iphdr iph; ++}; ++ ++#endif /* _IF_TUNNEL_H_ */ diff --git a/busybox/busybox-1.00-rc1/busybox-1.00-pre10-fuser.patch b/busybox/busybox-1.00-rc1/busybox-1.00-pre10-fuser.patch new file mode 100644 index 0000000000..3bae1a8458 --- /dev/null +++ b/busybox/busybox-1.00-rc1/busybox-1.00-pre10-fuser.patch @@ -0,0 +1,649 @@ +diff -urN busybox-1.00-pre10.orig/include/applets.h busybox-1.00-pre10/include/applets.h +--- busybox-1.00-pre10.orig/include/applets.h 2004-04-06 11:59:43.000000000 -0500 ++++ busybox-1.00-pre10/include/applets.h 2004-04-13 12:46:08.000000000 -0500 +@@ -223,6 +223,9 @@ + #ifdef CONFIG_FTPPUT + APPLET(ftpput, ftpgetput_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER) + #endif ++#ifdef CONFIG_FUSER ++ APPLET(fuser, fuser_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER) ++#endif + #ifdef CONFIG_GETOPT + APPLET(getopt, getopt_main, _BB_DIR_BIN, _BB_SUID_NEVER) + #endif +@@ -355,6 +358,9 @@ + #ifdef CONFIG_LS + APPLET(ls, ls_main, _BB_DIR_BIN, _BB_SUID_NEVER) + #endif ++#ifdef CONFIG_FEATURE_FUSER_LSOF ++ APPLET(lsof, lsof_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER) ++#endif + #ifdef CONFIG_LSMOD + APPLET(lsmod, lsmod_main, _BB_DIR_SBIN, _BB_SUID_NEVER) + #endif +diff -urN busybox-1.00-pre10.orig/include/usage.h busybox-1.00-pre10/include/usage.h +--- busybox-1.00-pre10.orig/include/usage.h 2004-04-06 12:52:02.000000000 -0500 ++++ busybox-1.00-pre10/include/usage.h 2004-04-13 16:10:45.000000000 -0500 +@@ -729,6 +729,17 @@ + "\t-p, --password Password to be used\n" \ + "\t-P, --port Port number to be used" + ++#define fuser_trivial_usage \ ++ "[options] file OR port/proto" ++#define fuser_full_usage \ ++ "Options:\n" \ ++ "\t-m Show all processes on the same mounted fs\n" \ ++ "\t-k Kill all processes that match.\n" \ ++ "\t-s Don't print or kill anything.\n" \ ++ "\t-4 When using port/proto only search IPv4 space\n" \ ++ "\t-6 When using port/proto only search IPv6 space\n" \ ++ "\t-SIGNAL When used with -k, this signal will be used to kill\n" ++ + #define getopt_trivial_usage \ + "[OPTIONS]..." + #define getopt_full_usage \ +@@ -1536,6 +1547,13 @@ + USAGE_SELINUX("\t-k\tprint security context\n") \ + USAGE_SELINUX("\t-K\tprint security context in long format\n") + ++#define lsof_trivial_usage \ ++ "[filelist]" ++#define lsof_full_usage \ ++ "List open files with associated process information.\n" \ ++ "Specify a filename or list of filenames to only see information\n " \ ++ "about those files." ++ + #define lsmod_trivial_usage \ + "" + #define lsmod_full_usage \ +diff -urN busybox-1.00-pre10.orig/procps/Config.in busybox-1.00-pre10/procps/Config.in +--- busybox-1.00-pre10.orig/procps/Config.in 2003-12-24 00:02:11.000000000 -0600 ++++ busybox-1.00-pre10/procps/Config.in 2004-04-13 16:13:25.000000000 -0500 +@@ -13,6 +13,24 @@ + memory in the system, as well as the buffers used by the kernel. + The shared memory column should be ignored; it is obsolete. + ++config CONFIG_FUSER ++ bool "fuser" ++ default n ++ help ++ fuser lists all PIDs (Process IDs) that currently have a given ++ file open. fuser can also list all PIDs that have a given network ++ (TCP or UDP) port open. ++ ++config CONFIG_FEATURE_FUSER_LSOF ++ bool " lsof" ++ default n ++ depends on CONFIG_FUSER ++ help ++ lsof shows open files with associated process information. If ++ invoked without any parameters it lists ALL open file handles ++ on the system. It also accepts a filename or list of filenames as ++ input to narrow the output to only those files. ++ + config CONFIG_KILL + bool "kill" + default n +@@ -78,5 +96,6 @@ + help + sysctl - configure kernel parameters at runtime + ++ + endmenu + +diff -urN busybox-1.00-pre10.orig/procps/Makefile.in busybox-1.00-pre10/procps/Makefile.in +--- busybox-1.00-pre10.orig/procps/Makefile.in 2004-03-15 02:29:03.000000000 -0600 ++++ busybox-1.00-pre10/procps/Makefile.in 2004-04-13 11:36:54.000000000 -0500 +@@ -31,6 +31,7 @@ + PROCPS-$(CONFIG_SYSCTL) += sysctl.o + PROCPS-$(CONFIG_TOP) += top.o + PROCPS-$(CONFIG_UPTIME) += uptime.o ++PROCPS-$(CONFIG_FUSER) += fuser.o + + libraries-y+=$(PROCPS_DIR)$(PROCPS_AR) + +diff -urN busybox-1.00-pre10.orig/procps/fuser.c busybox-1.00-pre10/procps/fuser.c +--- busybox-1.00-pre10.orig/procps/fuser.c 1969-12-31 18:00:00.000000000 -0600 ++++ busybox-1.00-pre10/procps/fuser.c 2004-04-13 16:03:56.000000000 -0500 +@@ -0,0 +1,541 @@ ++/* ++ * tiny fuser implementation ++ * ++ * Copyright 2004 Tony J. White ++ * ++ * May be distributed under the conditions of the ++ * GNU Library General Public License ++ */ ++ ++/* this define is needed for asprintf() */ ++#ifndef _GNU_SOURCE ++#define _GNU_SOURCE ++#endif ++ ++#include <stdio.h> ++#include <stdlib.h> ++#include <unistd.h> ++#include <string.h> ++#include <limits.h> ++#include <dirent.h> ++#include <signal.h> ++#include <sys/types.h> ++#include <sys/ioctl.h> ++#include <sys/stat.h> ++#include <sys/socket.h> ++#include "busybox.h" ++ ++#define FUSER_PROC_DIR "/proc" ++#define FUSER_MAX_LINE 255 ++ ++#define FUSER_OPT_MOUNT 1 ++#define FUSER_OPT_KILL 2 ++#define FUSER_OPT_SILENT 4 ++#define FUSER_OPT_IP6 8 ++#define FUSER_OPT_IP4 16 ++#define FUSER_OPT_SHOWALL 32 ++ ++typedef struct inode_list { ++ ino_t inode; ++ dev_t dev; ++ struct inode_list *next; ++} inode_list; ++ ++typedef struct pid_list { ++ pid_t pid; ++ ino_t inode; ++ dev_t dev; ++ char *filename; ++ struct pid_list *next; ++} pid_list; ++ ++static int fuser_option(char *option) ++{ ++ int opt = 0; ++ ++ if(!(strlen(option))) return 0; ++ if(option[0] != '-') return 0; ++ *++option; ++ while(*option != '\0') { ++ if(*option == 'm') opt |= FUSER_OPT_MOUNT; ++ else if(*option == 'k') opt |= FUSER_OPT_KILL; ++ else if(*option == 's') opt |= FUSER_OPT_SILENT; ++ else if(*option == '6') opt |= FUSER_OPT_IP6; ++ else if(*option == '4') opt |= FUSER_OPT_IP4; ++ else { ++ bb_error_msg_and_die( ++ "Unsupported option '%c'", *option); ++ } ++ *++option; ++ } ++ return opt; ++} ++ ++static int fuser_file_to_dev_inode(const char *filename, ++ dev_t *dev, ino_t *inode) ++{ ++ struct stat f_stat; ++ if((stat(filename, &f_stat)) < 0) return 0; ++ memcpy(inode, &f_stat.st_ino, sizeof(ino_t)); ++ memcpy(dev, &f_stat.st_dev, sizeof(dev_t)); ++ return 1; ++} ++ ++static int fuser_find_socket_dev(dev_t *dev) { ++ int fd = socket(PF_INET, SOCK_DGRAM,0); ++ struct stat buf; ++ ++ if (fd >= 0 && (fstat(fd, &buf)) == 0) { ++ memcpy(dev, &buf.st_dev, sizeof(dev_t)); ++ close(fd); ++ return 1; ++ } ++ return 0; ++} ++ ++static int fuser_parse_net_arg(const char *filename, ++ const char **proto, int *port) ++{ ++ int tport; ++ char path[PATH_MAX+1], tproto[5]; ++ ++ if((sscanf(filename, "%d/%4s", &tport, &tproto[0])) != 2) return 0; ++ strncpy(path, FUSER_PROC_DIR, sizeof(FUSER_PROC_DIR)); ++ strncat(path, "/net/", 5); ++ strncat(path, tproto, strlen(tproto)); ++ if((access(path, R_OK)) != 0) return 0; ++ *proto = bb_xstrndup(tproto, strlen(tproto)); ++ memcpy(port, &tport, sizeof(int)); ++ return 1; ++} ++ ++static int fuser_add_pid(pid_list *plist, pid_t pid, ++ dev_t dev, ino_t inode, const char *filename) ++{ ++ pid_list *curr = NULL, *last = NULL; ++ ++ if(plist->pid == 0) { ++ plist->pid = pid; ++ plist->dev = dev; ++ plist->inode = inode; ++ plist->filename = bb_xstrndup(filename, strlen(filename)); ++ return 1; ++ } ++ curr = plist; ++ while(curr != NULL) { ++ if(curr->pid == pid && curr->dev == dev && curr->inode == inode) ++ return 1; ++ last = curr; ++ curr = curr->next; ++ } ++ curr = xmalloc(sizeof(pid_list)); ++ last->next = curr; ++ curr->pid = pid; ++ curr->dev = dev; ++ curr->inode = inode; ++ curr->filename = bb_xstrndup(filename, strlen(filename)); ++ curr->next = NULL; ++ return 1; ++} ++ ++static int fuser_add_inode(inode_list *ilist, dev_t dev, ino_t inode) ++{ ++ inode_list *curr = NULL, *last = NULL; ++ ++ if(!ilist->inode && !ilist->dev) { ++ ilist->dev = dev; ++ ilist->inode = inode; ++ } ++ curr = ilist; ++ while(curr != NULL) { ++ if(curr->inode == inode && curr->dev == dev) return 1; ++ last = curr; ++ curr = curr->next; ++ } ++ curr = xmalloc(sizeof(inode_list)); ++ last->next = curr; ++ curr->dev = dev; ++ curr->inode = inode; ++ curr->next = NULL; ++ return 1; ++} ++ ++static int fuser_clear_pid_list(pid_list *plist) ++{ ++ pid_list *curr, *next; ++ curr = next = plist->next; ++ while(curr != NULL) { ++ next = curr->next; ++ free(curr); ++ curr = next; ++ } ++ plist->pid = 0; ++ plist->next = NULL; ++ return 1; ++} ++ ++static int fuser_clear_inode_list(inode_list *ilist) ++{ ++ inode_list *curr, *next; ++ curr = next = ilist->next; ++ while(curr != NULL) { ++ next = curr->next; ++ free(curr); ++ curr = next; ++ } ++ ilist->dev = 0; ++ ilist->inode = 0; ++ ilist->next = NULL; ++ return 1; ++} ++ ++ ++static int fuser_scan_proc_net(int opts, const char *proto, ++ int port, inode_list *ilist) ++{ ++ char path[PATH_MAX+1], line[FUSER_MAX_LINE+1]; ++ char addr[128]; ++ ino_t tmp_inode; ++ dev_t tmp_dev; ++ int tmp_port; ++ FILE *f; ++ ++ if(!fuser_find_socket_dev(&tmp_dev)) tmp_dev = 0; ++ ++ strncpy(path, FUSER_PROC_DIR, sizeof(FUSER_PROC_DIR)); ++ strncat(path, "/net/", 5); ++ strncat(path, proto, strlen(proto)); ++ ++ if (!(f = fopen(path, "r"))) return 0; ++ while(fgets(line, FUSER_MAX_LINE, f)) { ++ if(sscanf(line, ++ "%*d: %64[0-9A-Fa-f]:%x %*x:%*x %*x %*x:%*x " ++ "%*x:%*x %*x %*d %*d %lu", ++ &addr[0], &tmp_port, &tmp_inode) == 3) { ++ if((strlen(addr) == 8) && ++ (opts & FUSER_OPT_IP6)) continue; ++ else if((strlen(addr) > 8) && ++ (opts & FUSER_OPT_IP4)) continue; ++ if(tmp_port == port) { ++ fuser_add_inode(ilist, tmp_dev, tmp_inode); ++ } ++ } ++ ++ } ++ fclose(f); ++ return 1; ++} ++ ++static int fuser_search_dev_inode(int opts, inode_list *ilist, ++ dev_t dev, ino_t inode) ++{ ++ inode_list *curr; ++ curr = ilist; ++ ++ while(curr) { ++ if((opts & FUSER_OPT_MOUNT) && curr->dev == dev) ++ return 1; ++ if(curr->inode == inode && curr->dev == dev) ++ return 1; ++ curr = curr->next; ++ } ++ return 0; ++} ++ ++static int fuser_scan_pid_maps(int opts, const char *fname, pid_t pid, ++ inode_list *ilist, pid_list *plist) ++{ ++ FILE *file; ++ char line[FUSER_MAX_LINE + 1]; ++ int major, minor; ++ ino_t inode; ++ dev_t dev; ++ char filename[FUSER_MAX_LINE]; ++ ++ if (!(file = fopen(fname, "r"))) return 0; ++ while (fgets(line, FUSER_MAX_LINE, file)) { ++ if(sscanf(line, "%*s %*s %*s %x:%x %ld%*[ \t]%s", ++ &major, &minor, &inode, &filename[0]) < 3) continue; ++ if(major == 0 && minor == 0 && inode == 0) continue; ++ dev = makedev(major, minor); ++ if((opts & FUSER_OPT_SHOWALL) ++ || fuser_search_dev_inode(opts, ilist, dev, inode)) { ++ fuser_add_pid(plist, pid, dev, inode, filename); ++ } ++ } ++ fclose(file); ++ return 1; ++} ++ ++static int fuser_scan_link(int opts, const char *lname, pid_t pid, ++ inode_list *ilist, pid_list *plist) ++{ ++ ino_t inode; ++ dev_t dev; ++ ++ if(!fuser_file_to_dev_inode(lname, &dev, &inode)) return 0; ++ ++ if((opts & FUSER_OPT_SHOWALL) ++ || fuser_search_dev_inode(opts, ilist, dev, inode)) ++ fuser_add_pid(plist, pid, dev, inode, xreadlink(lname)); ++ return 1; ++} ++ ++static int fuser_scan_dir_links(int opts, const char *dname, pid_t pid, ++ inode_list *ilist, pid_list *plist) ++{ ++ DIR *d; ++ struct dirent *de; ++ char *lname; ++ ++ if((d = opendir(dname))) { ++ while((de = readdir(d)) != NULL) { ++ if(!(strcmp(de->d_name, "."))) continue; ++ if(!(strcmp(de->d_name, ".."))) continue; ++ if(asprintf(&lname, "%s/%s", dname, de->d_name) < 0) { ++ free(lname); ++ continue; ++ } ++ fuser_scan_link(opts, lname, pid, ilist, plist); ++ free(lname); ++ } ++ closedir(d); ++ } ++ else return 0; ++ return 1; ++ ++} ++ ++static int fuser_scan_proc_pids(int opts, inode_list *ilist, pid_list *plist) ++{ ++ struct dirent **de; ++ pid_t pid; ++ char *dname; ++ int n = 0, i = 0; ++ ++ n = scandir(FUSER_PROC_DIR, &de, 0, versionsort); ++ if(n < 0) ++ bb_perror_msg_and_die("could not open procfs dir %s", ++ FUSER_PROC_DIR); ++ for(i=0; i<n; i++) { ++ pid = (pid_t)atoi(de[i]->d_name); ++ if(!pid) continue; ++ if(asprintf(&dname, "%s/%d/", FUSER_PROC_DIR, pid) < 0) { ++ free(dname); ++ continue; ++ } ++ if(chdir(dname) < 0) { ++ free(dname); ++ continue; ++ } ++ free(dname); ++ fuser_scan_link(opts, "cwd", pid, ilist, plist); ++ fuser_scan_link(opts, "exe", pid, ilist, plist); ++ fuser_scan_link(opts, "root", pid, ilist, plist); ++ fuser_scan_dir_links(opts, "fd", pid, ilist, plist); ++ fuser_scan_dir_links(opts, "lib", pid, ilist, plist); ++ fuser_scan_dir_links(opts, "mmap", pid, ilist, plist); ++ fuser_scan_pid_maps(opts, "maps", pid, ilist, plist); ++ } ++ return 1; ++} ++ ++static int fuser_print_pid_list(pid_list *plist) { ++ pid_list *curr; ++ curr = plist; ++ ++ if(plist == NULL) return 0; ++ while(curr != NULL) { ++ if(curr->pid > 0) printf("%d ", curr->pid); ++ curr = curr->next; ++ } ++ printf("\n"); ++ return 1; ++} ++ ++static int fuser_kill_pid_list(pid_list *plist, int sig) { ++ pid_list *curr; ++ curr = plist; ++ pid_t mypid = getpid(); ++ int success = 1; ++ ++ if(plist == NULL) return 0; ++ while(curr != NULL) { ++ if(curr->pid > 0 && curr->pid != mypid) { ++ if (kill(curr->pid, sig) != 0) { ++ bb_perror_msg( ++ "Could not kill pid '%d'", curr->pid); ++ success = 0; ++ } ++ } ++ curr = curr->next; ++ } ++ return success; ++} ++ ++extern int fuser_main(int argc, char **argv) { ++ int port, i, optn; ++ int* fni; /* file name indexes of argv */ ++ int fnic = 0; /* file name index count */ ++ const char *proto; ++ static int opt = 0; /* FUSER_OPT_ */ ++ dev_t dev; ++ ino_t inode; ++ pid_list *pids; ++ inode_list *inodes; ++ int killsig = SIGTERM; ++ int success = 1; ++ ++ fni = xmalloc(sizeof(int)); ++ for(i=1;i<argc;i++) { ++ optn = fuser_option(argv[i]); ++ if(optn) opt |= optn; ++ else if(argv[i][0] == '-') { ++ if(!(u_signal_names(argv[i]+1, &killsig, 0))) ++ killsig = SIGTERM; ++ } ++ else { ++ fni = xrealloc(fni, sizeof(int) * (fnic+2)); ++ fni[fnic++] = i; ++ } ++ } ++ if(!fnic) return 1; ++ pids = xmalloc(sizeof(pid_list)); ++ inodes = xmalloc(sizeof(inode_list)); ++ for(i=0;i<fnic;i++) { ++ if(fuser_parse_net_arg(argv[fni[i]], &proto, &port)) { ++ fuser_scan_proc_net(opt, proto, port, inodes); ++ } ++ else { ++ if(!fuser_file_to_dev_inode( ++ argv[fni[i]], &dev, &inode)) { ++ bb_perror_msg_and_die( ++ "Could not open '%s'", argv[fni[i]]); ++ } ++ fuser_add_inode(inodes, dev, inode); ++ } ++ success = fuser_scan_proc_pids(opt, inodes, pids); ++ /* if the first pid in the list is 0, none have been found */ ++ if(pids->pid == 0) success = 0; ++ if(!success) break; ++ if(opt & FUSER_OPT_KILL) { ++ success = fuser_kill_pid_list(pids, killsig); ++ } ++ else if(!(opt & FUSER_OPT_SILENT)) { ++ printf("%s: ", argv[fni[i]]); ++ success = fuser_print_pid_list(pids); ++ } ++ fuser_clear_pid_list(pids); ++ fuser_clear_inode_list(inodes); ++ } ++ /* return 0 on (success == 1) 1 otherwise */ ++ return (success != 1); ++} ++ ++#ifdef CONFIG_FEATURE_FUSER_LSOF ++ ++static int lsof_option(char *option) ++{ ++ if(!(strlen(option))) return 0; ++ if(option[0] != '-') return 0; ++ /* see fuser_option() for an example on how to add options ++ currently none are supported */ ++ bb_error_msg_and_die("Unsupported option '%c'", *option); ++ return 0; ++} ++ ++static int lsof_print_pid_list(pid_list *plist) { ++ pid_list *curr; ++ procps_status_t *ps, *ps_tmp; ++ int nps = 0, n = 0; ++ char *devstr; ++ ++ curr = plist; ++ if(plist == NULL) return 0; ++ ps = xmalloc(sizeof(procps_status_t)); ++#ifdef CONFIG_SELINUX ++ while ((ps_tmp = procps_scan(0, 0, NULL) ) != 0) { ++#else ++ while ((ps_tmp = procps_scan(0)) != 0) { ++#endif ++ n = nps; ++ ps = xrealloc(ps, (++nps)*sizeof(procps_status_t)); ++ memcpy(ps + n, ps_tmp, sizeof(procps_status_t)); ++ } ++ ++ if(curr != NULL) { ++ printf("COMMAND PID USER DEVICE NODE NAME\n"); ++ } ++ while(curr != NULL) { ++ if(curr->pid > 0) { ++ for(n = 0; n < nps; n++) { ++ ps_tmp = ps + n; ++ if(ps_tmp->pid == curr->pid) { ++ printf("%-9.9s ", ps_tmp->short_cmd); ++ printf("%6d ", curr->pid); ++ printf("%7.7s ", ps_tmp->user); ++ } ++ } ++ asprintf(&devstr, "%d,%d", ++ major(curr->dev), minor(curr->dev)); ++ printf("%6.6s", devstr); ++ free(devstr); ++ printf("%10ld ", curr->inode); ++ printf("%s\n", curr->filename); ++ } ++ curr = curr->next; ++ } ++ printf("\n"); ++ return 1; ++} ++ ++extern int lsof_main(int argc, char **argv) { ++ int i, optn; ++ int* fni; /* file name indexes of argv */ ++ int fnic = 0; /* file name index count */ ++ static int opt = 0; /* FUSER_OPT_ */ ++ dev_t dev; ++ ino_t inode; ++ pid_list *pids; ++ inode_list *inodes; ++ int success = 1; ++ ++ fni = xmalloc(sizeof(int)); ++ for(i=1;i<argc;i++) { ++ optn = lsof_option(argv[i]); ++ if(optn) opt |= optn; ++ else { ++ fni = xrealloc(fni, sizeof(int) * (fnic+2)); ++ fni[fnic++] = i; ++ } ++ } ++ pids = xmalloc(sizeof(pid_list)); ++ inodes = xmalloc(sizeof(inode_list)); ++ if(!fnic) { ++ opt |= FUSER_OPT_SHOWALL; ++ success = fuser_scan_proc_pids(opt, inodes, pids); ++ if(success) { ++ success = lsof_print_pid_list(pids); ++ fuser_clear_pid_list(pids); ++ } ++ } ++ else { ++ for(i=0;i<fnic;i++) { ++ if(!fuser_file_to_dev_inode( ++ argv[fni[i]], &dev, &inode)) { ++ bb_perror_msg_and_die( ++ "Could not open '%s'", argv[fni[i]]); ++ } ++ fuser_add_inode(inodes, dev, inode); ++ success = fuser_scan_proc_pids(opt, inodes, pids); ++ if(pids->pid == 0) success = 0; ++ if(!success) break; ++ success = lsof_print_pid_list(pids); ++ fuser_clear_pid_list(pids); ++ fuser_clear_inode_list(inodes); ++ } ++ } ++ /* return 0 on (success == 1) 1 otherwise */ ++ return (success != 1); ++} ++#endif /* CONFIG_FEATURE_FUSER_LSOF */ diff --git a/busybox/busybox-1.00-rc2/busybox-1.00-rc2-modprobe.patch b/busybox/busybox-1.00-rc1/busybox-1.00-rc2-modprobe.patch index e69de29bb2..e69de29bb2 100644 --- a/busybox/busybox-1.00-rc2/busybox-1.00-rc2-modprobe.patch +++ b/busybox/busybox-1.00-rc1/busybox-1.00-rc2-modprobe.patch diff --git a/busybox/busybox-1.00-rc1/busybox-suidinstall.patch b/busybox/busybox-1.00-rc1/busybox-suidinstall.patch new file mode 100644 index 0000000000..b557c74c85 --- /dev/null +++ b/busybox/busybox-1.00-rc1/busybox-suidinstall.patch @@ -0,0 +1,20 @@ +diff -urNd busybox/applets/install.sh busybox-new/applets/install.sh +--- busybox/applets/install.sh 2001-03-08 15:42:11.000000000 -0600 ++++ busybox-new/applets/install.sh 2002-10-11 12:04:01.000000000 -0500 +@@ -15,10 +15,15 @@ + fi + h=`sort busybox.links | uniq` + ++if [ -n "$SUID" ]; then ++ mode=4755 ++else ++ mode=0755 ++fi + + rm -f $prefix/bin/busybox || exit 1 + mkdir -p $prefix/bin || exit 1 +-install -m 755 busybox $prefix/bin/busybox || exit 1 ++install -m $mode busybox $prefix/bin/busybox || exit 1 + + for i in $h ; do + appdir=`dirname $i` diff --git a/busybox/busybox-1.00-rc1/console.patch b/busybox/busybox-1.00-rc1/console.patch new file mode 100644 index 0000000000..d57bdfbe89 --- /dev/null +++ b/busybox/busybox-1.00-rc1/console.patch @@ -0,0 +1,13 @@ +--- busybox-1.00-pre2/libbb/get_console.c~console ++++ busybox-1.00-pre2/libbb/get_console.c +@@ -86,10 +86,6 @@ + { + int fd; + +- if (-1 == (fd = open_a_console("/dev/console"))) +- return -1; +- else +- return fd; + fd = open_a_console(CURRENT_TTY); + if (fd >= 0) + return fd; diff --git a/busybox/busybox-1.00-rc2/cvs20040731.patch b/busybox/busybox-1.00-rc1/cvs20040731.patch index e69de29bb2..e69de29bb2 100644 --- a/busybox/busybox-1.00-rc2/cvs20040731.patch +++ b/busybox/busybox-1.00-rc1/cvs20040731.patch diff --git a/busybox/busybox-1.00-rc2/defconfig b/busybox/busybox-1.00-rc1/defconfig index 783bd27527..783bd27527 100644 --- a/busybox/busybox-1.00-rc2/defconfig +++ b/busybox/busybox-1.00-rc1/defconfig diff --git a/busybox/busybox-1.00-rc1/dhcp-retrytime.patch b/busybox/busybox-1.00-rc1/dhcp-retrytime.patch new file mode 100644 index 0000000000..c4354e6733 --- /dev/null +++ b/busybox/busybox-1.00-rc1/dhcp-retrytime.patch @@ -0,0 +1,46 @@ +--- busybox-1.00-pre2/networking/udhcp/dhcpc.c~dhcp-timeout ++++ busybox-1.00-pre2/networking/udhcp/dhcpc.c +@@ -46,6 +46,7 @@ + static unsigned long requested_ip; /* = 0 */ + static unsigned long server_addr; + static unsigned long timeout; ++static unsigned long retry_time; + static int packet_num; /* = 0 */ + static int fd = -1; + +@@ -175,6 +176,7 @@ + {"quit", no_argument, 0, 'q'}, + {"request", required_argument, 0, 'r'}, + {"script", required_argument, 0, 's'}, ++ {"retrytime", required_argument, 0, 't'}, + {"version", no_argument, 0, 'v'}, + {0, 0, 0, 0} + }; +@@ -182,7 +184,7 @@ + /* get options */ + while (1) { + int option_index = 0; +- c = getopt_long(argc, argv, "c:fbH:h:i:np:qr:s:v", arg_options, &option_index); ++ c = getopt_long(argc, argv, "c:fbH:h:i:np:qr:s:t:v", arg_options, &option_index); + if (c == -1) break; + + switch (c) { +@@ -228,6 +230,9 @@ + case 's': + client_config.script = optarg; + break; ++ case 't': ++ retry_time = atol(optarg); ++ break; + case 'v': + bb_error_msg("version %s\n", VERSION); + return(0); +@@ -306,7 +311,7 @@ + } + /* wait to try again */ + packet_num = 0; +- timeout = now + 60; ++ timeout = now + retry_time; + } + break; + case RENEW_REQUESTED: diff --git a/busybox/busybox-1.00-rc1/hwclock.sh b/busybox/busybox-1.00-rc1/hwclock.sh new file mode 100644 index 0000000000..5acfb9fb24 --- /dev/null +++ b/busybox/busybox-1.00-rc1/hwclock.sh @@ -0,0 +1,74 @@ +#!/bin/sh +# hwclock.sh Set system clock to hardware clock, according to the UTC +# setting in /etc/default/rcS (see also rcS(5)). +# +# WARNING: If your hardware clock is not in UTC/GMT, this script +# must know the local time zone. This information is +# stored in /etc/localtime. This might be a problem if +# your /etc/localtime is a symlink to something in +# /usr/share/zoneinfo AND /usr isn't in the root +# partition! The workaround is to define TZ either +# in /etc/default/rcS, or in the proper place below. + +[ ! -x /sbin/hwclock ] && exit 0 + +. /etc/default/rcS + +case "$1" in + start) + if [ "$VERBOSE" != no ] + then + echo "System time was `date`." + echo "Setting the System Clock using the Hardware Clock as reference..." + fi + + if [ "$HWCLOCKACCESS" != no ] + then + if [ -z "$TZ" ] + then + hwclock --hctosys + else + TZ="$TZ" hwclock --hctosys + fi + fi + + if [ "$VERBOSE" != no ] + then + echo "System Clock set. System local time is now `date`." + fi + ;; + stop|restart|reload|force-reload) + # + # Updates the Hardware Clock with the System Clock time. + # This will *override* any changes made to the Hardware Clock. + # + # WARNING: If you disable this, any changes to the system + # clock will not be carried across reboots. + # + if [ "$VERBOSE" != no ] + then + echo "Saving the System Clock time to the Hardware Clock..." + fi + if [ "$HWCLOCKACCESS" != no ] + then + hwclock --systohc + fi + if [ "$VERBOSE" != no ] + then + echo "Hardware Clock updated to `date`." + fi + exit 0 + ;; + show) + if [ "$HWCLOCKACCESS" != no ] + then + hwclock --show + fi + ;; + *) + echo "Usage: hwclock.sh {start|stop|show|reload|restart}" >&2 + echo " start sets kernel (system) clock from hardware (RTC) clock" >&2 + echo " stop and reload set hardware (RTC) clock from kernel (system) clock" >&2 + exit 1 + ;; +esac diff --git a/busybox/busybox-1.00-rc1/postinst b/busybox/busybox-1.00-rc1/postinst new file mode 100644 index 0000000000..36d8190f80 --- /dev/null +++ b/busybox/busybox-1.00-rc1/postinst @@ -0,0 +1,25 @@ +#!/bin/busybox ash + +action="$1" +oldversion="$2" + +umask 022 + +if /bin/busybox [ "$action" != configure ] +then + exit 0 +fi + +. /etc/default/functions + +setup_init_hwclock() { + updatercd hwclock.sh start 50 S . stop 25 0 1 6 . + /etc/init.d/hwclock.sh restart +} + +/bin/busybox ash /usr/bin/update-alternatives --install /bin/vi vi /bin/busybox 100 +/bin/busybox ash /usr/bin/update-alternatives --install /bin/sh sh /bin/busybox 100 + +setup_init_hwclock + +exit 0 diff --git a/busybox/busybox-1.00-rc1/prerm b/busybox/busybox-1.00-rc1/prerm new file mode 100644 index 0000000000..7ade4b1dec --- /dev/null +++ b/busybox/busybox-1.00-rc1/prerm @@ -0,0 +1,10 @@ +#!/bin/sh + +if [ "$1" != "upgrade" ]; then + update-alternatives --remove sh /bin/busybox + update-alternatives --remove vi /bin/busybox + find /etc -name [SK][0-9][0-9]hwclock.sh | xargs rm -f + find /etc -name [SK][0-9][0-9]syslog | xargs rm -f +fi + +exit 0 diff --git a/busybox/busybox-1.00-rc1/silence-hwclock.patch b/busybox/busybox-1.00-rc1/silence-hwclock.patch new file mode 100644 index 0000000000..3388e8b611 --- /dev/null +++ b/busybox/busybox-1.00-rc1/silence-hwclock.patch @@ -0,0 +1,15 @@ +--- busybox-1.00-pre2/util-linux/hwclock.c~silence-hwclock ++++ busybox-1.00-pre2/util-linux/hwclock.c +@@ -114,12 +114,8 @@ + bb_perror_msg_and_die ( "Could not access RTC" ); + } + +- printf ( "1\n" ); +- + tm = *( utc ? gmtime ( &t ) : localtime ( &t )); + tm. tm_isdst = 0; +- +- printf ( "2\n") ; + + if ( ioctl ( rtc, RTC_SET_TIME, &tm ) < 0 ) + bb_perror_msg_and_die ( "Could not set the RTC time" ); diff --git a/busybox/busybox-1.00-rc1/syslog b/busybox/busybox-1.00-rc1/syslog new file mode 100644 index 0000000000..5c46a28a9a --- /dev/null +++ b/busybox/busybox-1.00-rc1/syslog @@ -0,0 +1,34 @@ +#! /bin/sh +# +# syslog init.d script for busybox syslogd/klogd +# Written by Robert Griebl <sandman@handhelds.org> +# + +# log to remote host +# SYSLOG_ARGS="-R remote.host" + +# log to 16K shm circular buffer +SYSLOG_ARGS="-C" + +set -e + +case "$1" in + start) + echo -n "Starting syslogd/klogd: " + start-stop-daemon -S -b -n syslogd -a /sbin/syslogd -- -n $SYSLOG_ARGS + start-stop-daemon -S -b -n klogd -a /sbin/klogd -- -n + echo "done" + ;; + stop) + echo -n "Stopping syslogd/klogd: " + start-stop-daemon -K -n syslogd + start-stop-daemon -K -n klogd + echo "done" + ;; + *) + echo "Usage: syslog {start|stop}" >&2 + exit 1 + ;; +esac + +exit 0 diff --git a/busybox/busybox-1.00-rc1/tar.patch b/busybox/busybox-1.00-rc1/tar.patch new file mode 100644 index 0000000000..e080275184 --- /dev/null +++ b/busybox/busybox-1.00-rc1/tar.patch @@ -0,0 +1,22 @@ +--- busybox/archival/libunarchive/data_extract_all.c 2002-11-29 01:43:46.000000000 -0500 ++++ busybox-new/archival/libunarchive/data_extract_all.c 2002-12-03 18:38:21.000000000 -0500 +@@ -69,6 +68,9 @@ + case S_IFLNK: + /* Symlink */ + res = symlink(file_header->link_name, file_header->name); ++ if ((res == -1) && (errno == EEXIST) && (unlink(file_header->name) == 0)) { ++ res = symlink(file_header->link_name, file_header->name); ++ } + if ((res == -1) && !(archive_handle->flags & ARCHIVE_EXTRACT_QUIET)) { + perror_msg("Cannot create symlink from %s to '%s'", file_header->name, file_header->link_name); + } +@@ -78,6 +80,9 @@ + case S_IFCHR: + case S_IFIFO: + res = mknod(file_header->name, file_header->mode, file_header->device); ++ if ((res == -1) && (errno == EEXIST) && (unlink(file_header->name) == 0)) { ++ res = mknod(file_header->name, file_header->mode, file_header->device); ++ } + if ((res == -1) && !(archive_handle->flags & ARCHIVE_EXTRACT_QUIET)) { + perror_msg("Cannot create node %s", file_header->name); + } diff --git a/busybox/busybox-1.00-rc2/add-getkey-applet.patch b/busybox/busybox-1.00-rc2/add-getkey-applet.patch deleted file mode 100644 index e69de29bb2..0000000000 --- a/busybox/busybox-1.00-rc2/add-getkey-applet.patch +++ /dev/null diff --git a/busybox/busybox-1.00-rc2/awk.patch b/busybox/busybox-1.00-rc2/awk.patch deleted file mode 100644 index e69de29bb2..0000000000 --- a/busybox/busybox-1.00-rc2/awk.patch +++ /dev/null diff --git a/busybox/busybox-1.00-rc2/bb-iproute-iftunnel.patch b/busybox/busybox-1.00-rc2/bb-iproute-iftunnel.patch deleted file mode 100644 index e69de29bb2..0000000000 --- a/busybox/busybox-1.00-rc2/bb-iproute-iftunnel.patch +++ /dev/null diff --git a/busybox/busybox-1.00-rc2/busybox-1.00-pre10-fuser.patch b/busybox/busybox-1.00-rc2/busybox-1.00-pre10-fuser.patch deleted file mode 100644 index e69de29bb2..0000000000 --- a/busybox/busybox-1.00-rc2/busybox-1.00-pre10-fuser.patch +++ /dev/null diff --git a/busybox/busybox-1.00-rc2/busybox-suidinstall.patch b/busybox/busybox-1.00-rc2/busybox-suidinstall.patch deleted file mode 100644 index e69de29bb2..0000000000 --- a/busybox/busybox-1.00-rc2/busybox-suidinstall.patch +++ /dev/null diff --git a/busybox/busybox-1.00-rc2/console.patch b/busybox/busybox-1.00-rc2/console.patch deleted file mode 100644 index e69de29bb2..0000000000 --- a/busybox/busybox-1.00-rc2/console.patch +++ /dev/null diff --git a/busybox/busybox-1.00-rc2/dhcp-retrytime.patch b/busybox/busybox-1.00-rc2/dhcp-retrytime.patch deleted file mode 100644 index e69de29bb2..0000000000 --- a/busybox/busybox-1.00-rc2/dhcp-retrytime.patch +++ /dev/null diff --git a/busybox/busybox-1.00-rc2/hwclock.sh b/busybox/busybox-1.00-rc2/hwclock.sh deleted file mode 100644 index e69de29bb2..0000000000 --- a/busybox/busybox-1.00-rc2/hwclock.sh +++ /dev/null diff --git a/busybox/busybox-1.00-rc2/postinst b/busybox/busybox-1.00-rc2/postinst deleted file mode 100644 index e69de29bb2..0000000000 --- a/busybox/busybox-1.00-rc2/postinst +++ /dev/null diff --git a/busybox/busybox-1.00-rc2/prerm b/busybox/busybox-1.00-rc2/prerm deleted file mode 100644 index e69de29bb2..0000000000 --- a/busybox/busybox-1.00-rc2/prerm +++ /dev/null diff --git a/busybox/busybox-1.00-rc2/silence-hwclock.patch b/busybox/busybox-1.00-rc2/silence-hwclock.patch deleted file mode 100644 index e69de29bb2..0000000000 --- a/busybox/busybox-1.00-rc2/silence-hwclock.patch +++ /dev/null diff --git a/busybox/busybox-1.00-rc2/syslog b/busybox/busybox-1.00-rc2/syslog deleted file mode 100644 index e69de29bb2..0000000000 --- a/busybox/busybox-1.00-rc2/syslog +++ /dev/null diff --git a/busybox/busybox-1.00-rc2/tar.patch b/busybox/busybox-1.00-rc2/tar.patch deleted file mode 100644 index e69de29bb2..0000000000 --- a/busybox/busybox-1.00-rc2/tar.patch +++ /dev/null diff --git a/busybox/busybox_1.00-rc2.oe b/busybox/busybox_1.00-rc1.oe index c0c767ae6d..e56b0daa8d 100644 --- a/busybox/busybox_1.00-rc2.oe +++ b/busybox/busybox_1.00-rc1.oe @@ -14,8 +14,6 @@ PR = "r2" SRC_URI = "http://www.busybox.net/downloads/busybox-${PV}.tar.gz \ file://add-getkey-applet.patch;patch=1 \ file://bb-iproute-iftunnel.patch;patch=1 \ - file://cvs20040731.patch;patch=1 \ - file://busybox-1.00-rc2-modprobe.patch \ file://defconfig \ file://syslog \ file://hwclock.sh" |