blob: f4f1b205de367c4d269a2995e5ab5f21eef10e55 [file] [log] [blame]
Hisham Muhammadd6231ba2006-03-04 18:16:49 +00001/* Do not edit this file. It was automatically genarated. */
2
3#ifndef HEADER_Process
4#define HEADER_Process
5/*
6htop - Process.h
7(C) 2004-2006 Hisham H. Muhammad
8Released under the GNU GPL, see the COPYING file
9in the source distribution for its full text.
10*/
11
12#define _GNU_SOURCE
13#include "ProcessList.h"
14#include "Object.h"
15#include "CRT.h"
16#include "String.h"
17
18#include "debug.h"
19
20#include <stdio.h>
21#include <sys/time.h>
22#include <sys/resource.h>
23#include <sys/param.h>
24#include <sys/types.h>
25#include <sys/stat.h>
26#include <unistd.h>
27#include <signal.h>
28#include <string.h>
29#include <stdbool.h>
30#include <pwd.h>
31
32// This works only with glibc 2.1+. On earlier versions
33// the behavior is similar to have a hardcoded page size.
34#define PAGE_SIZE ( sysconf(_SC_PAGESIZE) / 1024 )
35
36#define PROCESS_COMM_LEN 300
37#define PROCESS_USER_LEN 10
38
39
40typedef enum ProcessField_ {
41 PID = 1, COMM, STATE, PPID, PGRP, SESSION, TTY_NR, TPGID, FLAGS, MINFLT, CMINFLT, MAJFLT, CMAJFLT, UTIME,
42 STIME, CUTIME, CSTIME, PRIORITY, NICE, ITREALVALUE, STARTTIME, VSIZE, RSS, RLIM, STARTCODE, ENDCODE,
43 STARTSTACK, KSTKESP, KSTKEIP, SIGNAL, BLOCKED, SSIGIGNORE, SIGCATCH, WCHAN, NSWAP, CNSWAP, EXIT_SIGNAL,
44 PROCESSOR, M_SIZE, M_RESIDENT, M_SHARE, M_TRS, M_DRS, M_LRS, M_DT, ST_UID, PERCENT_CPU, PERCENT_MEM,
45 USER, TIME, LAST_PROCESSFIELD
46} ProcessField;
47
48struct ProcessList_;
49
50typedef struct Process_ {
51 Object super;
52
53 struct ProcessList_ *pl;
54 bool updated;
55
56 int pid;
57 char* comm;
58 int indent;
59 char state;
60 bool tag;
61 int ppid;
62 int pgrp;
63 int session;
64 int tty_nr;
65 int tpgid;
66 unsigned long int flags;
67 unsigned long int minflt;
68 unsigned long int cminflt;
69 unsigned long int majflt;
70 unsigned long int cmajflt;
71 unsigned long int utime;
72 unsigned long int stime;
73 long int cutime;
74 long int cstime;
75 long int priority;
76 long int nice;
77 long int itrealvalue;
78 unsigned long int starttime;
79 unsigned long int vsize;
80 long int rss;
81 unsigned long int rlim;
82 unsigned long int startcode;
83 unsigned long int endcode;
84 unsigned long int startstack;
85 unsigned long int kstkesp;
86 unsigned long int kstkeip;
87 unsigned long int signal;
88 unsigned long int blocked;
89 unsigned long int sigignore;
90 unsigned long int sigcatch;
91 unsigned long int wchan;
92 unsigned long int nswap;
93 unsigned long int cnswap;
94 int exit_signal;
95 int processor;
96 int m_size;
97 int m_resident;
98 int m_share;
99 int m_trs;
100 int m_drs;
101 int m_lrs;
102 int m_dt;
103 uid_t st_uid;
104 float percent_cpu;
105 float percent_mem;
106 char user[PROCESS_USER_LEN + 1];
107} Process;
108
109extern char* PROCESS_CLASS;
110
111extern char* Process_fieldNames[];
112
113
114
115
116Process* Process_new(struct ProcessList_ *pl);
117
118Process* Process_clone(Process* this);
119
120void Process_delete(Object* cast);
121
122void Process_display(Object* cast, RichString* out);
123
124void Process_toggleTag(Process* this);
125
126void Process_setPriority(Process* this, int priority);
127
128void Process_sendSignal(Process* this, int signal);
129
130#define ONE_K 1024
131#define ONE_M (ONE_K * ONE_K)
132#define ONE_G (ONE_M * ONE_K)
133
134void Process_writeField(Process* this, RichString* str, ProcessField field);
135
136int Process_compare(const Object* v1, const Object* v2);
137
138char* Process_printField(ProcessField field);
139
140#endif