Question: Write a c program for implement your own system function int cs531_system(const char *comm); Include the following functions/macros within your program: fork(), execlp(), dup(), wait(),

Write a c program for implement your own "system" function

int cs531_system(const char *comm);

Include the following functions/macros within your program: fork(), execlp(), dup(), wait(), signal(), WEXITSTATUS(), WTERMSIG(), WSTOPSIG(), WIFCONTINUED()Do Not use system().

implement your own "system" function

int cs531_system(const char *comm);

Include the following functions/macros within your program: fork(), execlp(), dup(), wait(), signal(), WEXITSTATUS(), WTERMSIG(), WSTOPSIG(), WIFCONTINUED()Do Not use system().

Test Case

1. "ps -a"

PID TTY TIME CMD 5925 ttys000 0:00.03 login -pf halgreenwald 5926 ttys000 0:00.46 -bash 5934 ttys001 0:00.02 login -pf halgreenwald 5935 ttys001 0:00.82 -bash 24790 ttys002 0:00.04 login -pf halgreenwald 24791 ttys002 0:00.28 -bash 50596 ttys002 0:00.00 ./hw5 ps -a 50597 ttys002 0:00.00 ps "a Parent process is sleeping...

2. "ping 127.0.0.1" > tmp

PING 127.0.0.1 (127.0.0.1): 56 data bytes 64 bytes from 127.0.0.1: icmp_seq=0 ttl=64 time=0.049 ms 64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.121 ms 64 bytes from 127.0.0.1: icmp_seq=2 ttl=64 time=0.055 ms 64 bytes from 127.0.0.1: icmp_seq=3 ttl=64 time=0.118 ms

^C $ cat tmp Parent process is sleeping...

NOTE: ping should still be visible on the console. out.txt should contain Parent process is sleepling

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!