Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

execve(2)

getrlimit(2)

malloc(3)

end(3)

vm_ctl(2)

BRK(3P)  —  UNIX Programmer’s Manual

NAME

brk, sbrk − change private data segment size

SYNOPSIS

C syntax:

#include <parallel/parallel.h>
caddr_t brk(addr)
caddr_t addr;

caddr_t sbrk(incr)
int incr;

Pascal syntax

none

FORTRAN syntax

none

DESCRIPTION

These routines are identical to the standard brk and sbrk (see brk(2)) routines except that these routines verify that the private data segment does not overlap the shared data segment which follows it. If the brk or sbrk call will cause the segments to overlap, the routine issues an error. 

ERRORS

If an error occurs, the return value is -1 and the variable errno contains the error code.  Brk and sbrk can return the following error codes:

[ENOMEM] The requested private data segment will overlap the shared data segment. 

[ENOMEM] The routine cannot allocate file system space to expand the file which has been memory mapped to the shared data segment (see mmap(2)). The routine tries to allocate file system space from directories in the following order: 1. the directory indicated by the $TMPPATH environmental variable
2. the current directory
3. the user’s home directory
4. the directory /usr/tmp
5. the directory /tmp

[ENOMEM] The limit, as set by setrlimit, was exceeded.

SEE ALSO

execve(2), getrlimit(2), malloc(3), end(3), vm_ctl(2), Guide to Parallel Programming

NOTES

The gap between the private data segment and the shared data segment can be adjusted by using the −Z linker option (see ld(1)).

When brk and sbrk increase a program’s address space, they also attempt to increase its allowable resident set size (see vm_ctl(2)). 

DYNIX

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