X-Git-Url: https://git.subgeniuskitty.com/unix-history/.git/blobdiff_plain/57ee57ff38cd4d6ce0116b20bdf4ee0ad6e308dc..56c4581e8030ca6db4de634f231d66520748f938:/usr/src/usr.bin/gcore/gcore.c diff --git a/usr/src/usr.bin/gcore/gcore.c b/usr/src/usr.bin/gcore/gcore.c index ef78e532a1..a8abbec60e 100644 --- a/usr/src/usr.bin/gcore/gcore.c +++ b/usr/src/usr.bin/gcore/gcore.c @@ -1,6 +1,29 @@ -/* Copyright (c) 1982 Regents of the University of California */ +/* + * Copyright (c) 1982 The Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that the above copyright notice and this paragraph are + * duplicated in all such forms and that any documentation, + * advertising materials, and other materials related to such + * distribution and use acknowledge that the software was developed + * by the University of California, Berkeley. The name of the + * University may not be used to endorse or promote products derived + * from this software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. + */ -static char sccsid[] = "@(#)gcore.c 4.2 (Berkeley) %G%"; +#ifndef lint +char copyright[] = +"@(#) Copyright (c) 1982 The Regents of the University of California.\n\ + All rights reserved.\n"; +#endif /* not lint */ + +#ifndef lint +static char sccsid[] = "@(#)gcore.c 5.4 (Berkeley) %G%"; +#endif /* not lint */ /* * gcore - get core images of running processes @@ -59,6 +82,10 @@ struct nlist nl[] = { #define X_NSWAP 3 { "_nproc" }, #define X_NPROC 4 + { "_dmmin" }, +#define X_DMMIN 5 + { "_dmmax" }, +#define X_DMMAX 6 { 0 }, }; @@ -79,6 +106,7 @@ union { int nproc; int nswap; +int dmmin, dmmax; struct pte *Usrptmap, *usrpt; char coref[20]; int kmem, mem, swap, cor; @@ -103,6 +131,8 @@ main(argc, argv) procbase = getw(nl[X_PROC].n_value); nproc = getw(nl[X_NPROC].n_value); nswap = getw(nl[X_NSWAP].n_value); + dmmin = getw(nl[X_DMMIN].n_value); + dmmax = getw(nl[X_DMMAX].n_value); while (--argc > 0) { if ((pid = atoi(*++argv)) <= 0 || setjmp(cont_frame)) continue; @@ -133,10 +163,8 @@ main(argc, argv) printf("Zombie.\n"); continue; } - if (p->p_flag & SWEXIT) { - printf("Process exiting.\n"); - continue; - } + if (p->p_flag & SWEXIT) + printf("Warning: process exiting.\n"); if (p->p_flag & SSYS) { printf("System process.\n"); /* i.e. swapper or pagedaemon */ @@ -347,14 +375,14 @@ vstodb(vsbase, vssize, dmp, dbp, rev) struct dmap *dmp; register struct dblock *dbp; { - register int blk = DMMIN; + register int blk = dmmin; register swblk_t *ip = dmp->dm_map; if (vsbase < 0 || vsbase + vssize > dmp->dm_size) panic("can't make sense out of virtual memory (gcore probably needs to be recompiled)"); while (vsbase >= blk) { vsbase -= blk; - if (blk < DMMAX) + if (blk < dmmax) blk *= 2; ip++; }