Logo  

CS473 - Computer Networks

Description

Exercise #2

Create two C programs, listen.c and say.c that replicate the functionality of the two bash scripts as closely as possible. Things you may need to know to complete this assignment are:

  • The system calls: fork(2), execve(2)/execlp(3) and wait(2)/waitpid(2) to fork and exec the clear command.
  • The C library function mkfifo(3) or the system call mknod(2) and system call unlink(2) to make the named pipe and later remove it.
  • The system call chmod(2) to set the permissions on the fifo
  • The system calls access(2) and/or stat(2) to test for the existence of the named pipe. (The if [ -p "$pf" ]; then... test)
  • The signal(2)/sigaction(2) to handle trapping the the Ctrl-C in the listen program.