Here is my function in my kernel module which I insert using insmod
command after make
at later stages. I am working on goldfish (2.6.29)
You could perhaps use this:
#include
static int getuid()
{
return current_uid();
}
cred stands for "credentials", and this macro returns the user-id of the currently active credentials. Bear in mind however that the "current user id" can mean multiple things in Linux.
[dan3 obviously didn't have to dig through quite as much code as I did to find this - or he started before me!]