]> Zhao Yanbai Git Server - minix.git/commitdiff
make ps and top use sanity checking kernel proc table retrieval
authorBen Gras <ben@minix3.org>
Mon, 28 Jun 2010 11:05:34 +0000 (11:05 +0000)
committerBen Gras <ben@minix3.org>
Mon, 28 Jun 2010 11:05:34 +0000 (11:05 +0000)
commands/ps/ps.c
commands/top/top.c

index 72b397a484399df0b0e13fe224213426ac6cb247..3be29248296007144f3e68d99b47807e929b0021 100644 (file)
@@ -344,8 +344,8 @@ char *argv[];
   if (ps_proc == NULL || ps_mproc == NULL || ps_fproc == NULL)
        err("Out of memory");
 
-       if(getsysinfo(PM_PROC_NR, SI_KPROC_TAB, ps_proc) < 0) {
-               fprintf(stderr, "getsysinfo() for SI_KPROC_TAB failed.\n");
+       if(minix_getkproctab(ps_proc, nr_tasks + nr_procs, 1) < 0) {
+               fprintf(stderr, "minix_getkproctab failed.\n");
                exit(1);
        }
 
index f63d3bf6831f95d8428fea885c98a08bc83521de..fa19dc665b946dc3ef47718e579285ff8af19a43 100644 (file)
@@ -358,10 +358,11 @@ void showtop(int r)
 #endif
 
 retry:
-       if(getsysinfo(PM_PROC_NR, SI_KPROC_TAB, proc) < 0) {
-               fprintf(stderr, "getsysinfo() for SI_KPROC_TAB failed.\n");
+       if(minix_getkproctab(proc, PROCS, 1) < 0) {
+               fprintf(stderr, "minix_getkproctab failed.\n");
                exit(1);
        }
+
        if (!preheated) {
                preheated = 1;
                memcpy(prev_proc, proc, sizeof(prev_proc));