hpux man page for sbrk

Query: sbrk

OS: hpux

Section: 2

Format: Original Unix Latex Style Formatted with HTML and a Horizontal Scroll Bar

brk(2)								System Calls Manual							    brk(2)

NAME
brk, sbrk - change data segment space allocation
SYNOPSIS
DESCRIPTION
and are used to change dynamically the amount of space allocated for the calling process's data segment; see 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 loca- tion 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. sets the break value to endds and changes the allocated space accordingly. adds incr bytes to the break value and changes the allocated space accordingly. incr can be negative, in which case the amount of allo- cated space is decreased.
ERRORS
and fail without making any change in the allocated space if one or more of the following are true: [ENOMEM] Such a change would result in more space being allocated than is allowed by a system-imposed maximum (see ulimit(2)). [ENOMEM] Such a change would cause a conflict between addresses in the data segment and any attached shared memory segment (see shmop(2)). [ENOMEM] Such a change would be impossible as there is insufficient swap space available. [EINVAL] Such a change will result in crossing the boundary to uninitialized data in the calling process's data segment.
WARNINGS
The pointer returned by is not necessarily word-aligned. Loading or storing words through this pointer could cause word alignment prob- lems. Be very careful when using either or in conjunction with calls to the malloc(3C) library routines. There is only one program data segment from which all three of these routines allocate and deallocate program data memory.
RETURN VALUE
Upon successful completion, returns a value of 0. Otherwise, a value of -1 is returned and is set to indicate the error. Upon successful completion, returns the old break value. Otherwise, is returned and is set to indicate the error. The symbol is defined in the header No successful return from will return the value
AUTHOR
and were developed by AT&T and HP.
SEE ALSO
exec(2), shmop(2), ulimit(2), end(3C), malloc(3C).
STANDARDS CONFORMANCE
brk(2)
Related Man Pages
brk(2) - mojave
sbrk(2) - opensolaris
brk(2) - opensolaris
sbrk(2) - netbsd
brk(2) - ultrix
Similar Topics in the Unix Linux Community
Removing Space at the end of file
replace space by _
data segment on AIX
How can I know where the segment of memory is all Zero?
Copy out of File