Data Structures | |
struct | sa_process |
Enumerations | |
enum | sa_process_state { RUNNING = 0, SLEEPING = 1, SLEEPING_UNINTERRUPTIBLE = 2, ZOMBIE = 3, STOPPED = 4 } |
Functions | |
SA_EXPORT int | sa_open_process () |
SA_EXPORT int | sa_close_process () |
SA_EXPORT int | sa_count_processes (pid_t *number) |
SA_EXPORT int | sa_get_processes_ids (pid_t *dst, pid_t dst_size, pid_t *written) |
SA_EXPORT int | sa_get_process (pid_t pid, struct sa_process *dst) |
SA_EXPORT int | sa_get_processes (struct sa_process *dst, pid_t dst_size, pid_t *written) |
enum sa_process_state |
The different types of states of a process.
SA_EXPORT int sa_open_process | ( | ) |
Prepares the resources needed for retrieving process statistics. This function exists (and is needed) only when SA_OPEN_PROCESS is defined.
SA_EXPORT int sa_close_process | ( | ) |
This function closes the resources used for retrieving process statistics. You should call it even when there was a previous error in another function of this API. This function exists (and is needed) only when SA_CLOSE_PROCESS is defined.
SA_EXPORT int sa_count_processes | ( | pid_t * | number | ) |
Gives the total number of processes on the systems.
number | The number will be stored here |
SA_EXPORT int sa_get_processes_ids | ( | pid_t * | dst, | |
pid_t | dst_size, | |||
pid_t * | written | |||
) |
Gets a list of the current processes ids in the system. The array will be fully populated even if it's not big enough (but ENOMEM is returned).
dst | A pointer to the array to populate. | |
dst_size | The number of pid_t that fits in the array. | |
written | The amount of pids written is stored here. |
SA_EXPORT int sa_get_process | ( | pid_t | pid, | |
struct sa_process * | dst | |||
) |
Retrieves statistics from a process identified by its pid.
pid | The pid of the process. | |
dst | Where the statistics will be stored. |
SA_EXPORT int sa_get_processes | ( | struct sa_process * | dst, | |
pid_t | dst_size, | |||
pid_t * | written | |||
) |
Retrieves statistics about all the processes on the system.
dst | A buffer where the statistics will be stored. | |
dst_size | The number of process that fits in the dst buffer. If it's not big enough dst will be filled but ENOMEM will be returned. | |
written | The amount of processes written. |