Back to index

glibc  2.9
mlock.c File Reference
#include <sys/types.h>
#include <sys/mman.h>
#include <errno.h>
#include <hurd.h>
#include <mach/mach_host.h>

Go to the source code of this file.


int mlock (const void *addr, size_t len)

Function Documentation

int mlock ( const void *  addr,
size_t  len 

Definition at line 30 of file mlock.c.

  mach_port_t hostpriv;
  vm_address_t page;
  error_t err;

  err = __get_privileged_ports (&hostpriv, NULL);
  if (err)
    return __hurd_fail (EPERM);

  page = trunc_page ((vm_address_t) addr);
  len = round_page ((vm_address_t) addr + len) - page;
  err = __vm_wire (hostpriv, __mach_task_self (), page, len,
                 VM_PROT_ALL); /* XXX ? */
  __mach_port_deallocate (__mach_task_self (), hostpriv);

  return err ? __hurd_fail (err) : 0;

Here is the call graph for this function: