From 283707c5e5bc436b78ea23bf5500cb6b16a01148 Mon Sep 17 00:00:00 2001 From: Daniel Lange Date: Mon, 11 Apr 2016 13:00:27 +0200 Subject: Imported Upstream version 0.9 --- Process.h | 40 +++++++++++++++++++++++++++++----------- 1 file changed, 29 insertions(+), 11 deletions(-) (limited to 'Process.h') diff --git a/Process.h b/Process.h index 620eb75..88e825e 100644 --- a/Process.h +++ b/Process.h @@ -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 #include #include +#include #ifdef HAVE_PLPA #include @@ -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); -- cgit v1.2.3