📄 brk.2
字号:
.\" Copyright (c) 1980 Regents of the University of California..\" All rights reserved. The Berkeley software License Agreement.\" specifies the terms and conditions for redistribution..\".\" @(#)brk.2 6.3 (Berkeley) 5/22/86.\".TH BRK 2 "May 22, 1986".UC 4.SH NAMEbrk, sbrk \- change data segment size.SH SYNOPSIS.nf#include <unistd.h>.PP.ft Bchar *brk(char *\fIaddr\fP).PP.ft Bchar *sbrk(int \fIincr\fP).fi.SH DESCRIPTION.B Brksets the system's idea of the lowest data segment location not used by the program (called the break)to.IR addr .Locations greater than.I addrand below the stack pointerare not in the address space and will thuscause a memory violation if accessed..PPIn the alternate function.BR sbrk ,.I incrmore bytes are added to theprogram's data space and a pointer to thestart of the new area is returned..PPWhen a program begins execution via.B execvethe break is set at thehighest location defined by the programand data storage areas.Ordinarily, therefore, only programs with growingdata areas need to use.BR sbrk ..SH "RETURN VALUEThe address of the new break is returned if.B brksucceeds;.B \-1if the program requests morememory than the system limit..B Sbrkreturns.B \-1if the break could not be set..SH ERRORS.B Sbrkwill fail and no additional memory will be allocated ifone of the following are true:.TP 15[ENOMEM]The maximum possible size of a data segment (as set by.BR chmem (1))was exceeded..TP 15[ENOMEM]Insufficient virtual memory space existedto support the expansion. (Minix-vmd).SH "SEE ALSO".BR chmem (1),.BR execve (2),.BR malloc (3),.BR end (3)..SH NOTESMinix-vmd rounds a small data segment limit up to 3 megabytes..SH BUGSSetting the break may fail due to a temporary lack ofvirtual memory under Minix-vmd. It is not possible to distinguish thisfrom a failure caused by exceeding the maximum size ofthe data segment.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -