brk sbrk - change data segment size
and sbrk ();
functions are used to change the amount of memory allocated in a process's data segment. They do this by moving the location of the ``break'' The break is the first address after the end of the process's uninitialized data segment (also known as the ``BSS )''
function sets the break to Fa addr .
function raises the break by Fa incr bytes, thus allocating at least Fa incr bytes of new memory in the data segment. If Fa incr is negative, the break is lowered by Fa incr bytes.
The current value of the program break may be determined by calling
sbrk (0 .);
See also end(3).
system call may be used to determine
the maximum permissible size of the
It will not be possible to set the break
``etext + rlim.rlim_max
value is returned from a call to
getrlimit (RLIMIT_DATA &rlim .);
(See end(3) for the definition of etext )
function returns the prior break value if successful; otherwise the value Po Vt void * Pc Ns -1 is returned and the global variable errno is set to indicate the error.
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 getrlimit(2).
Закладки на сайте
Проследить за страницей
Created 1996-2020 by Maxim Chirkov
Добавить, Поддержать, Вебмастеру