forked from AngelDevil1223/PROC
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathparser.h
40 lines (31 loc) · 926 Bytes
/
parser.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
#ifndef PARSER_H
#define PARSER_H
#include "options.h"
extern char *procDIR;
extern char *statDIR;
extern char *statmDIR;
//Structure containing all of the information that can be
//associated with a process
//All array of characters except for state with is a single character
struct info{
char* pid;
char* userTime;
char* systemTime;
char* vm;
char* cmdline;
char state;
};
//calls initInfo then prints the information
int generatePrint(struct options *flags, int processID);
//calls three helpers functions after setting pid value
void initInfo(struct info *pInfo, int processID);
//responsible for parsing the stat file
//sets usertime, systemtime, and state
void parseStat(struct info *pInfo);
//responsible for parsing the statm file
//sets the vm
void parseStatm(struct info *pInfo);
//responsible for parsing the cmdline file
//sets the cmdline info
void parseCmdline(struct info *pInfo);
#endif