X-Git-Url: https://git.subgeniuskitty.com/unix-history/.git/blobdiff_plain/8c8a5b54e79564c14fc7a2823a21a8f048449bcf..af359dea2e5ab3e937b62107ecd6a51d78189ed7:/usr/src/bin/ps/print.c diff --git a/usr/src/bin/ps/print.c b/usr/src/bin/ps/print.c index 3d26cae49a..ce4be52cbd 100644 --- a/usr/src/bin/ps/print.c +++ b/usr/src/bin/ps/print.c @@ -2,11 +2,37 @@ * Copyright (c) 1990 The Regents of the University of California. * All rights reserved. * - * %sccs.include.redist.c% + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. */ #ifndef lint -static char sccsid[] = "@(#)print.c 5.5 (Berkeley) %G%"; +static char sccsid[] = "@(#)print.c 5.9 (Berkeley) 7/1/91"; #endif /* not lint */ #include @@ -142,10 +168,12 @@ state(k, v) *cp++ = '<'; else if (p->p_nice > NZERO) *cp++ = 'N'; +#ifndef NEWVM if (flag & SUANOM) *cp++ = 'A'; else if (flag & SSEQL) *cp++ = 'S'; +#endif if (flag & STRC) *cp++ = 'X'; if (flag & SWEXIT && p->p_stat != SZOMB) @@ -156,7 +184,11 @@ state(k, v) if (flag & SVFORK) #endif *cp++ = 'V'; +#ifdef NEWVM + if (flag & (SSYS|SLOCK|SKEEP|SPHYSIO)) +#else if (flag & (SSYS|SLOCK|SULOCK|SKEEP|SPHYSIO)) +#endif *cp++ = 'L'; if (k->ki_e->e_flag & EPROC_SLEADER) *cp++ = 's'; @@ -262,11 +294,11 @@ started(k, v) if (!now) (void)time(&now); if (now - k->ki_u->u_start.tv_sec < 24 * SECSPERHOUR) { - static char *fmt = "%l:@M%p"; + static char fmt[] = "%l:@M%p"; fmt[3] = '%'; /* I *hate* SCCS... */ (void) strftime(buf, sizeof(buf) - 1, fmt, tp); } else if (now - k->ki_u->u_start.tv_sec < 7 * SECSPERDAY) { - static char *fmt = "%a@I%p"; + static char fmt[] = "%a@I%p"; fmt[2] = '%'; /* I *hate* SCCS... */ (void) strftime(buf, sizeof(buf) - 1, fmt, tp); } else @@ -297,7 +329,7 @@ wchan(k, v) if (k->ki_p->p_wmesg) (void) printf("%-*.*s", v->width, v->width, k->ki_e->e_wmesg); else - (void) printf("%*x", v->width, + (void) printf("%-*x", v->width, (int)k->ki_p->p_wchan &~ KERNBASE); } else (void) printf("%-*s", v->width, "-"); @@ -414,7 +446,7 @@ double getpmem(k) KINFO *k; { - extern int ecmx, nlistread; + extern int mempages, nlistread; static int failure; struct proc *p; struct eproc *e; @@ -432,14 +464,14 @@ getpmem(k) return (0.0); #ifndef NEWVM szptudot = UPAGES + clrnd(ctopt(p->p_dsize + p->p_ssize + e->e_xsize)); - fracmem = ((float)p->p_rssize + szptudot)/CLSIZE/ecmx; + fracmem = ((float)p->p_rssize + szptudot)/CLSIZE/mempages; if (p->p_textp && e->e_xccount) - fracmem += ((float)e->e_xrssize)/CLSIZE/e->e_xccount/ecmx; + fracmem += ((float)e->e_xrssize)/CLSIZE/e->e_xccount/mempages; #else /* NEWVM */ /* XXX want pmap ptpages, segtab, etc. (per architecture) */ szptudot = UPAGES; /* XXX don't have info about shared */ - fracmem = ((float)e->e_vm.vm_rssize + szptudot)/CLSIZE/ecmx; + fracmem = ((float)e->e_vm.vm_rssize + szptudot)/CLSIZE/mempages; #endif /* NEWVM */ return (100.0 * fracmem); } @@ -563,6 +595,6 @@ printval(bp, v) (void) printf(ofmt, v->width, *(u_long *)bp &~ KERNBASE); break; default: - error("unknown type %d", v->type); + err("unknown type %d", v->type); } }