.\" Copyright (c) 1980, 1991 Regents of the University of California.
.\" %sccs.include.redist.man%
.\" @(#)brk.2 6.5 (Berkeley) %G%
.Nd change data segment size
.Fd #include <sys/types.h>
.Fn *brk "const char *addr"
The brk and sbrk functions are historical curiosities
left over from earlier days before the advent of virtual memory management.
sets the break or lowest address
of a process's data segment (unilitialized data) to
Data addressing is restricted between
and the lowest stack pointer to the stack segment.
is not evenly divisible by the system page size, it is
increased to the next page boundary.
.\" to the process's data space
.\" and returns an address pointer.
The current value of the program break is reliably returned by
system call may be used to determine
the maximum permissible size of the
it will not be possible to set the break
value returned from a call to
.Dq qetext + rlp\(->rlim_max.
returns 0 if successful; -1 if the process requests more memory than
than allowed by the system limit.
function returns 0 if successful, otherwise the error
.\" returns -1 if the break could not be set.
.\" will fail and no additional memory will be allocated if
.\" one of the following are true:
.\" .Bl -tag -width [ENOMEM]
.\" The maximum possible size of a data segment (compiled into the
.\" system) was exceeded.
.\" Insufficient space existed in the swap area
.\" to support the expansion.
Setting the break may fail due to a temporary lack of
swap space. It is not possible to distinguish this
from a failure caused by exceeding the maximum size of
the data segment without consulting
function call appeared in Version 7 AT&T UNIX.