Unix/Linux Go Back    

Plan 9 - man page for brk (plan9 section 2)

Linux & Unix Commands - Search Man Pages
Man Page or Keyword Search:   man
Select Man Page Set:       apropos Keyword Search (sections above)

BRK(2)											   BRK(2)

       brk, sbrk - change memory allocation

       #include <u.h>
       #include <libc.h>

       int   brk(void *addr)

       void* sbrk(ulong incr)

       Brk  sets the system's idea of the lowest bss location not used by the program (called the
       break) to addr rounded up to the next multiple of 8 bytes.  Locations not less  than  addr
       and below the stack pointer may cause a memory violation if accessed.

       In  the alternate function sbrk, incr more bytes are added to the program's data space and
       a pointer to the start of the new area is returned.  Rounding occurs as with brk.

       When a program begins execution via exec the break is set at the highest location  defined
       by  the program and data storage areas.	Ordinarily, therefore, only programs with growing
       data areas need to use brk.  A call to sbrk  with  a  zero  argument  returns  the  lowest
       address in the dynamic segment.


       intro(2), malloc(2), segattach(2), segbrk(2)

       These functions set errstr.

       The error return from sbrk is (void*)-1.

Unix & Linux Commands & Man Pages : ©2000 - 2018 Unix and Linux Forums

All times are GMT -4. The time now is 03:48 PM.