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)
insmod
make
goldfish (2.6.29)
You need to call current_uid(), defined in linux/cred.h (starting with 2.6, used to be current->uid before). See the kernel doc about credentials
current is a macro, BTW.