From b0ed4d16f7fc08eb33a83183e91f4bac857c0826 Mon Sep 17 00:00:00 2001 From: 10195501441 <10195501441@stu.ecnu.edu.com> Date: Thu, 18 Mar 2021 17:13:52 +0800 Subject: [PATCH] test mytop --- yeeshell.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/yeeshell.c b/yeeshell.c index 6f2e466..3e764db 100644 --- a/yeeshell.c +++ b/yeeshell.c @@ -404,20 +404,18 @@ int builtin_mytop() if ((pid = fork()) < 0) { printf("fork error\n"); - return; + return -1; } - if (pid == 0) + + getkinfo(); + mytop_memory(); + get_procs(); + if (prev_proc == NULL) { - getkinfo(); - mytop_memory(); 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()