date and time created 82/04/02 10:29:00 by wnj
[unix-history] / usr / src / usr.sbin / pstat / pstat.c
index 0539758..aa604b6 100644 (file)
@@ -1,4 +1,4 @@
-static char *sccsid = "@(#)pstat.c     4.2 (Berkeley) %G%";
+static char *sccsid = "@(#) (Berkeley) 82/03/31";
 /*
  * Print system stuff
  */
 /*
  * Print system stuff
  */
@@ -19,6 +19,8 @@ static char *sccsid = "@(#)pstat.c    4.2 (Berkeley) %G%";
 #include <sys/vm.h>
 #include <nlist.h>
 #include <sys/pte.h>
 #include <sys/vm.h>
 #include <nlist.h>
 #include <sys/pte.h>
+#define        KERNEL
+#undef KERNEL
 
 char   *fcore  = "/dev/kmem";
 char   *fnlist = "/vmunix";
 
 char   *fcore  = "/dev/kmem";
 char   *fnlist = "/vmunix";
@@ -51,6 +53,18 @@ struct nlist nl[] = {
        { "_dh11" },
 #define        SNDH    12
        { "_ndh11" },
        { "_dh11" },
 #define        SNDH    12
        { "_ndh11" },
+#define        SNPROC  13
+       { "_nproc" },
+#define        SNTEXT  14
+       { "_ntext" },
+#define        SNFILE  15
+       { "_nfile" },
+#define        SNINODE 16
+       { "_ninode" },
+#define        SNSWAPMAP 17
+       { "_nswapmap" },
+#define        SPTY    18
+       { "_pt_tty" },
        0,
 };
 
        0,
 };
 
@@ -59,6 +73,8 @@ int   txtf;
 int    prcf;
 int    ttyf;
 int    usrf;
 int    prcf;
 int    ttyf;
 int    usrf;
+int    mpxf;
+int    groupf;
 long   ubase;
 int    filf;
 int    swpf;
 long   ubase;
 int    filf;
 int    swpf;
@@ -127,6 +143,12 @@ char **argv;
                case 's':
                        swpf++;
                        break;
                case 's':
                        swpf++;
                        break;
+               case 'm':
+                       mpxf++;
+                       break;
+               case 'g':
+                       groupf++;
+                       break;
                }
        }
        if (argc>0)
                }
        }
        if (argc>0)
@@ -138,11 +160,6 @@ char **argv;
        if (argc>1)
                fnlist = argv[1];
        nlist(fnlist, nl);
        if (argc>1)
                fnlist = argv[1];
        nlist(fnlist, nl);
-       if (kflg) {
-               register struct nlist *nlp;
-               for (nlp=nl; nlp < &nl[sizeof (nl)/sizeof(nl[0])]; nlp++)
-                       nlp->n_value = clear(nlp->n_value);
-       }
        usrpt = (struct pte *)nl[USRPT].n_value;
        Usrptma = (struct pte *)nl[USRPTMA].n_value;
        if (nl[0].n_type == 0) {
        usrpt = (struct pte *)nl[USRPT].n_value;
        Usrptma = (struct pte *)nl[USRPTMA].n_value;
        if (nl[0].n_type == 0) {
@@ -150,7 +167,7 @@ char **argv;
                exit(1);
        }
        if (filf||totflg)
                exit(1);
        }
        if (filf||totflg)
-               dofil();
+               dofile();
        if (inof||totflg)
                doinode();
        if (prcf||totflg)
        if (inof||totflg)
                doinode();
        if (prcf||totflg)
@@ -168,26 +185,28 @@ char **argv;
 doinode()
 {
        register struct inode *ip;
 doinode()
 {
        register struct inode *ip;
-       struct inode xinode[NINODE];
-       register int nin, loc;
+       struct inode *xinode, *ainode;
+       register int nin;
+       int ninode;
 
        nin = 0;
 
        nin = 0;
-       lseek(fc, (long)nl[SINODE].n_value, 0);
-       read(fc, xinode, sizeof(xinode));
-       for (ip = xinode; ip < &xinode[NINODE]; ip++)
+       ninode = getw(nl[SNINODE].n_value);
+       xinode = (struct inode *)calloc(ninode, sizeof (struct inode));
+       lseek(fc, (int)(ainode = (struct inode *)getw(nl[SINODE].n_value)), 0);
+       read(fc, xinode, ninode * sizeof(struct inode));
+       for (ip = xinode; ip < &xinode[ninode]; ip++)
                if (ip->i_count)
                        nin++;
        if (totflg) {
                if (ip->i_count)
                        nin++;
        if (totflg) {
-               printf("%3d/%3d inodes\n", nin, NINODE);
+               printf("%3d/%3d inodes\n", nin, ninode);
                return;
        }
                return;
        }
-       printf("%d/%d active xinodes\n", nin, NINODE);
+       printf("%d/%d active inodes\n", nin, ninode);
        printf("   LOC    FLAGS  CNT DEVICE   INO  MODE  NLK UID   SIZE/DEV\n");
        printf("   LOC    FLAGS  CNT DEVICE   INO  MODE  NLK UID   SIZE/DEV\n");
-       loc = nl[SINODE].n_value;
-       for (ip = xinode; ip < &xinode[NINODE]; ip++, loc += sizeof(xinode[0])) {
+       for (ip = xinode; ip < &xinode[ninode]; ip++) {
                if (ip->i_count == 0)
                        continue;
                if (ip->i_count == 0)
                        continue;
-               printf("%8.1x ", loc);
+               printf("%8.1x ", ainode + (ip - xinode));
                putf(ip->i_flag&ILOCK, 'L');
                putf(ip->i_flag&IUPD, 'U');
                putf(ip->i_flag&IACC, 'A');
                putf(ip->i_flag&ILOCK, 'L');
                putf(ip->i_flag&IUPD, 'U');
                putf(ip->i_flag&IACC, 'A');
@@ -206,6 +225,21 @@ doinode()
                        printf("%10ld", ip->i_size);
                printf("\n");
        }
                        printf("%10ld", ip->i_size);
                printf("\n");
        }
+       free(xinode);
+}
+
+getw(loc)
+       off_t loc;
+{
+       int word;
+
+       if (kflg)
+               loc &= 0x7fffffff;
+       lseek(fc, loc, 0);
+       read(fc, &word, sizeof (word));
+       if (kflg)
+               word &= 0x7fffffff;
+       return (word);
 }
 
 putf(v, n)
 }
 
 putf(v, n)
