2006-06-06 20:28:42 +00:00
|
|
|
/* Do not edit this file. It was automatically generated. */
|
2006-03-04 18:16:49 +00:00
|
|
|
|
|
|
|
#ifndef HEADER_Process
|
|
|
|
#define HEADER_Process
|
|
|
|
/*
|
|
|
|
htop - Process.h
|
2015-03-21 19:52:54 +00:00
|
|
|
(C) 2004-2015 Hisham H. Muhammad
|
2006-03-04 18:16:49 +00:00
|
|
|
Released under the GNU GPL, see the COPYING file
|
|
|
|
in the source distribution for its full text.
|
|
|
|
*/
|
|
|
|
|
2011-11-21 02:52:41 +00:00
|
|
|
#ifdef HAVE_LIBHWLOC
|
2009-03-11 13:15:43 +00:00
|
|
|
#endif
|
2008-03-05 09:46:47 +00:00
|
|
|
|
2014-11-24 20:55:03 +00:00
|
|
|
// On Linux, this works only with glibc 2.1+. On earlier versions
|
2006-03-04 18:16:49 +00:00
|
|
|
// the behavior is similar to have a hardcoded page size.
|
2007-05-17 18:29:30 +00:00
|
|
|
#ifndef PAGE_SIZE
|
2009-03-11 13:15:43 +00:00
|
|
|
#define PAGE_SIZE ( sysconf(_SC_PAGESIZE) )
|
2007-05-17 18:29:30 +00:00
|
|
|
#endif
|
2009-03-11 13:15:43 +00:00
|
|
|
#define PAGE_SIZE_KB ( PAGE_SIZE / ONE_K )
|
2006-03-04 18:16:49 +00:00
|
|
|
|
2011-12-26 21:35:57 +00:00
|
|
|
#include "Object.h"
|
|
|
|
#include "Affinity.h"
|
2014-11-24 20:55:03 +00:00
|
|
|
|
2011-12-26 21:35:57 +00:00
|
|
|
#include <sys/types.h>
|
2006-03-04 18:16:49 +00:00
|
|
|
|
2013-05-24 22:46:01 +00:00
|
|
|
#define PROCESS_FLAG_IO 1
|
|
|
|
#define PROCESS_FLAG_IOPRIO 2
|
|
|
|
#define PROCESS_FLAG_OPENVZ 4
|
|
|
|
#define PROCESS_FLAG_VSERVER 8
|
|
|
|
#define PROCESS_FLAG_CGROUP 16
|
|
|
|
|
2010-11-22 12:40:20 +00:00
|
|
|
#ifndef Process_isKernelThread
|
|
|
|
#define Process_isKernelThread(_process) (_process->pgrp == 0)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef Process_isUserlandThread
|
|
|
|
#define Process_isUserlandThread(_process) (_process->pid != _process->tgid)
|
|
|
|
#endif
|
2006-03-04 18:16:49 +00:00
|
|
|
|
2010-02-22 20:57:25 +00:00
|
|
|
#ifndef Process_isThread
|
2010-11-22 12:40:20 +00:00
|
|
|
#define Process_isThread(_process) (Process_isUserlandThread(_process) || Process_isKernelThread(_process))
|
2010-02-22 20:57:25 +00:00
|
|
|
#endif
|
|
|
|
|
2006-03-04 18:16:49 +00:00
|
|
|
typedef enum ProcessField_ {
|
|
|
|
PID = 1, COMM, STATE, PPID, PGRP, SESSION, TTY_NR, TPGID, FLAGS, MINFLT, CMINFLT, MAJFLT, CMAJFLT, UTIME,
|
|
|
|
STIME, CUTIME, CSTIME, PRIORITY, NICE, ITREALVALUE, STARTTIME, VSIZE, RSS, RLIM, STARTCODE, ENDCODE,
|
|
|
|
STARTSTACK, KSTKESP, KSTKEIP, SIGNAL, BLOCKED, SSIGIGNORE, SIGCATCH, WCHAN, NSWAP, CNSWAP, EXIT_SIGNAL,
|
|
|
|
PROCESSOR, M_SIZE, M_RESIDENT, M_SHARE, M_TRS, M_DRS, M_LRS, M_DT, ST_UID, PERCENT_CPU, PERCENT_MEM,
|
2007-11-08 23:23:01 +00:00
|
|
|
USER, TIME, NLWP, TGID,
|
2007-08-10 05:07:14 +00:00
|
|
|
#ifdef HAVE_OPENVZ
|
2009-03-11 13:05:19 +00:00
|
|
|
CTID, VPID,
|
2007-08-10 05:07:14 +00:00
|
|
|
#endif
|
2008-09-23 04:31:13 +00:00
|
|
|
#ifdef HAVE_VSERVER
|
|
|
|
VXID,
|
|
|
|
#endif
|
2008-03-09 08:02:22 +00:00
|
|
|
#ifdef HAVE_TASKSTATS
|
2008-03-14 18:50:49 +00:00
|
|
|
RCHAR, WCHAR, SYSCR, SYSCW, RBYTES, WBYTES, CNCLWB, IO_READ_RATE, IO_WRITE_RATE, IO_RATE,
|
2008-03-09 08:02:22 +00:00
|
|
|
#endif
|
2010-10-30 19:30:19 +00:00
|
|
|
#ifdef HAVE_CGROUP
|
|
|
|
CGROUP,
|
|
|
|
#endif
|
2014-01-29 22:41:55 +00:00
|
|
|
#ifdef HAVE_OOM
|
|
|
|
OOM,
|
|
|
|
#endif
|
2012-10-04 23:59:45 +00:00
|
|
|
IO_PRIORITY,
|
2007-08-10 05:07:14 +00:00
|
|
|
LAST_PROCESSFIELD
|
2006-03-04 18:16:49 +00:00
|
|
|
} ProcessField;
|
|
|
|
|
|
|
|
struct ProcessList_;
|
|
|
|
|
|
|
|
typedef struct Process_ {
|
|
|
|
Object super;
|
|
|
|
|
|
|
|
struct ProcessList_ *pl;
|
|
|
|
|
2010-02-25 01:43:18 +00:00
|
|
|
pid_t pid;
|
2006-03-04 18:16:49 +00:00
|
|
|
char* comm;
|
|
|
|
int indent;
|
|
|
|
char state;
|
|
|
|
bool tag;
|
2010-06-17 19:02:03 +00:00
|
|
|
bool showChildren;
|
2010-11-22 12:40:20 +00:00
|
|
|
bool show;
|
2010-02-25 01:43:18 +00:00
|
|
|
pid_t ppid;
|
2007-05-17 18:29:30 +00:00
|
|
|
unsigned int pgrp;
|
|
|
|
unsigned int session;
|
|
|
|
unsigned int tty_nr;
|
2010-02-25 01:43:18 +00:00
|
|
|
pid_t tgid;
|
2007-11-08 23:23:01 +00:00
|
|
|
int tpgid;
|
2006-03-04 18:16:49 +00:00
|
|
|
unsigned long int flags;
|
2014-02-27 19:35:22 +00:00
|
|
|
|
|
|
|
uid_t st_uid;
|
|
|
|
float percent_cpu;
|
|
|
|
float percent_mem;
|
|
|
|
char* user;
|
|
|
|
|
2011-03-28 19:06:06 +00:00
|
|
|
unsigned long long int utime;
|
|
|
|
unsigned long long int stime;
|
|
|
|
unsigned long long int cutime;
|
|
|
|
unsigned long long int cstime;
|
2006-03-04 18:16:49 +00:00
|
|
|
long int priority;
|
|
|
|
long int nice;
|
2007-05-21 19:10:53 +00:00
|
|
|
long int nlwp;
|
2010-03-29 18:36:11 +00:00
|
|
|
char starttime_show[8];
|
|
|
|
time_t starttime_ctime;
|
2014-02-27 19:35:22 +00:00
|
|
|
|
|
|
|
#ifdef HAVE_TASKSTATS
|
|
|
|
unsigned long long io_rchar;
|
|
|
|
unsigned long long io_wchar;
|
|
|
|
unsigned long long io_syscr;
|
|
|
|
unsigned long long io_syscw;
|
|
|
|
unsigned long long io_read_bytes;
|
|
|
|
unsigned long long io_write_bytes;
|
|
|
|
unsigned long long io_cancelled_write_bytes;
|
|
|
|
double io_rate_read_bps;
|
|
|
|
unsigned long long io_rate_read_time;
|
|
|
|
double io_rate_write_bps;
|
|
|
|
unsigned long long io_rate_write_time;
|
2006-07-11 06:13:32 +00:00
|
|
|
#endif
|
2014-02-27 19:35:22 +00:00
|
|
|
|
2006-03-04 18:16:49 +00:00
|
|
|
int processor;
|
2014-04-10 01:32:54 +00:00
|
|
|
long m_size;
|
|
|
|
long m_resident;
|
|
|
|
long m_share;
|
|
|
|
long m_trs;
|
|
|
|
long m_drs;
|
|
|
|
long m_lrs;
|
|
|
|
long m_dt;
|
2014-02-27 19:35:22 +00:00
|
|
|
|
2007-08-10 05:07:14 +00:00
|
|
|
#ifdef HAVE_OPENVZ
|
2009-03-11 13:05:19 +00:00
|
|
|
unsigned int ctid;
|
2007-08-10 05:07:14 +00:00
|
|
|
unsigned int vpid;
|
|
|
|
#endif
|
2008-09-23 04:31:13 +00:00
|
|
|
#ifdef HAVE_VSERVER
|
|
|
|
unsigned int vxid;
|
|
|
|
#endif
|
2014-02-27 19:35:22 +00:00
|
|
|
|
2010-10-30 19:30:19 +00:00
|
|
|
#ifdef HAVE_CGROUP
|
|
|
|
char* cgroup;
|
|
|
|
#endif
|
2014-01-29 22:41:55 +00:00
|
|
|
#ifdef HAVE_OOM
|
|
|
|
unsigned int oom;
|
|
|
|
#endif
|
2014-02-27 19:35:22 +00:00
|
|
|
|
|
|
|
int exit_signal;
|
2014-02-27 20:11:23 +00:00
|
|
|
int basenameOffset;
|
2014-02-27 19:35:22 +00:00
|
|
|
bool updated;
|
|
|
|
|
|
|
|
unsigned long int minflt;
|
|
|
|
unsigned long int cminflt;
|
|
|
|
unsigned long int majflt;
|
|
|
|
unsigned long int cmajflt;
|
2014-04-24 22:40:47 +00:00
|
|
|
#ifdef DEBUG
|
2014-02-27 19:35:22 +00:00
|
|
|
long int itrealvalue;
|
|
|
|
unsigned long int vsize;
|
|
|
|
long int rss;
|
|
|
|
unsigned long int rlim;
|
|
|
|
unsigned long int startcode;
|
|
|
|
unsigned long int endcode;
|
|
|
|
unsigned long int startstack;
|
|
|
|
unsigned long int kstkesp;
|
|
|
|
unsigned long int kstkeip;
|
|
|
|
unsigned long int signal;
|
|
|
|
unsigned long int blocked;
|
|
|
|
unsigned long int sigignore;
|
|
|
|
unsigned long int sigcatch;
|
|
|
|
unsigned long int wchan;
|
|
|
|
unsigned long int nswap;
|
|
|
|
unsigned long int cnswap;
|
|
|
|
#endif
|
|
|
|
|
2006-03-04 18:16:49 +00:00
|
|
|
} Process;
|
|
|
|
|
|
|
|
|
2010-02-25 01:43:18 +00:00
|
|
|
extern const char *Process_fieldNames[];
|
2006-03-04 18:16:49 +00:00
|
|
|
|
2013-05-24 22:46:01 +00:00
|
|
|
extern const int Process_fieldFlags[];
|
|
|
|
|
2010-02-25 01:43:18 +00:00
|
|
|
extern const char *Process_fieldTitles[];
|
2008-03-14 18:50:49 +00:00
|
|
|
|
2011-09-29 18:40:23 +00:00
|
|
|
|
2014-11-27 22:10:23 +00:00
|
|
|
void Process_setupColumnWidths();
|
2011-09-29 18:40:23 +00:00
|
|
|
|
2014-04-10 01:49:36 +00:00
|
|
|
#define ONE_K 1024L
|
2008-03-09 08:58:38 +00:00
|
|
|
#define ONE_M (ONE_K * ONE_K)
|
|
|
|
#define ONE_G (ONE_M * ONE_K)
|
2006-03-04 18:16:49 +00:00
|
|
|
|
2014-04-10 01:49:36 +00:00
|
|
|
#define ONE_DECIMAL_K 1000L
|
2014-02-27 19:35:22 +00:00
|
|
|
#define ONE_DECIMAL_M (ONE_DECIMAL_K * ONE_DECIMAL_K)
|
2014-04-10 01:32:54 +00:00
|
|
|
#define ONE_DECIMAL_G (ONE_DECIMAL_M * ONE_DECIMAL_K)
|
2014-02-27 19:35:22 +00:00
|
|
|
|
2015-02-20 16:52:10 +00:00
|
|
|
void Process_done(Process* this);
|
2006-03-04 18:16:49 +00:00
|
|
|
|
2012-12-05 15:12:20 +00:00
|
|
|
extern ObjectClass Process_class;
|
|
|
|
|
2015-02-23 06:53:36 +00:00
|
|
|
void Process_init(Process* this, struct ProcessList_* pl);
|
2008-03-09 08:58:38 +00:00
|
|
|
|
2006-03-04 18:16:49 +00:00
|
|
|
void Process_toggleTag(Process* this);
|
|
|
|
|
2007-12-17 05:57:28 +00:00
|
|
|
bool Process_setPriority(Process* this, int priority);
|
2006-03-04 18:16:49 +00:00
|
|
|
|
2012-10-04 23:59:45 +00:00
|
|
|
bool Process_changePriorityBy(Process* this, size_t delta);
|
|
|
|
|
2011-11-21 02:52:41 +00:00
|
|
|
#ifdef HAVE_LIBHWLOC
|
2011-11-18 06:08:56 +00:00
|
|
|
|
2011-09-24 00:30:47 +00:00
|
|
|
Affinity* Process_getAffinity(Process* this);
|
2007-11-08 23:23:01 +00:00
|
|
|
|
2011-09-24 00:30:47 +00:00
|
|
|
bool Process_setAffinity(Process* this, Affinity* affinity);
|
2011-11-18 06:08:56 +00:00
|
|
|
|
|
|
|
#elif HAVE_NATIVE_AFFINITY
|
|
|
|
|
|
|
|
Affinity* Process_getAffinity(Process* this);
|
|
|
|
|
|
|
|
bool Process_setAffinity(Process* this, Affinity* affinity);
|
|
|
|
|
2009-03-11 13:15:43 +00:00
|
|
|
#endif
|
2007-11-08 23:23:01 +00:00
|
|
|
|
2012-10-04 23:59:45 +00:00
|
|
|
void Process_sendSignal(Process* this, size_t sgn);
|
2006-03-04 18:16:49 +00:00
|
|
|
|
2014-04-25 22:41:23 +00:00
|
|
|
long Process_pidCompare(const void* v1, const void* v2);
|
2006-07-11 06:13:32 +00:00
|
|
|
|
2014-04-25 22:41:23 +00:00
|
|
|
long Process_compare(const void* v1, const void* v2);
|
2006-03-04 18:16:49 +00:00
|
|
|
|
|
|
|
#endif
|