diff --git a/sys/kern/uipc_shm.c b/sys/kern/uipc_shm.c index d5a51e5732cc..4d064b57c804 100644 --- a/sys/kern/uipc_shm.c +++ b/sys/kern/uipc_shm.c @@ -81,6 +81,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -790,15 +791,7 @@ shm_map(struct file *fp, size_t size, off_t offset, void **memp) shmfd->shm_kmappings--; VM_OBJECT_UNLOCK(obj); - switch (rv) { - case KERN_INVALID_ADDRESS: - case KERN_NO_SPACE: - return (ENOMEM); - case KERN_PROTECTION_FAILURE: - return (EACCES); - default: - return (EINVAL); - } + return (vm_mmap_to_errno(rv)); } /*