Changeset View
Changeset View
Standalone View
Standalone View
head/sys/vm/vm_unix.c
Show First 20 Lines • Show All 96 Lines • ▼ Show 20 Lines | if (new - base > datalim && new > old) { | ||||
goto done; | goto done; | ||||
} | } | ||||
if (new > vm_map_max(map)) { | if (new > vm_map_max(map)) { | ||||
error = ENOMEM; | error = ENOMEM; | ||||
goto done; | goto done; | ||||
} | } | ||||
} else if (new < base) { | } else if (new < base) { | ||||
/* | /* | ||||
* This is simply an invalid value. If someone wants to | * Simply return the current break address without | ||||
* do fancy address space manipulations, mmap and munmap | * modifying any state. This is an ad-hoc interface | ||||
* can do most of what the user would want. | * used by libc to determine the initial break address, | ||||
* avoiding a dependency on magic features in the system | |||||
* linker. | |||||
*/ | */ | ||||
error = EINVAL; | new = old; | ||||
goto done; | goto done; | ||||
} | } | ||||
if (new > old) { | if (new > old) { | ||||
if (!old_mlock && map->flags & MAP_WIREFUTURE) { | if (!old_mlock && map->flags & MAP_WIREFUTURE) { | ||||
if (ptoa(pmap_wired_count(map->pmap)) + | if (ptoa(pmap_wired_count(map->pmap)) + | ||||
(new - old) > lmemlim) { | (new - old) > lmemlim) { | ||||
error = ENOMEM; | error = ENOMEM; | ||||
goto done; | goto done; | ||||
} | } | ||||
} | } | ||||
▲ Show 20 Lines • Show All 99 Lines • ▼ Show 20 Lines | |||||
#endif | #endif | ||||
} | } | ||||
done: | done: | ||||
vm_map_unlock(map); | vm_map_unlock(map); | ||||
if (do_map_wirefuture) | if (do_map_wirefuture) | ||||
(void) vm_map_wire(map, old, new, | (void) vm_map_wire(map, old, new, | ||||
VM_MAP_WIRE_USER|VM_MAP_WIRE_NOHOLES); | VM_MAP_WIRE_USER|VM_MAP_WIRE_NOHOLES); | ||||
if (error == 0) | |||||
td->td_retval[0] = new; | |||||
return (error); | return (error); | ||||
#else /* defined(__aarch64__) || defined(__riscv__) */ | #else /* defined(__aarch64__) || defined(__riscv__) */ | ||||
return (ENOSYS); | return (ENOSYS); | ||||
#endif /* defined(__aarch64__) || defined(__riscv__) */ | #endif /* defined(__aarch64__) || defined(__riscv__) */ | ||||
} | } | ||||
#ifdef COMPAT_FREEBSD11 | #ifdef COMPAT_FREEBSD11 | ||||
int | int | ||||
freebsd11_vadvise(struct thread *td, struct freebsd11_vadvise_args *uap) | freebsd11_vadvise(struct thread *td, struct freebsd11_vadvise_args *uap) | ||||
{ | { | ||||
return (EINVAL); | return (EINVAL); | ||||
} | } | ||||
#endif | #endif |