Back to index

glibc  2.9
readonly-area.c File Reference
#include <stdlib.h>
#include <stdint.h>
#include <mach.h>

Go to the source code of this file.


int __readonly_area (const char *ptr, size_t size)

Function Documentation

int __readonly_area ( const char *  ptr,
size_t  size 

Definition at line 28 of file readonly-area.c.

  vm_address_t region_address = (uintptr_t) ptr;
  vm_size_t region_length = size;
  vm_prot_t protection;
  vm_prot_t max_protection;
  vm_inherit_t inheritance;
  boolean_t is_shared;
  mach_port_t object_name;
  vm_offset_t offset;

  while (__vm_region (__mach_task_self (),
                    &region_address, &region_length,
                    &protection, &max_protection, &inheritance, &is_shared,
                    &object_name, &offset) == KERN_SUCCESS
        && region_address <= (uintptr_t) ptr)
      region_address += region_length;
      if (region_address < (uintptr_t) ptr)

      if (protection & VM_PROT_WRITE)
       return -1;

      if (region_address - (uintptr_t) ptr >= size)

  return 1;

Here is the call graph for this function: