aboutsummaryrefslogtreecommitdiffstats
path: root/src/process_group.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/process_group.c')
-rw-r--r--src/process_group.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/process_group.c b/src/process_group.c
index 671dd73..cb84deb 100644
--- a/src/process_group.c
+++ b/src/process_group.c
@@ -172,7 +172,7 @@ void update_process_group(struct process_group *pgroup)
// struct timeval t;
// gettimeofday(&t, NULL);
// printf("T=%ld.%ld PID=%d PPID=%d START=%d CPUTIME=%d\n", t.tv_sec, t.tv_usec, tmp_process.pid, tmp_process.ppid, tmp_process.starttime, tmp_process.cputime);
- int hashkey = pid_hashfn(tmp_process.pid + tmp_process.starttime);
+ int hashkey = pid_hashfn(tmp_process.pid);
if (pgroup->proctable[hashkey] == NULL)
{
//empty bucket
@@ -222,3 +222,13 @@ void update_process_group(struct process_group *pgroup)
if (dt < MIN_DT) return;
pgroup->last_update = now;
}
+
+int remove_process(struct process_group *pgroup, int pid)
+{
+ int hashkey = pid_hashfn(pid);
+ if (pgroup->proctable[hashkey] == NULL) return 1; //nothing to delete
+ struct list_node *node = (struct list_node*)locate_node(pgroup->proctable[hashkey], &pid);
+ if (node == NULL) return 2;
+ delete_node(pgroup->proctable[hashkey], node);
+ return 0;
+}
Un proyecto texto-plano.xyz