Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ brk(2) — DG/UX 5.4R3.00

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

exec(2)

getrlimit(2)

memcntl(2)

ulimit(2)



brk(2)                         DG/UX 5.4R3.00                         brk(2)


NAME
       brk - change data segment space allocation

SYNOPSIS
       #include <unistd.h>

       int brk(void *endds);

   where:
       endds  The address of the first byte beyond the new end of the data
              area

DESCRIPTION
       The brk() system call dynamically changes the amount of space
       allocated for the calling process's data segment; see exec(2).  The
       change is made by resetting the process's break value and allocating
       or deallocating the appropriate amount of space.  The break value is
       the address of the first byte beyond the end of the data segment.
       The amount of allocated space increases as the break value increases.

       If endds is greater than the current break value, any newly allocated
       pages will be initialized with zero bytes; i.e., if these bytes are
       read before they are written, the contents will be zero.  If endds is
       less than the current break value, space is deallocated from the data
       segment.  The contents of addresses from endds to the prior break
       value become undefined.

       There is a maximum possible break value for a process; this value may
       be obtained by calling the ulimit(2) function.  There is also a
       program-dependent minimum break value for a process; this minimum is
       greater than or equal to the address of the first byte in the data
       segment, and less than or equal to the program's initial break value.

       The brk() system call will fail without making any change in the
       allocated space if an error occurs.

ACCESS CONTROL
       No access check is made.

RETURN VALUE
       Upon successful completion, brk() returns a value of 0.  Otherwise,
       it returns the value -1, and sets errno to indicate an error.

DIAGNOSTICS
       Under the following conditions, brk() fails and sets errno to:

       ENOMEM         if the change would allocate more space than is
                      allowed by a system-imposed maximum (see ulimit(2)).

       ENOMEM         if the change would allocate more space than is
                      allowed by the current data resource limit (see
                      getrlimit(2)).

       ENOMEM         if the change would make the break value greater than



Licensed material--property of copyright holder(s)                         1




brk(2)                         DG/UX 5.4R3.00                         brk(2)


                      or equal to the start address of an attached shared
                      memory segment (see shmat(2)).

       EFAULT         if the change would make the break value less than the
                      system-imposed minimum.

       EAGAIN         if the change would allocate more space than the
                      available physical memory and swap space.

       EAGAIN         if the MCLFUTURE memory locking option is in effect
                      for the calling process (see memcntl(2)), and the
                      system-imposed limit on space locked into physical
                      memory would be exceeded.

SEE ALSO
       exec(2), getrlimit(2), memcntl(2), ulimit(2).









































Licensed material--property of copyright holder(s)                         2


Typewritten Software • bear@typewritten.org • Edmonds, WA 98026