Search code examples
linuxkernelbrk

Kernel Source -- In which file is brk() defined


I would like to know in kernel source version >= 2.6 where brk is defined. That is which c file contains its definition? grep is not revealing much. Also sbrk is implemented in glibc correct?


Solution

  • It's in mmap.c. Look for:

    SYSCALL_DEFINE1(brk, unsigned long, brk)
    

    The manual page says:

    On Linux, sbrk() is implemented as a library function that uses the brk() system call, and does some internal bookkeeping so that it can return the old break value.