-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlist.h
41 lines (28 loc) · 1.01 KB
/
list.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
/*
* list.h - definitions and declarations of the integer list
*/
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
/* lst_iitem - each element of the list points to the next element */
typedef struct lst_iitem {
int pid;
time_t starttime;
time_t endtime;
int exectime;
struct lst_iitem *next;
} lst_iitem_t;
/* list_t */
typedef struct {
lst_iitem_t * first;
} list_t;
/* lst_new - allocates memory for list_t and initializes it */
list_t* lst_new();
/* lst_destroy - free memory of list_t and all its items */
void lst_destroy(list_t *);
/* insert_new_process - insert a new item with process id and its start time in list 'list' */
void insert_new_process(list_t *list, int pid, time_t starttime);
/* lst_remove - remove first item of value 'value' from list 'list' */
int update_terminated_process(list_t *list, int pid, time_t endtime, FILE* fp);
/* lst_print - print the content of list 'list' to standard output */
void lst_print(list_t *list);