diff options
author | Daniel Lange <DLange@git.local> | 2016-04-11 13:00:27 +0200 |
---|---|---|
committer | Daniel Lange <DLange@git.local> | 2016-04-11 13:00:27 +0200 |
commit | 283707c5e5bc436b78ea23bf5500cb6b16a01148 (patch) | |
tree | b977131bbbb4c3bd8ade370aab2e4fc913440c04 /Process.h | |
parent | bea9b4798717b6f4e31085506dfc179eeb8dc17c (diff) | |
download | debian_htop-283707c5e5bc436b78ea23bf5500cb6b16a01148.tar.gz debian_htop-283707c5e5bc436b78ea23bf5500cb6b16a01148.tar.bz2 debian_htop-283707c5e5bc436b78ea23bf5500cb6b16a01148.zip |
Imported Upstream version 0.9upstream/0.9
Diffstat (limited to 'Process.h')
-rw-r--r-- | Process.h | 40 |
1 files changed, 29 insertions, 11 deletions
@@ -4,7 +4,7 @@ #define HEADER_Process /* htop - Process.h -(C) 2004-2006 Hisham H. Muhammad +(C) 2004-2010 Hisham H. Muhammad Released under the GNU GPL, see the COPYING file in the source distribution for its full text. */ @@ -30,6 +30,7 @@ in the source distribution for its full text. #include <stdbool.h> #include <pwd.h> #include <sched.h> +#include <time.h> #ifdef HAVE_PLPA #include <plpa.h> @@ -42,8 +43,18 @@ in the source distribution for its full text. #endif #define PAGE_SIZE_KB ( PAGE_SIZE / ONE_K ) -#define PROCESS_COMM_LEN 300 +#ifndef Process_isKernelThread +#define Process_isKernelThread(_process) (_process->pgrp == 0) +#endif + +#ifndef Process_isUserlandThread +#define Process_isUserlandThread(_process) (_process->pid != _process->tgid) +#endif + +#ifndef Process_isThread +#define Process_isThread(_process) (Process_isUserlandThread(_process) || Process_isKernelThread(_process)) +#endif typedef enum ProcessField_ { PID = 1, COMM, STATE, PPID, PGRP, SESSION, TTY_NR, TPGID, FLAGS, MINFLT, CMINFLT, MAJFLT, CMAJFLT, UTIME, @@ -60,6 +71,9 @@ typedef enum ProcessField_ { #ifdef HAVE_TASKSTATS RCHAR, WCHAR, SYSCR, SYSCW, RBYTES, WBYTES, CNCLWB, IO_READ_RATE, IO_WRITE_RATE, IO_RATE, #endif + #ifdef HAVE_CGROUP + CGROUP, + #endif LAST_PROCESSFIELD } ProcessField; @@ -71,16 +85,18 @@ typedef struct Process_ { struct ProcessList_ *pl; bool updated; - unsigned int pid; + pid_t pid; char* comm; int indent; char state; bool tag; - unsigned int ppid; + bool showChildren; + bool show; + pid_t ppid; unsigned int pgrp; unsigned int session; unsigned int tty_nr; - unsigned int tgid; + pid_t tgid; int tpgid; unsigned long int flags; #ifdef DEBUG @@ -96,9 +112,10 @@ typedef struct Process_ { long int priority; long int nice; long int nlwp; + char starttime_show[8]; + time_t starttime_ctime; #ifdef DEBUG long int itrealvalue; - unsigned long int starttime; unsigned long int vsize; long int rss; unsigned long int rlim; @@ -148,6 +165,9 @@ typedef struct Process_ { double io_rate_write_bps; unsigned long long io_rate_write_time; #endif + #ifdef HAVE_CGROUP + char* cgroup; + #endif } Process; @@ -157,9 +177,9 @@ extern char* PROCESS_CLASS; #define PROCESS_CLASS NULL #endif -extern char *Process_fieldNames[]; +extern const char *Process_fieldNames[]; -extern char *Process_fieldTitles[]; +extern const char *Process_fieldTitles[]; #define ONE_K 1024 #define ONE_M (ONE_K * ONE_K) @@ -169,8 +189,6 @@ void Process_delete(Object* cast); Process* Process_new(struct ProcessList_ *pl); -Process* Process_clone(Process* this); - void Process_toggleTag(Process* this); bool Process_setPriority(Process* this, int priority); @@ -181,7 +199,7 @@ unsigned long Process_getAffinity(Process* this); bool Process_setAffinity(Process* this, unsigned long mask); #endif -void Process_sendSignal(Process* this, int signal); +void Process_sendSignal(Process* this, int sgn); int Process_pidCompare(const void* v1, const void* v2); |