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 function, signatures and/or behavior:

    Think of the tools in a tool-box: there is a hammer, pliers, a saw, a screwdriver, a rule, a glue-pot, nails and screws.—The function of words are as diverse as the functions of these objects.
    Ludwig Wittgenstein (1889–1951)

    So many signatures for such a small heart.
    Mother Teresa (b. 1910)

    The purpose of polite behavior is never virtuous. Deceit, surrender, and concealment: these are not virtues. The goal of the mannerly is comfort, per se.
    June Jordan (b. 1939)