In: Computer Science
Parse the file /usr/src/include/minix/ipc.h (Struct message) Modify the newly created system call to receive and print a parameter of type long through the structure “message” (the System_Calls_in_Minix.pdf file may be helpful). From the test file, the parameter must be sent to the user library created in the previous exercise, which in turn sends the parameter to the syscall. Your library must use the M4 type message. The system call must print the arbitrary number sent by the user code through the library. The output format must be: Hi! The number is: <number> where <number> is the value of the parameter sent to the library through the message. Include in the answer the definitions of the functions: int do_mycall () { } int mycall (long integer) { } in that order, as defined and tested on your copy of minix.
Profiling is controlled using the profile program. This is its Usage:output:
Statistical Profiling:
profile start [-m memsize] [-o outfile] [-f frequency]
profile stop
Call Profiling:
profile get [-m memsize] [-o outfile]
profile reset
- memsize in MB, default: 64
- default output file: profile.{stat|call}.out
- sample frequencies (default: 6):
3 8192 Hz 10 64 Hz
4 4096 Hz 11 32 Hz
5 2048 Hz 12 16 Hz
6 1024 Hz 13 8 Hz
7 512 Hz 14 4 Hz
8 256 Hz 15 2 Hz
9 128 Hz
Use [sc]profalyze.pl to analyze output file.Before you can profile, you have to prepare the operating system. See the paragraphs below. To run the analyzer scripts, Perl must be installed. This is easily done using the packman installer program that is part of MINIX 3. No additional Perl modules are needed. For statistical profiling the sprofalyze.pl script is used. This is its Usage:output:
sprofalyze.pl [-p percentage] file ...
percentage print only processes/functions >= percentage
And for call profiling the
cprofalyze.pl script is used. This is its Usage:output:
cprofalyze.pl <clock> [-f] [-aoct] [-i] [-n number] file ...
clock CPU clock of source machine in MHz (mandatory)
Some entries from /usr/src/servers/fs/table
Unused entries
Using entry 69:
PROTOTYPE( int do_printmessage, (void) );
Our system call handler
Int do_printmessage()
{printf(“\I am a system call\n”);
return (OK);
}
Message Structure:
Retrieving Parameters From the Message Structure:
Using the New System Call:
#include<stdio.h>
int main()
{
printmessage();
}