introspection_allocate_and_get_all_child_pids()
Get a list of child PIDs
Synopsis:
#include <sys/introspection.h>
int introspection_allocate_and_get_all_child_pids( pid64_t parent_pid,
pid64_t **const plist,
size_t *pnumber_of_pids );
Arguments:
- parent_pid
- The PID (pid_t) or unique PID (pid64_t) of the parent process.
- plist
- The address of a location to store a pointer to the allocated list of child PIDs.
- pnumber_of_pids
- A pointer to a variable where the number of PIDs in the allocated list can be stored.
Library:
libintrospection
Use the -l introspection option to qcc to link against this library.
Description:
The introspection_allocate_and_get_all_child_pids() function allocates a buffer and fills it with a list of a process's child PIDs. If the process is creating new children when this function is called, it may give up and return EAGAIN instead.
On success, the calling process is responsible for freeing the buffer.
Note:
Your process must have the
PROCMGR_AID_XPROCESS_QUERY ability enabled to request information
about another process.
Returns:
EOK on success. If an error occurs, the function returns a value from the Errors section.
Errors:
- EAGAIN
- The process was creating new children when the function was called.
- ENOMEM
- Insufficient memory to allocate the PIDs.
- EPERM
- The calling process doesn't have the required ability.
- ESRCH
- The parent ID is invalid.
Classification:
| Safety: | |
|---|---|
| Cancellation point | Yes |
| Signal handler | No |
| Thread | Yes |
Page updated:
