BSD 4_1_snap release
[unix-history] / usr / src / cmd / pxp / pmon.c
index 31ef728..5871a35 100644 (file)
@@ -1,3 +1,4 @@
+static char *sccsid = "@(#)pmon.c      1.1 (Berkeley) 3/2/81";
 /* Copyright (c) 1979 Regents of the University of California */
 #
 /*
 /* Copyright (c) 1979 Regents of the University of California */
 #
 /*
@@ -157,29 +158,29 @@ pmread()
        register i;
        register char *cp;
        struct {
        register i;
        register char *cp;
        struct {
-               short   no;
-               short   no2;
-               long    tvec;
+               long    no;
+               long    tim;
+               long    cntrs;
+               long    rtns;
        } zmagic;
 
        if (read(zfil, &zmagic, sizeof zmagic) != sizeof zmagic)
                return (-1);
        } zmagic;
 
        if (read(zfil, &zmagic, sizeof zmagic) != sizeof zmagic)
                return (-1);
-       if (zmagic.no != 0426 || zmagic.no2)
+       if (zmagic.no != 0426)
                return (-1);
                return (-1);
-       ptvec = zmagic.tvec;
-       if (read(zfil, &zcnt, 2) != 2)
-               return (-1);
-       if (read(zfil, &zpfcnt, 2) != 2)
-               return (-1);
-       cp = zbuf = alloc(i = zcnt * sizeof *zbuf);
+       ptvec = zmagic.tim;
+       zcnt = zmagic.cntrs;
+       zpfcnt = zmagic.rtns;
+       cp = zbuf = alloc(i = (zcnt + 1) * sizeof *zbuf);
        if (cp == -1)
                pmnospac();
        cp = zpf = alloc(zpfcnt * sizeof *zpf);
        if (cp == -1)
                pmnospac();
        if (cp == -1)
                pmnospac();
        cp = zpf = alloc(zpfcnt * sizeof *zpf);
        if (cp == -1)
                pmnospac();
-       if (read(zfil, zbuf, i) != i)
+       i -= sizeof(zmagic);
+       if (read(zfil, zbuf + (sizeof(zmagic) / sizeof(zbuf)), i) != i)
                return (-1);
                return (-1);
-       zbuf =- 2;
+       zbuf++;
        return (0);
 }
 
        return (0);
 }