[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
unresolved: htonl(), htons(), __memcpy3d
Hello,
The below file contains a few trivial modifications to hello.c from the
The Linux Kernel Module Programming Guide but the example shows my
problem. I'm running linux-2.4.2, gcc 2.95.2. Here's the output from
gcc:
gcc -Wall -DMODULE -D__KERNEL__ -DLINUX -c testprog.c -I/usr/src/linux/include
testprog.c: In function `init_module':
testprog.c:20: warning: implicit declaration of function
`printk_R1b7d4074'
testprog.c:16: warning: unused variable `tmp2'
testprog.c:15: warning: unused variable `tmp1'
A few warnings, no big deal. However when I load the module i get:
insmod ./testprog.o
./testprog.o: unresolved symbol htonl
./testprog.o: unresolved symbol htons
./testprog.o: unresolved symbol __memcpy3d
I'm using memcpy() which is declared in linux/string.h and I'm including
linux/byteorder/generic.h which is supposed to #define htonl() and company
as macros. Any insight to what I'm doing wrong here would be helpful.
Thanks.
---------------------- cut below here ------------------------------
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/string.h>
#include <linux/byteorder/generic.h>
#if CONFIG_MODVERSIONS==1
#define MODVERSIONS
#include <linux/modversions.h>
#endif
int init_module()
{
int tmp1 = htonl (68000);
short tmp2 = htons (35);
char buf1[5] = { 't', 'e', 's', 't', '\0' };
char buf2[5];
printk("Hello, world - this is the kernel speaking\n");
memcpy (buf1, buf2, strlen (buf1) + 1);
return 0;
}
void cleanup_module()
{
printk("Short is the life of a kernel module\n");
}
---------------------- cut above here -------------------------
-Michael F. Brown, UMass Lowell Computer Science
phone: (978) 934-5354
email: mbrown@cs.uml.edu
"In theory, there is no difference between theory and practice,
but in practice, there is." - Jan L.A. van de Snepscheut
-
Kernelnewbies: Help each other learn about the Linux kernel.
Archive: http://mail.nl.linux.org/
IRC Channel: irc.openprojects.net / #kernelnewbies
Web Page: http://www.surriel.com/kernelnewbies.shtml