Creating System Call, need PID of caller

Hey

I am creating a new system call that needs to know the PID of the calling process. I am new to coding in the kernel, so I don't know if this is possible... Any help would be nice.

Thanks!
Hapatchi

Perhaps try using getppid()or getpid()

Does that work from the kernel? I thought that because the process that made the call was technically no longer executing its code that this would not be valid.

If this is not the case though, than thanks!
I'll give it a shot.
Hapatchi

EDIT:
I can't seem to get either one to work. Mainly, this is because I can't seem to include <sys/types.h>. It can be included from non-kernel files, but the kernel doesn't like having it... Ideas?

You can use the current macro to retrieve it from the task struct i.e.

printk("Current PID is  %d\n", current->pid);

Aha! You, good sir, are a genius.

Thanks a bunch
Hapatchi