Results 1 to 3 of 3
hello all,
I am trying to define a new system call which returns the current session's username. But the functions such as geteuid(), getpwd() all require pwd.h header file, which ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 04-18-2010 #1Just Joined!
- Join Date
- Mar 2010
- Posts
- 3
how to get username of the current session in a system call?
hello all,
I am trying to define a new system call which returns the current session's username. But the functions such as geteuid(), getpwd() all require pwd.h header file, which the is not present in the kernel.
Even header files like stdlib.h is giving some errors while recompiling the kernel.
"no such file or directory"
so cant we include any such header files in a system call?
Is there a way to get the present session's Username or UID in a systemcall?
- 04-18-2010 #2
You can't use the standard libraries in kernel modules.
If you need to retrieve this info try including linux/sched.h and using current.
Here's an example of its usage:
Linux Kernel Module Programming Guide - System CallsMake mine Arch Linux
- 04-18-2010 #3Just Joined!
- Join Date
- Mar 2010
- Posts
- 3
Thanks very much for the link. It was very helpful


Reply With Quote
