[BusyBox] Patch for better devfs support
Martin Sieper
msi at gelsen.net
Fri Jul 20 12:07:33 UTC 2001
Hi,
I'm using the Device File System of the kernel 2.4.x. Some bb-applets have
little problems with this. I've fix the problems. Please see my
patch. I think the bb support for the devfs is now better.
--
Cordialy
Martin Sieper
______________________________________________________________
| E-Mail ...................... msi at gelsen.net |
| ............................. msi at rocklinux.org |
| Homepage .................... http://home.gelsen-net.de/~msi |
|______________________________________________________________|
| Close your windows and open your mind. |
|--- --- --- --- --- --- --- -- -- --- --- --- --- --- --- ---|
| ROCK Linux |
| This will ROCK you! |
| http://www.rocklinux.org |
|______________________________________________________________|
-------------- next part --------------
--- libbb/get_console.c.orig Fri Mar 16 23:47:14 2001
+++ libbb/get_console.c Fri Jul 20 19:36:47 2001
@@ -98,6 +98,10 @@
return fd;
}
+ fd = open_a_console("/dev/vc/0");
+ if (fd >= 0)
+ return fd;
+
fd = open_a_console("/dev/tty");
if (fd >= 0)
return fd;
--- libbb/loop.c.orig Fri Mar 16 23:47:14 2001
+++ libbb/loop.c Fri Jul 20 19:41:47 2001
@@ -104,6 +104,20 @@
sprintf(dev, "/dev/loop%d", i);
if (stat(dev, &statbuf) == 0 && S_ISBLK(statbuf.st_mode)) {
if ((fd = open(dev, O_RDONLY)) >= 0) {
+ if (ioctl(fd, LOOP_GET_STATUS, &loopinfo) == -1) {
+ if (errno == ENXIO) { /* probably free */
+ close(fd);
+ return strdup(dev);
+ }
+ }
+ close(fd);
+ }
+ }
+ }
+ for (i = 0; i <= 7; i++) {
+ sprintf(dev, "/dev/loop/%d", i);
+ if (stat(dev, &statbuf) == 0 && S_ISBLK(statbuf.st_mode)) {
+ if ((fd = open(dev, O_RDONLY)) >= 0) {
if (ioctl(fd, LOOP_GET_STATUS, &loopinfo) != 0) {
if (errno == ENXIO) { /* probably free */
close(fd);
--- dumpkmap.c.orig Tue Feb 20 07:14:07 2001
+++ dumpkmap.c Fri Jul 20 19:10:38 2001
@@ -53,8 +53,11 @@
fd = open("/dev/tty0", O_RDWR);
if (fd < 0) {
- perror_msg("Error opening /dev/tty0");
- return EXIT_FAILURE;
+ fd = open("/dev/vc/0", O_RDWR);
+ if (fd < 0) {
+ perror_msg("Error opening /dev/tty0 (/dev/vc/0)");
+ return EXIT_FAILURE;
+ }
}
write(1, magic, 7);
--- fbset.c.orig Thu Mar 15 19:14:25 2001
+++ fbset.c Fri Jul 20 19:15:03 2001
@@ -35,6 +35,7 @@
#include "busybox.h"
#define DEFAULTFBDEV "/dev/fb0"
+#define DEVFS_DEFAULTFBDEV "/dev/fb/0"
#define DEFAULTFBMODE "/etc/fb.modes"
static const int OPT_CHANGE = (1 << 0);
@@ -401,8 +402,12 @@
}
}
- if ((fh = open(fbdev, O_RDONLY)) < 0)
- perror_msg_and_die("fbset(open)");
+ if ((fh = open(fbdev, O_RDONLY)) < 0) {
+ fbdev = DEVFS_DEFAULTFBDEV;
+ if ((fh = open(fbdev, O_RDONLY)) < 0) {
+ perror_msg_and_die("fbset(open)");
+ }
+ }
if (ioctl(fh, FBIOGET_VSCREENINFO, &var))
perror_msg_and_die("fbset(ioctl)");
if (g_options & OPT_READMODE) {
--- loadacm.c.orig Fri Mar 23 18:03:28 2001
+++ loadacm.c Fri Jul 20 19:16:42 2001
@@ -39,7 +39,7 @@
fd = open("/dev/tty", O_RDWR);
if (fd < 0) {
- perror_msg_and_die("Error opening /dev/tty1");
+ perror_msg_and_die("Error opening /dev/tty");
}
if (screen_map_load(fd, stdin)) {
--- loadfont.c.orig Tue Feb 20 07:14:07 2001
+++ loadfont.c Fri Jul 20 19:18:53 2001
@@ -47,8 +47,12 @@
show_usage();
fd = open("/dev/tty0", O_RDWR);
- if (fd < 0)
- perror_msg_and_die("Error opening /dev/tty0");
+ if (fd < 0) {
+ fd = open("/dev/vc/0", O_RDWR);
+ if (fd < 0) {
+ perror_msg_and_die("Error opening /dev/tty0 (/dev/vc/0)");
+ }
+ }
loadnewfont(fd);
return EXIT_SUCCESS;
--- loadkmap.c.orig Tue Feb 20 07:14:07 2001
+++ loadkmap.c Fri Jul 20 19:20:33 2001
@@ -54,8 +54,12 @@
show_usage();
fd = open("/dev/tty0", O_RDWR);
- if (fd < 0)
- perror_msg_and_die("Error opening /dev/tty0");
+ if (fd < 0) {
+ fd = open("/dev/vc/0", O_RDWR);
+ if (fd < 0) {
+ perror_msg_and_die("Error opening /dev/tty0 (/dev/vc/0)");
+ }
+ }
read(0, buff, 7);
if (0 != strncmp(buff, BINARY_KEYMAP_MAGIC, 7))
More information about the busybox
mailing list