Write a C program that searches for processes in the process tree (rooted at a specified…
- User
Write a C program that searches for processes in the process tree (rooted at a specified process) and outputs the requested information based on the input parameters.
Synopsis : prcinfo [root_process] [process_id1] [process_id2]... [process_id(n)] [OPTION]
- 1>=n<=5
- Lists the PID and PPID of each process_id(n) if process_id(n) belongs to the process tree rooted at root_process
- root_process is the PID of a process that is a descendant of the current bash process.
- process_id(n) is the PID of a process that is a descendant of the current bash process.
OPTION
-nd additionally lists the PIDs of all the non-direct descendants of process_id1(only) -dd additionally lists the PIDs of all the immediate descendants of process_id1 -sb additionally lists the PIDs of all the sibling processes of process_id1 -sz additionally Lists the PIDs of all sibling processes of process_id1 that are defunct -gc additionally lists the PIDs of all the grandchildren of process_id1
- zz additionally prints the status of process_id1 (Defunct/ Not Defunct)
- zc additionally lists the PIDs of all the direct descendants of process_id1 that are currently in the defunct state
- Assistant
- User
modify the above code to write it in a begineer coder level and mention appropraite comments and create specific methods for the tasks requested
- Assistant
- User
Synopsis : prcinfo [root_process] [process_id1] [process_id2]... [process_id(n)] [OPTION]
- 1>=n<=5
- Lists the PID and PPID of each process_id(n) if process_id(n) belongs to the process tree rooted at root_process
- root_process is the PID of a process that is a descendant of the current bash process.
- process_id(n) is the PID of a process that is a descendant of the current bash process.
OPTION
-nd additionally lists the PIDs of all the non-direct descendants of process_id1(only) -dd additionally lists the PIDs of all the immediate descendants of process_id1 -sb additionally lists the PIDs of all the sibling processes of process_id1 -sz additionally Lists the PIDs of all sibling processes of process_id1 that are defunct -gc additionally lists the PIDs of all the grandchildren of process_id1
- zz additionally prints the status of process_id1 (Defunct/ Not Defunct)
- zc additionally lists the PIDs of all the direct descendants of process_id1 that are currently in the defunct state
Write a C program that searches for processes in the process tree (rooted at a specified process) and outputs the requested information based on the input parameters.
write the code in such a way that it seems that a begineer lvel coder is writing it, include simple appropriate methods to perform varous instrcutions and implement error-handling wherever necesaary.
- Assistant
- User
Write a C program that searches for defunct processes in a process tree(rooted at a specified process) and forcefully terminates their parent processes based on the input parameters Synopsis: deftreeminus [root_process] [OPTION1] [OPTION2] [-processid] o Forcefully terminates all the parent processes (as long as it is not the current BASH process) of all the defunct processes that belongs to the process tree rooted at root_process. o root_process is the PID of a process that is a descendant of the current bash process. o -processid: if specified, the process with PID= processid will not be terminated even if it happens to be the parent of a defunct process that that belongs to the process tree rooted at root_process. -processid can be specified without the options: deftreeminus 1004 (Terminates both 1005 and 1010)
- Assistant