Total Points: 200
Due Date: Friday, December 11, 1998
The interface to my_system is identical to that of system(3), as is its functionality.
Hints: To write the function, in the parent ignore all signals. Then fork, and restore the previous signals in the child. (Use signal(3) for this.) Clean up the environment in the child, and then execve(2) the desired program. Meanwhile, in the parent, we do a wait(2) for the child process, and when the child terminates, we restore the old values of the signals. Please change the process environment after the fork(2). if you change it before the fork, you will change the parent process' environment, which is not correct!
You may find the program printenv(1) useful; it prints a list of all environment variables defined to it, so you can use it to see what environment variables are defined
Note: you may use any language you like, but the result must be a library function that can be called from a C program.
Also, the program ~cs153/tester.c is a primitive driver that you can use to test your library routine. (We will use the same sort of program, but with canned commands, to test your library function.) You need to create a Makefile that will compile your library routine, the tester.c program, link them, and call the executable tester. Please submit this Makefile, along with your library routine. Do not submit the tester.c program because we will use a modified version of the sample!
Department of Computer Science
University of California at Davis
Davis, CA 95616-8562