sbrk(2)
_________________________________________________________________
sbrk System Call
Change data segment space allocation.
_________________________________________________________________
SYNTAX
char * sbrk (increment)
int increment;
PARAMETERS
increment The signed increment by which to change the data
area size.
DESCRIPTION
Sbrk dynamically changes the amount of space allocated for the
calling process's data segment; see exec. The change is made by
adding <increment> to the process's current 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 <increment> is positive, space is
allocated. 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 <increment> is negative, space is deallocated
from the data segment. The contents of the addresses from
<increment> 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 call. An implementation
(machine architecture) dependent minimum value exists. This is
the size of 1 page in the MV architecture.
Sbrk will fail without making any change in the allocated space
if an error occurs.
ACCESS CONTROL
No access check is made.
RETURN VALUE
A positive value
The sbrk operation was successful; the value
DG/UX 4.00 Page 1
Licensed material--property of copyright holder(s)
sbrk(2)
returned is the break value before the call was
made.
-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).
ENOMEM The change would make the break value greater than
or equal to the start address of an attached
shared memory segment (see shmat).
EFAULT The change would make the break value less than
the system-imposed minimum.
SEE ALSO
The related system calls: exec, shmop, ulimit.
DG/UX 4.00 Page 2
Licensed material--property of copyright holder(s)