COMP4430 Operating Systems 2
Project


Preliminaries...

You will use the Westeel Teaching Laboratory (a.k.a. Department of Computer Science Systems Laboratory) located in room E2-438. This lab has 25 computers with the following (relevant) characteristics: The computers in the lab are only connected to one server and they do not have Internet access. So, you should consider them as standalone computers with a *local* file server (with only kernel sources). There are only two userids defined on them: root and test.

First, get your own copy of the kernel source from the server (note that your working directory is on the local disk, whereas the original source tree is on a mounted read-only partition):

[root@localhost ~]# cd /usr/src/redhat.FC6/BUILD
[root@localhost ~]# cp -R /usr/src/redhat/BUILD/kernel-2.6.18/ .
You can now carry on with the project, starting at Phase 1.

WARNING!!! You should keep a copy of your modifications at the end of your session and delete the your working kernel to protect your work.

The project...

In this project, you are required to dissect the Linux kernel version 2.6.18 and add some new functionality at each of the four stages. Although the stages are not related to each other, you may be able to use the expertise that you've acquired during a phase for the later phase(s). Thus, you are advised to work on them in the given order:

Notes:

There seems to be some confusion on crafting new system calls in the Linux kernel. Hopefully, the following will clarify the problem:

The stub is defined in a header file (suspend.h) below, which is included in the user space program (it is located in /usr/include/linux directory.

Add the red line to your user callable header (260 is the system call number that corresponds to your new function).

/*
 *  User space suspend header file
 *
 */

/* header files */
#include <linux/unistd.h>
#include <errno.h>
#define __NR_suspend 260
/* stub function for the suspend systen call, it takes no argument */
_syscall0(void, suspend);
Partial entry.S file:

/*
 *  linux/arch/i386/entry.S
 *
 *  Copyright (C) 1991, 1992  Linus Torvalds
 */
...
	.long SYMBOL_NAME(sys_suspend)		/* 260 */
The (kernel) function suspend() is defined as follows:
#include <linux/suspend.h> /* for local stuff. This is *not*
                              the header file above. This file
                              is located in:
                  /usr/src/linux-x.yy.zz-t/include/linux */
...
/* suspend system call function */
asmlinkage void sys_suspend()
{
 ...
}
And the new system call can be used in a user program as follows:
#include <linux/suspend.h>

/* main */
int main()
{
...
printf("I am the %d. child\n", i + 1);
/* suspend the child process  */
suspend();
printf("I am the %d. suspended child\n", i + 1);
...

Valid HTML 4.01 Transitional Copyright © Dr. Rasit Eskicioglu
Last update: