Skip to content

Commit 25c6318

Browse files
committed
procstat: distinguish vm map guards in procstat vm output.
Requested and reviewed by: rwatson (previous version) Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D28658
1 parent bffc3fb commit 25c6318

File tree

4 files changed

+13
-3
lines changed

4 files changed

+13
-3
lines changed

sys/kern/kern_proc.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2514,7 +2514,7 @@ kern_proc_vmmap_out(struct proc *p, struct sbuf *sb, ssize_t maxlen, int flags)
25142514
vm_offset_t addr;
25152515
unsigned int last_timestamp;
25162516
int error;
2517-
bool super;
2517+
bool guard, super;
25182518

25192519
PROC_LOCK_ASSERT(p, MA_OWNED);
25202520

@@ -2584,6 +2584,8 @@ kern_proc_vmmap_out(struct proc *p, struct sbuf *sb, ssize_t maxlen, int flags)
25842584
if (entry->eflags & MAP_ENTRY_USER_WIRED)
25852585
kve->kve_flags |= KVME_FLAG_USER_WIRED;
25862586

2587+
guard = (entry->eflags & MAP_ENTRY_GUARD) != 0;
2588+
25872589
last_timestamp = map->timestamp;
25882590
vm_map_unlock_read(map);
25892591

@@ -2620,7 +2622,8 @@ kern_proc_vmmap_out(struct proc *p, struct sbuf *sb, ssize_t maxlen, int flags)
26202622
vput(vp);
26212623
}
26222624
} else {
2623-
kve->kve_type = KVME_TYPE_NONE;
2625+
kve->kve_type = guard ? KVME_TYPE_GUARD :
2626+
KVME_TYPE_NONE;
26242627
kve->kve_ref_count = 0;
26252628
kve->kve_shadow_count = 0;
26262629
}

sys/sys/user.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -465,6 +465,7 @@ struct kinfo_file {
465465
#define KVME_TYPE_DEAD 6
466466
#define KVME_TYPE_SG 7
467467
#define KVME_TYPE_MGTDEVICE 8
468+
#define KVME_TYPE_GUARD 9
468469
#define KVME_TYPE_UNKNOWN 255
469470

470471
#define KVME_PROT_READ 0x00000001

usr.bin/procstat/procstat.1

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
.\"
2626
.\" $FreeBSD$
2727
.\"
28-
.Dd November 24, 2020
28+
.Dd February 13, 2021
2929
.Dt PROCSTAT 1
3030
.Os
3131
.Sh NAME
@@ -674,6 +674,8 @@ scatter/gather
674674
swap
675675
.It vn
676676
vnode
677+
.It gd
678+
guard (pseudo-type)
677679
.El
678680
.Pp
679681
The following mapping flags may be displayed:

usr.bin/procstat/procstat_vm.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,10 @@ procstat_vm(struct procstat *procstat, struct kinfo_proc *kipp)
155155
str = "md";
156156
lstr = "managed_device";
157157
break;
158+
case KVME_TYPE_GUARD:
159+
str = "gd";
160+
lstr = "guard";
161+
break;
158162
case KVME_TYPE_UNKNOWN:
159163
default:
160164
str = "??";

0 commit comments

Comments
 (0)