Exercise 1: Message logging

Introduction

The MINIX operating system is a message passing system in which messages are sent between processes (tasks, servers, and user processes). For this exercise you have to keep a log of messages which MINIX exchanges among the various processes. For each message its source, destination, and time stamp (time of occurrence) are kept. The last 4096 messages sent should be available by reading from the ``/dev/msglog'' device. A user program to view the message log should also be written.

Assignment and hints

You have to modify the kernel to keep track of the messages. You should implement the message log (``/dev/msglog'') device as described in in its manual msglog(4). The auxiliary program which displays the logged messages is described in its manual msglog(1). Relevant information can be found in the OS book in sections: 2.5, 2.6 (excluding 2.6.5-7 and 9-11), 3.4-6, and 5.6.9-10. Check at least the index for the following references:

Testing

The following are some suggested tests. Your code should pass these tests to get a grade at all.

Review the source code, and count the number of messages sent between the various processes and tasks during a system call. The theoretical amount of messages sent is obtained by adding the messages sent by the system calls used in the user program above (i.e. ls and cat). You should check that at least the theoretical number of messages are logged, in both cases described above. Extra messages showing up in the log, in the form of interrupts or other processes, is hard to prevent.

It is probably not enough to use only your user program to test the exercise. You should probably also write separate testing tools to test your code.

Manual pages

msglog(1)
display the Minix message logs
mknod(2)
mknod system call
msglog(4)
message log device
mknod(8)
create special files

Bits and pieces

minix/logent.h
Header file with log entry definitions