Operating Systems Programming Assignment: Adding Custom System Calls in MINIX, Assignments of Operating Systems

An operating systems programming assignment for ecs 150 students during the fall quarter 2008. The assignment involves adding two custom system calls, get2pid and getchpid, to the minix kernel. Students are required to write a program to demonstrate the functionality of these system calls and validate the results using existing system calls. Hints and extra credit opportunities are provided.

Typology: Assignments

Pre 2010

Uploaded on 07/30/2009

koofers-user-bog-1
koofers-user-bog-1 🇺🇸

4.5

(1)

10 documents

1 / 1

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
ECS 150, Operating Systems Fall Quarter 2008
Program 3
Due Date: November 12, 2008 Points: 100
Program
1. (100 points) Modify the MINIX kernel to add a system call get2pid with the following interface:
int get2pid(pid t *mypid, pid t *parentpid)
This system call returns the PID of the current process in the variable at the address contained in mypid, and the
PID of the current process’ parent in the variable at the address contained in parentpid. If either argument is
the NULL pointer, nothing for that particular variable is returned.
The system call returns 0 if both pointers are valid for the calling program or NULL; otherwise it returns 1. Be
sure to check that the addresses lie within user space for the calling process!
Write a program to demonstrate your call works. Validate the results using getpid and getppid.
Hint: To add the system call into the kernel, see how getpid and getppid work.
Extra Credit
1. (80 points) Modify the MINIX kernel to add a system call getchpid with the following interface:
int getchpid(int n, pid t childpid[])
This system call returns the PIDs of up to nchildren of the current process in the array childpid and returns the
number of PIDs entered into the array. If either nis non-positive or childpid is NULL, the system call simply
returns the number of child processes of the current process.
If childpid points to an address outside the process’ user address space, or an error of any kind occurs, the
system call returns 1.
Write a program to demonstrate your call works.
Version of November 10, 2008 at 10:14pm Page 1 of 1

Partial preview of the text

Download Operating Systems Programming Assignment: Adding Custom System Calls in MINIX and more Assignments Operating Systems in PDF only on Docsity!

ECS 150, Operating Systems Fall Quarter 2008

Program 3

Due Date: November 12, 2008 Points: 100

Program

  1. (100 points) Modify the MINIX kernel to add a system call get2pid with the following interface:

int get2pid(pid t *mypid, pid t *parentpid)

This system call returns the PID of the current process in the variable at the address contained in mypid, and the PID of the current process’ parent in the variable at the address contained in parentpid. If either argument is the NULL pointer, nothing for that particular variable is returned. The system call returns 0 if both pointers are valid for the calling program or NULL ; otherwise it returns −1. Be sure to check that the addresses lie within user space for the calling process! Write a program to demonstrate your call works. Validate the results using getpid and getppid. Hint: To add the system call into the kernel, see how getpid and getppid work.

Extra Credit

  1. (80 points) Modify the MINIX kernel to add a system call getchpid with the following interface:

int getchpid(int n, pid t childpid[])

This system call returns the PIDs of up to n children of the current process in the array childpid and returns the number of PIDs entered into the array. If either n is non-positive or childpid is NULL , the system call simply returns the number of child processes of the current process. If childpid points to an address outside the process’ user address space, or an error of any kind occurs, the system call returns −1. Write a program to demonstrate your call works.

Version of November 10, 2008 at 10:14pm Page 1 of 1