procstat_vm.c (238852) | procstat_vm.c (250871) |
---|---|
1/*- 2 * Copyright (c) 2007 Robert N. M. Watson 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 9 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * | 1/*- 2 * Copyright (c) 2007 Robert N. M. Watson 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 9 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * |
26 * $FreeBSD: stable/9/usr.bin/procstat/procstat_vm.c 238852 2012-07-27 19:56:36Z trociny $ | 26 * $FreeBSD: stable/9/usr.bin/procstat/procstat_vm.c 250871 2013-05-21 19:05:27Z trociny $ |
27 */ 28 29#include <sys/param.h> 30#include <sys/sysctl.h> 31#include <sys/user.h> 32 33#include <err.h> 34#include <errno.h> 35#include <libprocstat.h> 36#include <stdio.h> 37#include <stdlib.h> 38#include <stdint.h> 39#include <libutil.h> 40 41#include "procstat.h" 42 43void | 27 */ 28 29#include <sys/param.h> 30#include <sys/sysctl.h> 31#include <sys/user.h> 32 33#include <err.h> 34#include <errno.h> 35#include <libprocstat.h> 36#include <stdio.h> 37#include <stdlib.h> 38#include <stdint.h> 39#include <libutil.h> 40 41#include "procstat.h" 42 43void |
44procstat_vm(struct kinfo_proc *kipp) | 44procstat_vm(struct procstat *procstat, struct kinfo_proc *kipp) |
45{ 46 struct kinfo_vmentry *freep, *kve; 47 int ptrwidth; 48 int i, cnt; 49 const char *str; 50 51 ptrwidth = 2*sizeof(void *) + 2; 52 if (!hflag) 53 printf("%5s %*s %*s %3s %4s %4s %3s %3s %4s %-2s %-s\n", 54 "PID", ptrwidth, "START", ptrwidth, "END", "PRT", "RES", 55 "PRES", "REF", "SHD", "FL", "TP", "PATH"); 56 | 45{ 46 struct kinfo_vmentry *freep, *kve; 47 int ptrwidth; 48 int i, cnt; 49 const char *str; 50 51 ptrwidth = 2*sizeof(void *) + 2; 52 if (!hflag) 53 printf("%5s %*s %*s %3s %4s %4s %3s %3s %4s %-2s %-s\n", 54 "PID", ptrwidth, "START", ptrwidth, "END", "PRT", "RES", 55 "PRES", "REF", "SHD", "FL", "TP", "PATH"); 56 |
57 freep = kinfo_getvmmap(kipp->ki_pid, &cnt); | 57 freep = procstat_getvmmap(procstat, kipp, &cnt); |
58 if (freep == NULL) 59 return; 60 for (i = 0; i < cnt; i++) { 61 kve = &freep[i]; 62 printf("%5d ", kipp->ki_pid); 63 printf("%#*jx ", ptrwidth, (uintmax_t)kve->kve_start); 64 printf("%#*jx ", ptrwidth, (uintmax_t)kve->kve_end); 65 printf("%s", kve->kve_protection & KVME_PROT_READ ? "r" : "-"); --- 47 unchanged lines hidden --- | 58 if (freep == NULL) 59 return; 60 for (i = 0; i < cnt; i++) { 61 kve = &freep[i]; 62 printf("%5d ", kipp->ki_pid); 63 printf("%#*jx ", ptrwidth, (uintmax_t)kve->kve_start); 64 printf("%#*jx ", ptrwidth, (uintmax_t)kve->kve_end); 65 printf("%s", kve->kve_protection & KVME_PROT_READ ? "r" : "-"); --- 47 unchanged lines hidden --- |