|
@ -404,20 +404,18 @@ int builtin_mytop() |
|
|
if ((pid = fork()) < 0) |
|
|
if ((pid = fork()) < 0) |
|
|
{ |
|
|
{ |
|
|
printf("fork error\n"); |
|
|
printf("fork error\n"); |
|
|
return; |
|
|
|
|
|
|
|
|
return -1; |
|
|
} |
|
|
} |
|
|
if (pid == 0) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
getkinfo(); |
|
|
|
|
|
mytop_memory(); |
|
|
|
|
|
get_procs(); |
|
|
|
|
|
if (prev_proc == NULL) |
|
|
{ |
|
|
{ |
|
|
getkinfo(); |
|
|
|
|
|
mytop_memory(); |
|
|
|
|
|
get_procs(); |
|
|
get_procs(); |
|
|
if (prev_proc == NULL) |
|
|
|
|
|
{ |
|
|
|
|
|
get_procs(); |
|
|
|
|
|
} |
|
|
|
|
|
print_procs(prev_proc, proc, cputimemode); |
|
|
|
|
|
exit(0); |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
print_procs(prev_proc, proc, cputimemode); |
|
|
|
|
|
exit(0); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void mytop_memory() |
|
|
void mytop_memory() |
|
|