2018-06-04 03:11:21 -07:00
|
|
|
#ifndef __PROC_H__
|
|
|
|
#define __PROC_H__
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @file
|
|
|
|
* @brief Routines for querying processes.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Querying Processes
|
|
|
|
* @defgroup Proc
|
|
|
|
*
|
|
|
|
* @{
|
|
|
|
*
|
|
|
|
* Query processes.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <Eina.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
|
|
|
|
#if !defined(PID_MAX)
|
|
|
|
# define PID_MAX 99999
|
|
|
|
#endif
|
|
|
|
|
2020-04-16 14:03:25 -07:00
|
|
|
typedef struct _Proc_Info
|
2018-06-04 03:11:21 -07:00
|
|
|
{
|
|
|
|
pid_t pid;
|
|
|
|
uid_t uid;
|
|
|
|
int8_t nice;
|
|
|
|
int8_t priority;
|
|
|
|
int cpu_id;
|
|
|
|
int32_t numthreads;
|
2020-04-22 07:08:16 -07:00
|
|
|
|
|
|
|
int64_t mem_size;
|
2020-04-22 06:30:30 -07:00
|
|
|
int64_t mem_virt;
|
2018-06-04 03:11:21 -07:00
|
|
|
int64_t mem_rss;
|
2020-04-22 07:08:16 -07:00
|
|
|
int64_t mem_shared;
|
|
|
|
|
2018-06-04 03:11:21 -07:00
|
|
|
double cpu_usage;
|
2020-04-22 02:10:02 -07:00
|
|
|
char *command;
|
|
|
|
char *arguments;
|
2018-06-04 03:11:21 -07:00
|
|
|
const char *state;
|
|
|
|
|
|
|
|
// Not used yet in UI.
|
|
|
|
long cpu_time;
|
2020-05-12 12:34:07 -07:00
|
|
|
|
|
|
|
Eina_List *threads;
|
2020-04-16 14:03:25 -07:00
|
|
|
} Proc_Info;
|
2018-06-04 03:11:21 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Query a full list of running processes and return a list.
|
|
|
|
*
|
|
|
|
* @return A list of proc_t members for all processes.
|
|
|
|
*/
|
|
|
|
Eina_List *
|
2018-10-02 07:38:06 -07:00
|
|
|
proc_info_all_get(void);
|
2018-06-04 03:11:21 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Query a process for its current state.
|
|
|
|
*
|
|
|
|
* @param pid The process ID to query.
|
|
|
|
*
|
|
|
|
* @return A proc_t pointer containing the process information.
|
|
|
|
*/
|
2020-04-16 14:03:25 -07:00
|
|
|
Proc_Info *
|
2018-10-02 07:38:06 -07:00
|
|
|
proc_info_by_pid(int pid);
|
2018-06-04 03:11:21 -07:00
|
|
|
|
2020-04-22 02:10:02 -07:00
|
|
|
/**
|
|
|
|
* Free a Proc_Info * pointer;
|
|
|
|
*
|
|
|
|
* @param proc The object to free.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
proc_info_free(Proc_Info *proc);
|
|
|
|
|
2018-06-04 03:11:21 -07:00
|
|
|
/**
|
|
|
|
* @}
|
|
|
|
*/
|
|
|
|
|
|
|
|
#endif
|