Sbrk - Function Signatures and Behavior

Function Signatures and Behavior

#include int brk(void *end_data_segment); void *sbrk(intptr_t increment);

The brk subroutine sets the program break value to the value of the end_data_segment parameter and changes the amount of available space accordingly.

The sbrk subroutine adds to the program break value the number of bytes contained in the increment parameter and changes the amount of available space accordingly. The increment parameter can be a negative number, in which case the amount of available space is decreased.

Upon successful completion, the brk subroutine returns a value of 0, and the sbrk subroutine returns the prior value of the program break (if the available space is increased, then the return value points to the start of the new area). If either subroutine is unsuccessful, a value of -1 is returned and the errno global variable is set to indicate the error.

The current Mac OS X implementation of sbrk is an emulation, and has a maximum allocation of 4 Megabytes. When this limit is reached, -1 is returned and the errno is not set.

Read more about this topic:  Sbrk

Famous quotes containing the words behavior, function and/or signatures:

    Excessive attention, even if it’s negative, is such a powerful “reward” to a child that it actually reinforces the undesirable behavior. You need to learn restraint, to respond to far fewer situations, to ask yourself questions like, “Is this really important?” “Could I let this behavior go?” “What would happen if I just wait?” “Could I lose by doing nothing?”
    Stanley Turecki (20th century)

    The uses of travel are occasional, and short; but the best fruit it finds, when it finds it, is conversation; and this is a main function of life.
    Ralph Waldo Emerson (1803–1882)

    I am not a very sentimental man; and the best sentiment I can think of is, that if you collect the signatures of all persons who are no less distinguished than I, you will have a very undistinguishing mass of names.
    Abraham Lincoln (1809–1865)