7. Configuration and Execution

Your program invokes functions that are privileged. Thus, before you can run it, you need to add a file named lab4 to the /etc/system.conf.d/ directory to grant your program the necessary permissions.

Unless you use privileged functions that are not really necessary, the following entry is enough:

service lab4 { system DEVIO IRQCTL ; ipc SYSTEM rs vm pm vfs ; io 40:4 60 64 ; irq 0 # TIMER 0 IRQ 1 # KBD IRQ 12 # AUX/MOUSE IRQ ; uid 0 ; };

I suggest that you add the new entries (actually only the IRQ for the mouse) to the configuration file you have used in previous labs.

IMP. Do not forget to change the name of the service in the first line to lab4.

Once you have created the file with the permissions, you can execute your program using the service command. Given that your program should be privileged, you must run it as user root. Thus, assuming that you are logged in as user lcom and your shell's current directory is /home/lcom/lab4, you can issue the following commands:

$ su # service run `pwd`/lab4 [-args "< list of space separated arguments >"]

Here we assume that your main() is similar to the one we provided in lab2.c. (You'll score points for this.)

Note The `pwd` expression evaluates to the output of the command pwd, which returns the present working directory (/home/lcom/lab4, according to our assumptions). This is simpler than having to type the full path:

# service run /home/lcom/lab4/lab4 [-args "< list of space separated arguments >"]