You can't call any userspace functions from the kernel, including  
standard c defined functions like memcpy and printf.

There are some decent articles out there on writing kernel modules  
that cover this and other gotchas.

~Ryan

On 28-Oct-08, at 5:44 PM, gerbilio <[EMAIL PROTECTED]> wrote:

>
> I am trying to write a kernel module that will call the getpid()
> routine.  However, it doesn't seem to be defined in the kernel
> headers--though it is defined in /usr/include.  I'm using the
> following make file for kernel modules:
>
>  obj-m += a4.o
>
>  all:
>    make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
>
>  clean:
>    make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
>
> and it keeps flagging getpid() as not defined.
>
> Also, getpid() is supposed to need the following:
>
>  #include <sys/types.h>
>  #include <unistd.h>
>
> but it can't find these header files in the kernel headers.
>
> What's the story?  What do I have to do to get this to work?
>
> TIA,  Matt
> >

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Linux Users Group.
To post a message, send email to [email protected]
To unsubscribe, send email to [EMAIL PROTECTED]
For more options, visit our group at 
http://groups.google.com/group/linuxusersgroup
-~----------~----~----~----~------~----~------~--~---

Reply via email to