@@ -219,26 +253,28 @@ putf(v, n)
 dotext()
 {
        register struct text *xp;
 dotext()
 {
        register struct text *xp;
-       struct text xtext[NTEXT];
-       register loc;
+       int ntext;
+       struct text *xtext, *atext;
        int ntx;
 
        ntx = 0;
        int ntx;
 
        ntx = 0;
-       lseek(fc, (long)nl[STEXT].n_value, 0);
-       read(fc, xtext, sizeof(xtext));
-       for (xp = xtext; xp < &xtext[NTEXT]; xp++)
+       ntext = getw(nl[SNTEXT].n_value);
+       xtext = (struct text *)calloc(ntext, sizeof (struct text));
+       lseek(fc, (int)(atext = (struct text *)getw(nl[STEXT].n_value)), 0);
+       read(fc, xtext, ntext * sizeof (struct text));
+       for (xp = xtext; xp < &xtext[ntext]; xp++)
                if (xp->x_iptr!=NULL)
                        ntx++;
        if (totflg) {
                if (xp->x_iptr!=NULL)
                        ntx++;
        if (totflg) {
-               printf("%3d/%3d texts\n", ntx, NTEXT);
+               printf("%3d/%3d texts\n", ntx, ntext);
                return;
        }
                return;
        }
+       printf("%d/%d active texts\n", ntx, ntext);
        printf("   LOC   FLAGS DADDR      CADDR  RSS SIZE      IPTR  CNT CCNT\n");
        printf("   LOC   FLAGS DADDR      CADDR  RSS SIZE      IPTR  CNT CCNT\n");
-       loc = nl[STEXT].n_value;
-       for (xp = xtext; xp < &xtext[NTEXT]; xp++, loc+=sizeof(xtext[0])) {
+       for (xp = xtext; xp < &xtext[ntext]; xp++) {
                if (xp->x_iptr == NULL)
                        continue;
                if (xp->x_iptr == NULL)
                        continue;
-               printf("%8.1x", loc);
+               printf("%8.1x", atext + (xp - xtext));
                printf(" ");
                putf(xp->x_flag&XPAGI, 'P');
                putf(xp->x_flag&XTRC, 'T');
                printf(" ");
                putf(xp->x_flag&XPAGI, 'P');
                putf(xp->x_flag&XTRC, 'T');
@@ -255,31 +291,35 @@ dotext()
                printf("%5d", xp->x_ccount);
                printf("\n");
        }
                printf("%5d", xp->x_ccount);
                printf("\n");
        }
+       free(xtext);
 }
 
 doproc()
 {
 }
 
 doproc()
 {
-       struct proc xproc[NPROC];
+       struct proc *xproc, *aproc;
+       int nproc;
        register struct proc *pp;
        register loc, np;
        struct pte apte;
 
        register struct proc *pp;
        register loc, np;
        struct pte apte;
 
-       lseek(fc, (long)nl[SPROC].n_value, 0);
-       read(fc, xproc, sizeof(xproc));
+       nproc = getw(nl[SNPROC].n_value);
+       xproc = (struct proc *)calloc(nproc, sizeof (struct proc));
+       lseek(fc, (int)(aproc = (struct proc *)getw(nl[SPROC].n_value)), 0);
+       read(fc, xproc, nproc * sizeof (struct proc));
        np = 0;
        np = 0;
-       for (pp=xproc; pp < &xproc[NPROC]; pp++)
+       for (pp=xproc; pp < &xproc[nproc]; pp++)
                if (pp->p_stat)
                        np++;
        if (totflg) {
                if (pp->p_stat)
                        np++;
        if (totflg) {
-               printf("%3d/%3d processes\n", np, NPROC);
+               printf("%3d/%3d processes\n", np, nproc);
                return;
        }
                return;
        }
-       printf("%d/%d processes\n", np, NPROC);
+       printf("%d/%d processes\n", np, nproc);
        printf("   LOC    S    F POIP PRI      SIG  UID SLP TIM  CPU  NI   PGRP    PID   PPID    ADDR   RSS SRSS SIZE    WCHAN    LINK   TEXTP CLKT\n");
        printf("   LOC    S    F POIP PRI      SIG  UID SLP TIM  CPU  NI   PGRP    PID   PPID    ADDR   RSS SRSS SIZE    WCHAN    LINK   TEXTP CLKT\n");
-       for (loc=nl[SPROC].n_value,pp=xproc; pp<&xproc[NPROC]; pp++,loc+=sizeof(xproc[0])) {
+       for (pp=xproc; pp<&xproc[nproc]; pp++) {
                if (pp->p_stat==0 && allflg==0)
                        continue;
                if (pp->p_stat==0 && allflg==0)
                        continue;
-               printf("%8x", loc);
+               printf("%8x", aproc + (pp - xproc));
                printf(" %2d", pp->p_stat);
                printf(" %4x", pp->p_flag & 0xffff);
                printf(" %4d", pp->p_poip);
                printf(" %2d", pp->p_stat);
                printf(" %4x", pp->p_flag & 0xffff);
                printf(" %4d", pp->p_poip);
@@ -311,36 +351,57 @@ doproc()
 
 dotty()
 {
 
 dotty()
 {
-       struct tty dz_tty[64];
+       struct tty dz_tty[128];
        int ndz;
        register struct tty *tp;
        register char *mesg;
 
        printf("1 cons\n");
        int ndz;
        register struct tty *tp;
        register char *mesg;
 
        printf("1 cons\n");
+       if (kflg)
+               nl[SKL].n_value = clear(nl[SKL].n_value);
        lseek(fc, (long)nl[SKL].n_value, 0);
        read(fc, dz_tty, sizeof(dz_tty[0]));
        mesg = " # RAW CAN OUT   MODE    ADDR   DEL COL  STATE   PGRP DISC\n";
        printf(mesg);
        ttyprt(&dz_tty[0], 0);
        lseek(fc, (long)nl[SKL].n_value, 0);
        read(fc, dz_tty, sizeof(dz_tty[0]));
        mesg = " # RAW CAN OUT   MODE    ADDR   DEL COL  STATE   PGRP DISC\n";
        printf(mesg);
        ttyprt(&dz_tty[0], 0);
-       if (nl[SNDZ].n_type == -1)
+       if (nl[SNDZ].n_type == 0)
                goto dh;
                goto dh;
+       if (kflg) {
+               nl[SNDZ].n_value = clear(nl[SNDZ].n_value);
+               nl[SDZ].n_value = clear(nl[SDZ].n_value);
+       }
        lseek(fc, (long)nl[SNDZ].n_value, 0);
        read(fc, &ndz, sizeof(ndz));
        printf("%d dz lines\n", ndz);
        lseek(fc, (long)nl[SDZ].n_value, 0);
        lseek(fc, (long)nl[SNDZ].n_value, 0);
        read(fc, &ndz, sizeof(ndz));
        printf("%d dz lines\n", ndz);
        lseek(fc, (long)nl[SDZ].n_value, 0);
-       read(fc, dz_tty, sizeof(dz_tty));
+       read(fc, dz_tty, ndz * sizeof (struct tty));
        for (tp = dz_tty; tp < &dz_tty[ndz]; tp++)
                ttyprt(tp, tp - dz_tty);
 dh:
        for (tp = dz_tty; tp < &dz_tty[ndz]; tp++)
                ttyprt(tp, tp - dz_tty);
 dh:
-       if (nl[SNDH].n_type == -1)
-               return;
+       if (nl[SNDH].n_type == 0)
+               goto pty;
+       if (kflg) {
+               nl[SNDH].n_value = clear(nl[SNDH].n_value);
+               nl[SDH].n_value = clear(nl[SDH].n_value);
+       }
        lseek(fc, (long)nl[SNDH].n_value, 0);
        read(fc, &ndz, sizeof(ndz));
        printf("%d dh lines\n", ndz);
        lseek(fc, (long)nl[SDH].n_value, 0);
        lseek(fc, (long)nl[SNDH].n_value, 0);
        read(fc, &ndz, sizeof(ndz));
        printf("%d dh lines\n", ndz);
        lseek(fc, (long)nl[SDH].n_value, 0);
-       read(fc, dz_tty, sizeof(dz_tty));
+       read(fc, dz_tty, ndz * sizeof(struct tty));
        for (tp = dz_tty; tp < &dz_tty[ndz]; tp++)
                ttyprt(tp, tp - dz_tty);
        for (tp = dz_tty; tp < &dz_tty[ndz]; tp++)
                ttyprt(tp, tp - dz_tty);
+pty:
+       if (nl[SPTY].n_type == 0)
+               goto pty;
+       if (kflg) {
+               nl[SPTY].n_value = clear(nl[SPTY].n_value);
+       }
+       printf("32 pty lines\n");
+       lseek(fc, (long)nl[SPTY].n_value, 0);
+       read(fc, dz_tty, 32*sizeof(struct tty));
+       for (tp = dz_tty; tp < &dz_tty[32]; tp++)
+               ttyprt(tp, tp - dz_tty);
 }
 
 ttyprt(atp, line)
 }
 
 ttyprt(atp, line)
@@ -352,12 +413,14 @@ struct tty *atp;
        tp = atp;
        switch (tp->t_line) {
 
        tp = atp;
        switch (tp->t_line) {
 
+/*
        case NETLDISC:
                if (tp->t_rec)
                        printf("%4d%4d", 0, tp->t_inbuf);
                else
                        printf("%4d%4d", tp->t_inbuf, 0);
                break;
        case NETLDISC:
                if (tp->t_rec)
                        printf("%4d%4d", 0, tp->t_inbuf);
                else
                        printf("%4d%4d", tp->t_inbuf, 0);
                break;
+*/
 
        default:
                printf("%4d", tp->t_rawq.c_cc);
 
        default:
                printf("%4d", tp->t_rawq.c_cc);
@@ -368,15 +431,15 @@ struct tty *atp;
        printf(" %8.1x", tp->t_addr);
        printf("%3d", tp->t_delct);
        printf("%4d ", tp->t_col);
        printf(" %8.1x", tp->t_addr);
        printf("%3d", tp->t_delct);
        printf("%4d ", tp->t_col);
-       putf(tp->t_state&TIMEOUT, 'T');
-       putf(tp->t_state&WOPEN, 'W');
-       putf(tp->t_state&ISOPEN, 'O');
-       putf(tp->t_state&CARR_ON, 'C');
-       putf(tp->t_state&BUSY, 'B');
-       putf(tp->t_state&ASLEEP, 'A');
-       putf(tp->t_state&XCLUDE, 'X');
+       putf(tp->t_state&TS_TIMEOUT, 'T');
+       putf(tp->t_state&TS_WOPEN, 'W');
+       putf(tp->t_state&TS_ISOPEN, 'O');
+       putf(tp->t_state&TS_CARR_ON, 'C');
+       putf(tp->t_state&TS_BUSY, 'B');
+       putf(tp->t_state&TS_ASLEEP, 'A');
+       putf(tp->t_state&TS_XCLUDE, 'X');
 /*
 /*
-       putf(tp->t_state&HUPCLS, 'H');
+       putf(tp->t_state&TS_HUPCLS, 'H');
  */
        printf("%6d", tp->t_pgrp);
        switch (tp->t_line) {
  */
        printf("%6d", tp->t_pgrp);
        switch (tp->t_line) {
@@ -464,7 +527,7 @@ dousr()
        for (i=0; i<NSIG; i++)
                printf("%.1x ", U.u_signal[i]);
        printf("\n");
        for (i=0; i<NSIG; i++)
                printf("%.1x ", U.u_signal[i]);
        printf("\n");
-       printf("cfcode\t%.1x\n", U.u_cfcode);
+       printf("code\t%.1x\n", U.u_code);
        printf("ar0\t%.1x\n", U.u_ar0);
        printf("prof\t%X %X %X %X\n", U.u_prof.pr_base, U.u_prof.pr_size,
            U.u_prof.pr_off, U.u_prof.pr_scale);
        printf("ar0\t%.1x\n", U.u_ar0);
        printf("prof\t%X %X %X %X\n", U.u_prof.pr_base, U.u_prof.pr_size,
            U.u_prof.pr_off, U.u_prof.pr_scale);
@@ -517,65 +580,80 @@ char *s;
        return(v);
 }
 
        return(v);
 }
 
-dofil()
+dofile()
 {
 {
-       struct file xfile[NFILE];
+       int nfile;
+       struct file *xfile, *afile;
        register struct file *fp;
        register nf;
        int loc;
 
        nf = 0;
        register struct file *fp;
        register nf;
        int loc;
 
        nf = 0;
-       lseek(fc, (long)nl[SFIL].n_value, 0);
-       read(fc, xfile, sizeof(xfile));
-       for (fp=xfile; fp < &xfile[NFILE]; fp++)
+       nfile = getw(nl[SNFILE].n_value);
+       xfile = (struct file *)calloc(nfile, sizeof (struct file));
+       lseek(fc, (int)(afile = (struct file *)getw(nl[SFIL].n_value)), 0);
+       read(fc, xfile, nfile * sizeof (struct file));
+       for (fp=xfile; fp < &xfile[nfile]; fp++)
                if (fp->f_count)
                        nf++;
        if (totflg) {
                if (fp->f_count)
                        nf++;
        if (totflg) {
-               printf("%3d/%3d files\n", nf, NFILE);
+               printf("%3d/%3d files\n", nf, nfile);
                return;
        }
                return;
        }
-       printf("%d/%d open files\n", nf, NFILE);
-       printf("   LOC   FLG  CNT   INO    OFFS\n");
-       for (fp=xfile,loc=nl[SFIL].n_value; fp < &xfile[NFILE]; fp++,loc+=sizeof(xfile[0])) {
+       printf("%d/%d open files\n", nf, nfile);
+       printf("   LOC   FLG  CNT   INO    OFFS|SOCK\n");
+       for (fp=xfile,loc=nl[SFIL].n_value; fp < &xfile[nfile]; fp++,loc+=sizeof(xfile[0])) {
                if (fp->f_count==0)
                        continue;
                printf("%8x ", loc);
                putf(fp->f_flag&FREAD, 'R');
                putf(fp->f_flag&FWRITE, 'W');
                if (fp->f_count==0)
                        continue;
                printf("%8x ", loc);
                putf(fp->f_flag&FREAD, 'R');
                putf(fp->f_flag&FWRITE, 'W');
-               putf(fp->f_flag&FPIPE, 'P');
+               putf(fp->f_flag&FSOCKET, 'S');
                printf("%4d", mask(fp->f_count));
                printf("%9.1x", fp->f_inode);
                printf("%4d", mask(fp->f_count));
                printf("%9.1x", fp->f_inode);
-               printf("  %ld\n", fp->f_un.f_offset);
+               if (fp->f_flag&FSOCKET)
+                       printf("  %x\n", fp->f_socket);
+               else
+                       printf("  %ld\n", fp->f_offset);
        }
 }
 
 doswap()
 {
        }
 }
 
 doswap()
 {
-       struct proc proc[NPROC];
-       struct text xtext[NTEXT];
-       struct map swapmap[SMAPSIZ];
+       struct proc *proc;
+       int nproc;
+       struct text *xtext;
+       int ntext;
+       struct map *swapmap;
+       int nswapmap;
        register struct proc *pp;
        int nswap, used, tused, free;
        register struct proc *pp;
        int nswap, used, tused, free;
-       register struct map *mp;
+       register struct mapent *me;
        register struct text *xp;
 
        register struct text *xp;
 
-       lseek(fc, (long)nl[SPROC].n_value, 0);
-       read(fc, proc, sizeof(proc));
-       lseek(fc, (long)nl[SWAPMAP].n_value, 0);
-       read(fc, swapmap, sizeof(swapmap));
-       lseek(fc, (long)nl[SNSWAP].n_value, 0);
-       read(fc, &nswap, sizeof(nswap));
+       nproc = getw(nl[SNPROC].n_value);
+       proc = (struct proc *)calloc(nproc, sizeof (struct proc));
+       lseek(fc, getw(nl[SPROC].n_value), 0);
+       read(fc, proc, nproc * sizeof (struct proc));
+       nswapmap = getw(nl[SNSWAPMAP].n_value);
+       swapmap = (struct map *)calloc(nswapmap, sizeof (struct map));
+       lseek(fc, getw(nl[SWAPMAP].n_value), 0);
+       read(fc, swapmap, nswapmap * sizeof (struct map));
+       nswap = getw(nl[SNSWAP].n_value);
        free = 0;
        free = 0;
-       for (mp = swapmap; mp < &swapmap[SMAPSIZ]; mp++)
-               free += mp->m_size;
-       lseek(fc, (long)nl[STEXT].n_value, 0);
-       read(fc, xtext, sizeof(xtext));
+       for (me = (struct mapent *)(swapmap+1);
+           me < (struct mapent *)&swapmap[nswapmap]; me++)
+               free += me->m_size;
+       ntext = getw(nl[SNTEXT].n_value);
+       xtext = (struct text *)calloc(ntext, sizeof (struct text));
+       lseek(fc, getw(nl[STEXT].n_value), 0);
+       read(fc, xtext, ntext * sizeof (struct text));
        tused = 0;
        tused = 0;
-       for (xp = xtext; xp < &xtext[NTEXT]; xp++)
+       for (xp = xtext; xp < &xtext[ntext]; xp++)
                if (xp->x_iptr!=NULL)
                        tused += xdsize(xp);
        used = tused;
                if (xp->x_iptr!=NULL)
                        tused += xdsize(xp);
        used = tused;
-       for (pp = proc; pp < &proc[NPROC]; pp++) {
+       for (pp = proc; pp < &proc[nproc]; pp++) {
                if (pp->p_stat == 0 || pp->p_stat == SZOMB)
                        continue;
                if (pp->p_flag & SSYS)
                if (pp->p_stat == 0 || pp->p_stat == SZOMB)
                        continue;
                if (pp->p_flag & SSYS)
@@ -584,13 +662,13 @@ doswap()
                if ((pp->p_flag&SLOAD) == 0)
                        used += vusize(pp);
        }
                if ((pp->p_flag&SLOAD) == 0)
                        used += vusize(pp);
        }
-       /* a DMMAX block goes to argmap */
+       /* a DMMAX/2 block goes to argmap */
        if (totflg) {
                printf("%3d/%3d 00k swap\n", used/2/100, (used+free)/2/100);
                return;
        }
        printf("%d used (%d text), %d free, %d missing\n",
        if (totflg) {
                printf("%3d/%3d 00k swap\n", used/2/100, (used+free)/2/100);
                return;
        }
        printf("%d used (%d text), %d free, %d missing\n",
-           used/2, tused/2, free/2, (nswap - DMMAX - (used + free))/2);
+           used/2, tused/2, free/2, (nswap - DMMAX/2 - (used + free))/2);
 }
 
 up(size)
 }
 
 up(size)
@@ -624,3 +702,4 @@ struct text *xp;
                return (clrnd(xp->x_size + ctopt(xp->x_size)));
        return (xp->x_size);
 }
                return (clrnd(xp->x_size + ctopt(xp->x_size)));
        return (xp->x_size);
 }
+