|
|
1.1 ! root 1: .TH BRK 2 ! 2: .SH NAME ! 3: brk, sbrk \- change data segment space allocation ! 4: .SH SYNOPSIS ! 5: .B int brk (endds) ! 6: .br ! 7: .B char *endds; ! 8: .PP ! 9: .B char *sbrk (incr) ! 10: .br ! 11: .B int incr; ! 12: .SH DESCRIPTION ! 13: .I Brk\^ ! 14: and ! 15: .I sbrk\^ ! 16: are used to change dynamically the amount of space allocated ! 17: for the calling process's data segment; see ! 18: .IR exec (2). ! 19: The change is made by resetting the process's break value and allocating ! 20: the appropriate amount of space. ! 21: The break value ! 22: is the address of the first location beyond the end of the data segment. ! 23: The amount of allocated space increases as the break value increases. ! 24: The newly allocated space is set to zero. ! 25: .PP ! 26: .I Brk\^ ! 27: sets the break value to ! 28: .I endds\^ ! 29: and changes the allocated space accordingly. ! 30: .PP ! 31: .I Sbrk\^ ! 32: adds ! 33: .I incr\^ ! 34: bytes to the break value and changes the allocated space accordingly. ! 35: .I Incr\^ ! 36: can be negative, in which case the amount of allocated space is decreased. ! 37: .PP ! 38: .I Brk\^ ! 39: and ! 40: .I sbrk\^ ! 41: will fail without making any change in the allocated space if one or more of ! 42: the following are true: ! 43: .IP ! 44: Such a change would result in more space being allocated ! 45: than is allowed by a system-imposed maximum (see ! 46: .IR ulimit (2)). ! 47: .SM ! 48: \%[ENOMEM] ! 49: .IP ! 50: Such a change would result in the break value being greater than or equal ! 51: to the start address of any attached shared memory segment (see ! 52: .IR shmop (2)). ! 53: .SH RETURN VALUE ! 54: Upon successful completion, ! 55: .I brk\^ ! 56: returns a value of 0 and ! 57: .I sbrk\^ ! 58: returns the old break value. ! 59: Otherwise, a value of \-1 is returned and ! 60: .I errno\^ ! 61: is set to indicate the error. ! 62: .SH SEE ALSO ! 63: exec(2), shmop(2), ulimit(2). ! 64: .\" @(#)brk.2 6.2 of 9/6/83
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.