Back to index

glibc  2.9
Functions | Variables
brk.c File Reference
#include <errno.h>
#include <unistd.h>
#include <sysdep.h>

Go to the source code of this file.

Functions

int __brk (void *addr)

Variables

void * __curbrk = 0

Function Documentation

int __brk ( void *  addr)

Definition at line 28 of file brk.c.

{
  void *newbrk;
  register long r3 asm ("%r3") = SYS_ify (brk);
  register long r4 asm ("%r4") = (long)addr;

  asm volatile ("trapa #0x11\n\t" SYSCALL_INST_PAD
              : "=z"(newbrk) 
              : "r" (r3), "r" (r4));

  __curbrk = newbrk;

  if (newbrk < addr)
    {
      __set_errno (ENOMEM);
      return -1;
    }

  return 0;
}

Variable Documentation

void* __curbrk = 0

Definition at line 25 of file brk.c.