File:  [Power 6/32 Unix Tahoe 4.2BSD] / cci / usr / src / man / man2 / brk.2
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Sun Jul 28 12:24:19 2019 UTC (7 years ago) by root
Branches: bsd, MAIN
CVS tags: v12b, v121, HEAD
Power 6/32 Unix version 1.2b

.TH BRK 2
.SH NAME
brk, sbrk \- change data segment space allocation
.SH SYNOPSIS
.B int brk (endds)
.br
.B char *endds;
.PP
.B  char *sbrk (incr)
.br
.B int incr;
.SH DESCRIPTION
.I Brk\^
and
.I sbrk\^
are used to change dynamically the amount of space allocated
for the calling process's data segment; see
.IR exec (2).
The change is made by resetting the process's break value and allocating
the appropriate amount of space.
The break value
is the address of the first location beyond the end of the data segment.
The amount of allocated space increases as the break value increases.
The newly allocated space is set to zero.
.PP
.I Brk\^
sets the break value to
.I endds\^
and changes the allocated space accordingly.
.PP
.I Sbrk\^
adds 
.I incr\^
bytes to the break value and changes the allocated space accordingly.
.I Incr\^
can be negative, in which case the amount of allocated space is decreased.
.PP
.I Brk\^
and
.I sbrk\^
will fail without making any change in the allocated space if one or more of
the following are true:
.IP
Such a change would result in more space being allocated
than is allowed by a system-imposed maximum (see
.IR ulimit (2)).
.SM
\%[ENOMEM]
.IP
Such a change would result in the break value being greater than or equal
to the start address of any attached shared memory segment (see
.IR shmop (2)).
.SH RETURN VALUE
Upon successful completion,
.I brk\^
returns a value of 0 and
.I sbrk\^
returns the old break value.
Otherwise, a value of \-1 is returned and
.I errno\^
is set to indicate the error.
.SH SEE ALSO
exec(2), shmop(2), ulimit(2).
.\"	@(#)brk.2	6.2 of 9/6/83

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.