diff options
Diffstat (limited to 'sys/kern/vfs_vnops.c')
-rw-r--r-- | sys/kern/vfs_vnops.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c index f9da22b..601f3f2 100644 --- a/sys/kern/vfs_vnops.c +++ b/sys/kern/vfs_vnops.c @@ -2479,10 +2479,12 @@ vn_mmap(struct file *fp, vm_map_t map, vm_offset_t *addr, vm_size_t size, } #ifdef HWPMC_HOOKS /* Inform hwpmc(4) if an executable is being mapped. */ - if (error == 0 && (prot & VM_PROT_EXECUTE) != 0) { - pkm.pm_file = vp; - pkm.pm_address = (uintptr_t) *addr; - PMC_CALL_HOOK(td, PMC_FN_MMAP, (void *) &pkm); + if (PMC_HOOK_INSTALLED(PMC_FN_MMAP)) { + if ((prot & VM_PROT_EXECUTE) != 0 && error == 0) { + pkm.pm_file = vp; + pkm.pm_address = (uintptr_t) *addr; + PMC_CALL_HOOK(td, PMC_FN_MMAP, (void *) &pkm); + } } #endif return (error); |