brk(2) DG/UX 4.30 brk(2)
NAME
brk - Change data segment space allocation
SYNOPSIS
int brk (endds)
char * endds;
PARAMETERS
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, the newly
allocated space is set to zero; i.e., if these addresses 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 current break value become
undefined.
There is a maximum possible break value for a process; this
value may be determined with the ulimit(2) call. An
implementation or machine architecture-dependent minimum
value exists; this address is one byte greater than the
ending address of a data area which contains one page, as
defined by the implementation.
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
0 The brk operation was successful.
-1 An error occurred. Errno is set to indicate
the error.
EXCEPTIONS
Errno may be set to one of the following error codes:
ENOMEM The change would allocate more space than is
allowed by a system-imposed maximum (see
ulimit(2)).
Licensed material--property of copyright holder(s) Page 1
brk(2) DG/UX 4.30 brk(2)
ENOMEM The change would allocate more space than is
allowed by the current data resource limit
(see getrlimit(2)).
ENOMEM The change would make the break value greater
than or equal to the start address of an
attached shared memory segment (see
shmat(2)).
EFAULT The change would make the break value less
than the system-imposed minimum.
EFAULT The new break value is not a valid user
address.
EAGAIN The change would allocate more space than the
available physical memory and swap space.
EAGAIN The system-imposed limit on space locked into
physical memory would be exceeded; the
MCL_FUTURE memory locking option is in effect
for the calling process (see memcntl(2)).
SEE ALSO
exec(2), ulimit(2), getrlimit(2), memcntl(2).
Licensed material--property of copyright holder(s) Page 2