I use the ‘find’ utility from QNX to find files on the hard disk. I execute this using the ‘spawnl()’ with appropriate params.
I need to know that is there a way to find out if the execution of the ‘find’ utility is in progress or has hanged due to some error?
I mean can i make the ‘find’ utiltiy to report its status periodically so that
i can know if it is really searching for files or stuck/hanged due to some error?
Generally find does not hang, it just exits abnormally.
So find returns a status, which you can ask for. (EXIT_SUCCESS and EXIT_FAILURE)
Docu:
The spawnl() function’s return value depends on the mode argument:
mode - Return value
P_WAIT - The exit status of the child process.
P_NOWAIT - The process ID of the child process. To get the exit status for a P_NOWAIT process, you must use the waitpid() function, giving it this process ID.
P_NOWAITO - The process ID of the child process, or 0 if the process is being started on a remote node. You can’t get the exit status of a P_NOWAITO process