Back to index

plt-scheme  4.2.1
Functions | Variables
vm_memalign.c File Reference
#include <unistd.h>
#include <sys/types.h>
#include <sys/mman.h>
#include <errno.h>
#include "rlimit_heapsize.c"

Go to the source code of this file.


static voidvm_malloc_pages (VM *vm, size_t len, size_t alignment, int dirty_ok)
static void vm_free_pages (VM *vm, void *p, size_t len)
static void vm_flush_freed_pages (VM *vm)
static void vm_protect_pages (void *p, size_t len, int writeable)


static int page_size

Function Documentation

static void vm_flush_freed_pages ( VM vm) [static]

Definition at line 47 of file vm_memalign.c.

static void vm_free_pages ( VM vm,
void p,
size_t  len 
) [static]

Definition at line 41 of file vm_memalign.c.

Here is the call graph for this function:

static void* vm_malloc_pages ( VM vm,
size_t  len,
size_t  alignment,
int  dirty_ok 
) [static]

Definition at line 17 of file vm_memalign.c.

  void *r;

  if (!page_size)
    page_size = getpagesize();

  /* Round up to nearest page: */
  if (len & (page_size - 1))
    len += page_size - (len & (page_size - 1));

  if (posix_memalign(&r, alignment, len)) {
    if (errno == EINVAL)
      printf("Invalid request\n");
    return NULL;

  vm_memory_allocated_inc(vm, len);

    memset(p, 0, len);
  return r;

Here is the call graph for this function:

static void vm_protect_pages ( void p,
size_t  len,
int  writeable 
) [static]

Definition at line 51 of file vm_memalign.c.

  if (len & (page_size - 1)) {
    len += page_size - (len & (page_size - 1));

  mprotect(p, len, (writeable ? (PROT_READ | PROT_WRITE) : PROT_READ));

Here is the caller graph for this function:

Variable Documentation

int page_size [static]

Definition at line 15 of file vm_memalign.c.