[prev in list] [next in list] [prev in thread] [next in thread]
List: busybox
Subject: [BusyBox] [PATCH] rmmod applet and 2.4/2.6 modules
From: Cristian Ionescu-Idbohrn <cristian.ionescu-idbohrn () axis ! com>
Date: 2005-03-22 12:04:53
Message-ID: 0503221250240.27474 () pvpreb ! fr ! nkvf ! pbz
[Download RAW message or body]
The patch should help rmmod work as expected with both:
CONFIG_FEATURE_2_4_MODULES=y
CONFIG_FEATURE_2_6_MODULES=y
enabled, by digging up the kernel version at run time.
/Cristian
["rmmod.c.diff" (TEXT/PLAIN)]
--- rmmod.c.orig 15 Oct 2004 09:19:25 -0000
+++ rmmod.c 19 Mar 2005 15:06:53 -0000
@@ -27,6 +27,7 @@
#include <getopt.h>
#include <fcntl.h>
#include <string.h>
+#include <sys/utsname.h>
#include <sys/syscall.h>
#include "busybox.h"
@@ -44,7 +45,17 @@ static inline void filename2modname(char
/* Convert to underscores, stop at first . */
for (i = 0; afterslash[i] && afterslash[i] != '.'; i++) {
- if (afterslash[i] == '-')
+ unsigned int kr_chk = 1;
+
+#ifdef CONFIG_FEATURE_2_4_MODULES
+ struct utsname uname_info;
+
+ if (uname(&uname_info) == -1)
+ bb_error_msg_and_die("cannot get uname data");
+ if (strcmp(uname_info.release, "2.6") < 0)
+ kr_chk = 0;
+#endif
+ if ((kr_chk == 1) && (afterslash[i] == '-'))
modname[i] = '_';
else
modname[i] = afterslash[i];
_______________________________________________
busybox mailing list
busybox@mail.busybox.net
http://codepoet.org/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic