|PROC_WALK(3PROC)||Process Control Library Functions||PROC_WALK(3PROC)|
void *arg, int flag);
proc_walk() function walks all threads and processes in /proc and calls the callback function func once for each one with the user specified arg. The definition of the proc_walk_f is available in libproc(3LIB).
func will be called once for each process and will always have its first argument filled in with the value of the psinfo file of the process. The value of flag controls whether or not information about the threads in the process are included and how many times the callback function func is called. The following values may be passed in for flag:
In addition, the following values may be combined with one of the above values of flag with a bitwise-inclusive-OR:
The return value of the caller's func function determines whether or not iteration will continue. If func returns a non-zero value, then iteration will terminate and that return value will be returned to the caller. To distinguish between system errors and caller errors, it is recommended that the function only return positive integers in the event of an error.
proc_walk() function returns 0. Otherwise, -1 is returned and errno is updated to reflect the error that occurred.
proc_walk() function may fail for the same reasons as the opendir(3C), readdir(3C), and malloc(3C) functions.
|December 2, 2019||OmniOS|