Back to index

glibc  2.9
Functions | Variables
sbrk.c File Reference
#include <unistd.h>
#include <errno.h>
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.


int __brk (void *addr)
void * __sbrk (intptr_t increment)


void * __curbrk
int __libc_multiple_libcs attribute_hidden

Function Documentation

int __brk ( void *  addr)

Definition at line 28 of file brk.c.

  __set_errno (ENOSYS);
  return -1;
void* __sbrk ( intptr_t  increment)

Definition at line 33 of file sbrk.c.

  void *oldbrk;

  /* If this is not part of the dynamic library or the library is used
     via dynamic loading in a statically linked program update
     __curbrk from the kernel's brk value.  That way two separate
     instances of __brk and __sbrk can share the heap, returning
     interleaved pieces of it.  */
  if (__curbrk == NULL || __libc_multiple_libcs)
    if (__brk (0) < 0)             /* Initialize the break.  */
      return (void *) -1;

  if (increment == 0)
    return __curbrk;

  oldbrk = __curbrk;
  if (__brk (oldbrk + increment) < 0)
    return (void *) -1;

  return oldbrk;

Here is the call graph for this function:

Variable Documentation

void* __curbrk

Definition at line 23 of file brk.c.

Definition at line 25 of file init-first.c.