Manual for int brk(void *end_data_segment); says: "brk() sets the end of the data segment to the value specified by end_data_segment"
On Success it returns 0 else -1.
But how to I get the init value of my break (like sbrk(0))?
best regards,
Manual for int brk(void *end_data_segment); says: "brk() sets the end of the data segment to the value specified by end_data_segment"
On Success it returns 0 else -1.
But how to I get the init value of my break (like sbrk(0))?
best regards,
Copyright © 2021 Jogjafile Inc.
                        
As the manual states:
So there is no way to get the initial value through a call to
brk. Instead, as you noticed, you should usesbrk(0):There is no reason to expect
brkto also provide this ability when it's already provided bysbrk(0). With that said, it may be more prudent to use usemmapin general for your memory allocation needs, due to limitations on certain operating systems forbrk/sbrk.