-
Notifications
You must be signed in to change notification settings - Fork 1
/
structs.h
81 lines (65 loc) · 1.19 KB
/
structs.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#ifndef STRUCTS_H
#define STRUCTS_H
#include <sys/time.h>
struct myproc
{
pid_t pid, ppid;
int jid;
uid_t uid;
gid_t gid;
gid_t pgrp;
char *unam, *gnam;
char *shell_cmd; /* allocated, from argv */
char **argv; /* allocated */
size_t argc;
char *argv0_basename; /* pointer to somewhere in argv[0] */
enum proc_state
{
PROC_STATE_RUN,
PROC_STATE_SLEEP,
PROC_STATE_DISK,
PROC_STATE_STOPPED,
PROC_STATE_ZOMBIE,
PROC_STATE_DEAD,
PROC_STATE_TRACE,
PROC_STATE_OTHER,
#define PROC_N_STATES (PROC_STATE_OTHER + 1)
} state;
char *tty;
signed char nice;
unsigned char folded;
double pc_cpu;
unsigned long utime, stime, cutime, cstime;
unsigned long cputime;
unsigned long memsize;
/* important */
struct myproc *hash_next;
struct myproc **children;
int mark;
union
{
struct
{
int flag;
} freebsd;
} machine;
};
struct sysinfo
{
// process info
int count, count_kernel, owned;
int procs_in_state[PROC_N_STATES]; /* number of PROC_STATE */
#ifdef FLOAT_SUPPORT
// machine info
float loadavg[3];
float cpu_pct;
#endif
#ifndef __LP64__
long
#endif
unsigned memory[6];
unsigned long cpu_cycles;
int ncpus;
struct timeval boottime;
};
#endif