[PATCH] Fix unix module

From: Rusty Russell
Date: Sun Apr 18 2004 - 00:34:28 EST

Linus, please apply. I should never have accepted that damn "make
modpost create the struct module" patch during the stable series: this
is at least the third fix which had to go on top of it...

Name: Fix name of unix domain sockets module
Status: Tested on 2.6.6-rc1-bk2

# lsmod
Module Size Used by
1 26060 6

The compiler #define's unix to 1: we use -DKBUILD_MODNAME=unix. We
used to #undef unix at the top of af_unix.c, but now the name is
inserted by modpost, that doesn't help.

#undef unix in modpost.c's generated C file.

diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.6.6-rc1-bk2/net/unix/af_unix.c working-2.6.6-rc1-bk2-usermodehelper-thread/net/unix/af_unix.c
--- linux-2.6.6-rc1-bk2/net/unix/af_unix.c 2004-04-05 09:04:50.000000000 +1000
+++ working-2.6.6-rc1-bk2-usermodehelper-thread/net/unix/af_unix.c 2004-04-18 15:22:23.000000000 +1000
@@ -82,8 +82,6 @@
* with BSD names.

-#undef unix /* KBUILD_MODNAME */
#include <linux/module.h>
#include <linux/config.h>
#include <linux/kernel.h>
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.6.6-rc1-bk2/scripts/modpost.c working-2.6.6-rc1-bk2-usermodehelper-thread/scripts/modpost.c
--- linux-2.6.6-rc1-bk2/scripts/modpost.c 2004-04-15 16:06:55.000000000 +1000
+++ working-2.6.6-rc1-bk2-usermodehelper-thread/scripts/modpost.c 2004-04-18 15:22:07.000000000 +1000
@@ -487,6 +487,7 @@ add_header(struct buffer *b)
buf_printf(b, "\n");
buf_printf(b, "MODULE_INFO(vermagic, VERMAGIC_STRING);\n");
buf_printf(b, "\n");
+ buf_printf(b, "#undef unix\n"); /* We have a module called "unix" */
buf_printf(b, "struct module __this_module\n");
buf_printf(b, "__attribute__((section(\".gnu.linkonce.this_module\"))) = {\n");
buf_printf(b, " .name = __stringify(KBUILD_MODNAME),\n");

Anyone who quotes me in their signature is an idiot -- Rusty Russell

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/