Matt Ramsay CS 375 Programming Assignment 5, Part 1 ... - csserver
Matt Ramsay CS 375 Programming Assignment 5, Part 1 ... - csserver
Matt Ramsay CS 375 Programming Assignment 5, Part 1 ... - csserver
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
<strong>Matt</strong> <strong>Ramsay</strong><br />
<strong>CS</strong> <strong>375</strong><br />
<strong>Programming</strong> <strong>Assignment</strong> 5, <strong>Part</strong> 1<br />
3/26/02<br />
• Execution Example<br />
<strong>csserver</strong>:/home/mr56/<strong>CS</strong><strong>375</strong>/PA5_1 > sigtest<br />
sigtest is running in the backround with PID 17752<br />
<strong>csserver</strong>:/home/mr56/<strong>CS</strong><strong>375</strong>/PA5_1 > kill -USR1 17752<br />
3.14159265358979323844<br />
• Execution Example 2<br />
<strong>csserver</strong>:/home/mr56/<strong>CS</strong><strong>375</strong>/PA5_1 > sigtest<br />
sigtest is running in the backround with PID 17795<br />
<strong>csserver</strong>:/home/mr56/<strong>CS</strong><strong>375</strong>/PA5_1 > kill -USR2 17795<br />
2.71828182845904523536<br />
• Code:<br />
#include <br />
#include <br />
#include <br />
#include <br />
#include <br />
#include <br />
#include <br />
using namespace std;<br />
void exit1(int sig)<br />
{<br />
system("echo \"4*a(1)\" | bc -l");<br />
(void) signal(SIGUSR1, SIG_DFL);<br />
exit (0);<br />
}<br />
void exit2(int sig)<br />
{
}<br />
system("echo \"e(1)\" | bc -l");<br />
(void) signal(SIGUSR2, SIG_DFL);<br />
exit (0);<br />
int main()<br />
{<br />
pid_t pid;<br />
int exit;<br />
pid = fork();<br />
switch(pid)<br />
{<br />
case -1 :<br />
cout