Question: In the code abort.c we discussed in class, it uses hard-coded bit-manipulation to access the child process termination status. Rewrite this code using the bit-
In the code abort.c we discussed in class, it uses hard-coded bit-manipulation to access the child process termination status. Rewrite this code using the bit- manipulation macros discussed in the lecture. Submit the source code and script files.
source code
abort.c

#include #include #include #include #include int main() { int newpid; printf("before: mypid is %d ", getpid()); if ((newpid = fork( ) ) == -1 ) perror("fork"); else if (newpid == 0){ printf("I am the child %d now sleeping... ",getpid()); sleep (5); abort(); } else{ printf("I am the parent %d ",getpid()); int status; int child pid = wait(&status); printf ("My child %d has terminated ", child_pid); printf("I have received the status = % ", status); int child_status = status >> 8; int signal = status & 0x7F; int core status & 0x80; printf("Child status = $d Signal = $d Core = %d ", child_status, signal, core); } } #include #include #include #include #include int main() { int newpid; printf("before: mypid is %d ", getpid()); if ((newpid = fork( ) ) == -1 ) perror("fork"); else if (newpid == 0){ printf("I am the child %d now sleeping... ",getpid()); sleep (5); abort(); } else{ printf("I am the parent %d ",getpid()); int status; int child pid = wait(&status); printf ("My child %d has terminated ", child_pid); printf("I have received the status = % ", status); int child_status = status >> 8; int signal = status & 0x7F; int core status & 0x80; printf("Child status = $d Signal = $d Core = %d ", child_status, signal, core); } }