mmap: check if mapping a character device is actually possible

This commit is contained in:
Matheus
2024-09-03 18:41:26 -03:00
parent af92e8eb87
commit e75aab367d
3 changed files with 18 additions and 0 deletions
+5
View File
@@ -176,6 +176,11 @@ int devfs_mmap(vnode_t *node, void *addr, uintmax_t offset, int flags, cred_t *c
if (devnode->devops->mmap == NULL)
return ENODEV;
// if addr is this magic value, the caller is only
// testing for mmap support from the device
if (addr == VOP_MMAP_ADDRESS_MMAP_SUPPORTED)
return 0;
return devnode->devops->mmap(devnode->attr.rdevminor, addr, offset, flags);
}