Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ brk(2) — A/UX 3.0.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

exec(2)

shmop(2)

ulimit(2)




brk(2) brk(2)
NAME brk, sbrk - change data segment space allocation SYNOPSIS int brk(endds) char *endds; char *sbrk(incr) int incr; DESCRIPTION brk and sbrk are used to change dynamically the amount of space allocated for the calling process's data segment. See exec(2) for information about transforming processes. The process's break value is reset and the appropriate amount of space is allocated. 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. (Note that the break value cannot be set to a value less than its initial value.) brk sets the break value to endds and changes the allocated space accordingly. sbrk adds incr bytes to the break value and changes the allocated space accordingly. incr can be negative, in which case the amount of allocated space is decreased. STATUS MESSAGES AND VALUES Upon successful completion, brk returns a value of 0 and sbrk returns the old break value. Otherwise, a value of -1 is returned and errno is set to indicate the error. The brk and sbrk programs will fail without making any change in the allocated space if any of the following conditions is true: EINVAL The new break value would be less than the original value. ENOMEM Not enough space. Program asks for more space than the system is able to supply. EAGAIN The system has temporarily exhausted its available memory or swap space. January 1992 1



brk(2) brk(2)
Such a change would result in the allocation of more space than is allowed by a system-imposed maximum (see ulimit(2)). Such a change would result in the break value's being greater than or equal to the start address of any attached shared-memory segment (see shmop(2)). SEE ALSO exec(2), shmop(2), ulimit(2) 2 January 1992

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