MCPcopy Create free account
hub / github.com/F-Stack/f-stack / copyout_map

Function copyout_map

freebsd/kern/subr_uio.c:418–441  ·  view source on GitHub ↗

* Map some anonymous memory in user space of size sz, rounded up to the page * boundary. */

Source from the content-addressed store, hash-verified

416 * boundary.
417 */
418int
419copyout_map(struct thread *td, vm_offset_t *addr, size_t sz)
420{
421 struct vmspace *vms;
422 int error;
423 vm_size_t size;
424
425 vms = td->td_proc->p_vmspace;
426
427 /*
428 * Map somewhere after heap in process memory.
429 */
430 *addr = round_page((vm_offset_t)vms->vm_daddr +
431 lim_max(td, RLIMIT_DATA));
432
433 /* round size up to page boundary */
434 size = (vm_size_t)round_page(sz);
435 if (size == 0)
436 return (EINVAL);
437 error = vm_mmap_object(&vms->vm_map, addr, size, VM_PROT_READ |
438 VM_PROT_WRITE, VM_PROT_ALL, MAP_PRIVATE | MAP_ANON, NULL, 0,
439 FALSE, td);
440 return (error);
441}
442
443/*
444 * Unmap memory in user space.

Callers

nothing calls this directly

Calls 2

lim_maxFunction · 0.85
vm_mmap_objectFunction · 0.85

Tested by

no test coverage detected