Question: Write a C program that searches for a particular process in the process tree (rooted at a specified process) and outputs the requested information based
Write a C program that searches for a particular process in the process tree (rooted at a specified process) and outputs the requested information based on the input parameters. Synopsis : prctree [root_process] [process_id] [OPTION] Lists the PID and PPID of process_id if it belongs to the process tree rooted at root_process o root_process is the PID of a process that is a descendant of a current BASH process. o process_id is the PID of a process that is a descendant of a current BASH process. OPTION o - c additionally lists the PIDs of all the child processes (immediate descendent/s) of process_id o - s additionally lists the PID and PPID of all the sibling processes of process_id o - gp additionally lists the PID of the grandparent of process_id o - gc additonally lists the PIDs and PPIDs of all the grandchildren of process_id o - z additionally prints if process_id is DEFUNCT/ NOT DEFUNCT o - zl additionally lists the PIDs of all the child processes of process_id that that are currently in the defunct state
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
