Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

kernel code question

Name: Anonymous 2009-10-10 5:33

Yes, this is homework. No, I don't want /prog/ to do it for me, I'm simply not quite sure how to do something and would like a push in the right direction or a reference of some sort.

In brief, I am implementing a new syscall in the Linux kernel, and I need to get the user making the system call. Poking around told me that it is better to get the UID with getuid() because the kernel doesn't know about usernames, but how do I then get the username?

I hate this course, we learn general theory about operating system design (which is great) but then suddenly we are told to do specific modifications in the Linux kernel without having been taught the basics of how things work in the Linux kernel. i have no aversion to learning on my own, but that is a LOT to learn in a couple weeks' time with a full schedule.

Anyway, any gentle nudge in the right direction would be greatly appreciated.

Name: Anonymous 2009-10-10 5:51

Thanks for the replies, but I think I phrased my problem incorrectly - sorry, I'm tired.

The code I'm writing runs in the kernel, and I need to get the username of the user that made the system call. In the function I wrote, how might I go about finding out which user has called the function? I looked at getuid() for example, but that returns the UID of the current process, and therefore doesn't make sense to call within the kernel.

I am getting data from user space memory, so my first thought was whether there is some way to check which process (and thus which UID and which username) is associated with the memory being passed, I'm still googling but I haven't found anything.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List