Back to index

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

Go to the source code of this file.


int __mprotect (__ptr_t addr, size_t len, int prot)

Function Documentation

int __mprotect ( __ptr_t  addr,
size_t  len,
int  prot 

Definition at line 29 of file mprotect.c.

  kern_return_t err;
  vm_prot_t vmprot;

  vmprot = VM_PROT_NONE;
  if (prot & PROT_READ)
    vmprot |= VM_PROT_READ;
  if (prot & PROT_WRITE)
    vmprot |= VM_PROT_WRITE;
  if (prot & PROT_EXEC)
    vmprot |= VM_PROT_EXECUTE;

  if (err = __vm_protect (__mach_task_self (),
                       (vm_address_t) addr, (vm_size_t) len,
                       0, vmprot))
      errno = err;
      return -1;
  return 0;

Here is the call graph for this function: