All work should be done on a machine in the department's Linux cluster. You can refer to ssh for more information on how to log into a remote machine.
Part 1 | 6 points |
Part 2 | 6 points |
TOTAL | 12 points |
Part 1: Signal Handling.
Please follow these steps to finish this part smoothly:
gosh> ls -a -l -d /etc
c1 0: ls
c1 1: -a
c1 2: -l
c1 3: -d
c1 4: /etc
gosh>
gosh>
gosh>
gosh>
gosh>
gosh> exit
hangao@gawaine:~/cspp51081/LAB5$
Step 2: Fork/Exec
Write a simple fork/execvp procedure to execute
command c1 in a
child process. If the command inputted does not exist, the
child should
print an error message and exit. The relevant examples (C
code) from
the book are here: create a child process with fork and
wait for its termination,
replace a process image (details: BLP, chapter 10).
gosh> ls -l /etc/passwd
c1 0: ls
c1 1: -l
c1 2: /etc/passwd
Running Command
---------------
lrwxrwxrwx 1 root root 14 Jul 6 1999 /etc/passwd
-> ./local/passwd
---------------
Command Returned Exit Code 0
gosh>
Carefully follow the steps below.