Operating Systems 2017F: Tutorial 6: Difference between revisions
Created page with "In this tutorial you will be running and modifying [http://homeostasis.scs.carleton.ca/~soma/os-2017f/code/lec16/newgetpid.zip newgetpid.c] from Operating Systems 2017F Lect..." |
No edit summary |
||
Line 1: | Line 1: | ||
In this tutorial you will be running and modifying [http://homeostasis.scs.carleton.ca/~soma/os-2017f/code/lec16/newgetpid.zip newgetpid.c] from [[Operating Systems 2017F Lecture 16|Lecture 16]]. | In this tutorial you will be running and modifying [http://homeostasis.scs.carleton.ca/~soma/os-2017f/code/lec16/newgetpid.zip newgetpid.c] from [[Operating Systems 2017F Lecture 16|Lecture 16]]. You will likely want to look at the Linux kernel source, particularly [http://elixir.free-electrons.com/linux/v4.4.88/source/kernel/sys.c 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 [http://elixir.free-electrons.com/linux/v4.4.88/source/kernel/signal.c#L2855 kill system call], and how it [http://elixir.free-electrons.com/linux/v4.4.88/source/kernel/signal.c#L1388 looks up the pid struct] and then [http://elixir.free-electrons.com/linux/v4.4.88/ident/kill_pid_info kill_pid_info() iterates through the task list]. |
Revision as of 21:21, 12 November 2017
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.