Operating Systems 2017F: Tutorial 6
In this tutorial you will be running and modifying newgetpid.c from Lecture 16. You will likely want to look at the Linux kernel source, particularly kernel/sys.c.
Tasks
- Build and run newgetpid.c as demonstrated in Lecture 16 and as we did in the previous tutorial.
- What type is "current"? How can you figure this out?
- Modify newgetpid.c so that it creates a device file /dev/describe rather than /dev/newgetpid.
- Make /dev/describe output the calling process's parent ID (ppid), user ID (uid), group ID (gid), effective user ID (euid), and effective group ID (egid).
- (Advanced) Modify /dev/describe so that if you write a process ID to it, it will output the information on the provided process. To make this work, you'll need to:
- Find the right task struct following the implementation of the kill system call, and how it looks up the pid struct and then kill_pid_info() iterates through the task list.