Find the answer to your Linux question:
Results 1 to 3 of 3
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    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?

  2. #2
    Linux Enthusiast gerard4143's Avatar
    Join Date
    Dec 2007
    Canada, Prince Edward Island
    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 Calls
    Make mine Arch Linux

  3. #3
    Thanks very much for the link. It was very helpful

  4. $spacer_open

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts