Changeset View
Changeset View
Standalone View
Standalone View
head/sys/vm/vm_mmap.c
Show First 20 Lines • Show All 251 Lines • ▼ Show 20 Lines | #endif | ||||
* Align the file position to a page boundary, | * Align the file position to a page boundary, | ||||
* and save its page offset component. | * and save its page offset component. | ||||
*/ | */ | ||||
pageoff = (pos & PAGE_MASK); | pageoff = (pos & PAGE_MASK); | ||||
pos -= pageoff; | pos -= pageoff; | ||||
/* Adjust size for rounding (on both ends). */ | /* Adjust size for rounding (on both ends). */ | ||||
size += pageoff; /* low end... */ | size += pageoff; /* low end... */ | ||||
size = (vm_size_t) round_page(size); /* hi end */ | /* Check for rounding up to zero. */ | ||||
if (round_page(size) < size) | |||||
return (EINVAL); | |||||
size = round_page(size); /* hi end */ | |||||
/* Ensure alignment is at least a page and fits in a pointer. */ | /* Ensure alignment is at least a page and fits in a pointer. */ | ||||
align = flags & MAP_ALIGNMENT_MASK; | align = flags & MAP_ALIGNMENT_MASK; | ||||
if (align != 0 && align != MAP_ALIGNED_SUPER && | if (align != 0 && align != MAP_ALIGNED_SUPER && | ||||
(align >> MAP_ALIGNMENT_SHIFT >= sizeof(void *) * NBBY || | (align >> MAP_ALIGNMENT_SHIFT >= sizeof(void *) * NBBY || | ||||
align >> MAP_ALIGNMENT_SHIFT < PAGE_SHIFT)) | align >> MAP_ALIGNMENT_SHIFT < PAGE_SHIFT)) | ||||
return (EINVAL); | return (EINVAL); | ||||
▲ Show 20 Lines • Show All 1,328 Lines • Show Last 20 Lines |