Operating Systems 2017F: Tutorial 6

From Soma-notes
Revision as of 21:21, 12 November 2017 by Soma (talk | contribs)

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

  1. Build and run newgetpid.c as demonstrated in Lecture 16 and as we did in the previous tutorial.
  2. What type is "current"? How can you figure this out?
  3. Modify newgetpid.c so that it creates a device file /dev/describe rather than /dev/newgetpid.
  4. 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).
  5. (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:
    1. 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.