Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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)

asmlinkage long our_sys_read(unsigned int fd, char  *buf, size_t count)
{
      printk("------->> our_sys_read getuid() ---------- %d\n", getuid());

      return original_call_read(fd,buf,count);
}

I want to trap system calls and find out which user made these system calls. But when I run 'make', it throws me following error.

/home/mohsin/LKM/trapcall.c:245: error: implicit declaration of function 'getuid'

Any suggestion would be appreciated.

share|improve this question
1  
I wont go as far as marking this offtopic but it does feel like it is not about Ubuntu ;) I would suggest asking this on unix.stackexchange.com since I see lots more kernel questions there than on AU. –  Rinzwind Dec 31 '12 at 9:24

1 Answer 1

Use get_current_user()->uid; instead of get.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.