|
|
@ -1,5 +1,4 @@ |
|
|
|
|
|
|
|
//#define mytop_h |
|
|
|
#include <stdio.h> |
|
|
|
#include <unistd.h> |
|
|
|
#include <pwd.h> |
|
|
@ -313,13 +312,10 @@ void get_procs(void) |
|
|
|
void getkinfo(void) |
|
|
|
{ |
|
|
|
FILE *fp; |
|
|
|
|
|
|
|
if ((fp = fopen("/proc/kinfo", "r")) == NULL) { |
|
|
|
|
|
|
|
exit(1); |
|
|
|
} |
|
|
|
if (fscanf(fp, "%u %u", &nr_procs, &nr_tasks) != 2) { |
|
|
|
|
|
|
|
if (fscanf(fp, "%u %u", &nr_procs, &nr_tasks) != 2) { |
|
|
|
exit(1); |
|
|
|
} |
|
|
|
fclose(fp); |
|
|
@ -338,4 +334,4 @@ void mytop() |
|
|
|
get_procs(); |
|
|
|
print_procs(prev_proc,proc,1); |
|
|
|
return; |
|
|
|
} |
|
|
|
} |