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