git: libc - Use sbrk() system call, remove brk()

Matthew Dillon dillon at
Sun Feb 17 17:48:26 PST 2019

commit 8618d94a0e2ff8303ad93c123a3fa598c26a116e
Author: Matthew Dillon <dillon at>
Date:   Sat Feb 16 11:40:04 2019 -0800

    libc - Use sbrk() system call, remove brk()
    * Attempt to use the kernel sbrk() system call.  If it fails
      with EOPNOTSUPP, back-off to the older libc sbrk() emulation
      code which uses still-present but obsolete break() system call.
    * Changes support both old and new kernels.  Older kernels do not
      implement the sbrk() system call, causing the call to return
      -1/EOPNOTSUPP.  Note that older kernels did not generate an
      ENOSYS/signal for sbrk().
    * sbrk() cannot support negative increments.  Allow only 0 and positive
    * Fix MPSAFE issues (requires new kernels) while we are here.
    * Remove brk() support entirely.  This was also emulated in older
      kernels using break().
    * These changes are necessary in order to support mmap() hinting above
      RLIMIT_DATA's current value.  Older kernels only support hinting above
      the system maximum value (above the 32GB mark).  Several languages in
      dports really want to mmap() addresses below 4GB.

Summary of changes:
 lib/libc/gen/                     |  2 +-
 lib/libc/{stdio/sreadahead.c => gen/ovsbrk.c} | 48 ++++++++-------
 lib/libc/x86_64/sys/              |  6 +-
 lib/libc/x86_64/sys/brk.S                     | 86 ---------------------------
 lib/libc/x86_64/sys/{sbrk.S => fake_sbrk.S}   |  4 +-
 5 files changed, 33 insertions(+), 113 deletions(-)
 copy lib/libc/{stdio/sreadahead.c => gen/ovsbrk.c} (67%)
 delete mode 100644 lib/libc/x86_64/sys/brk.S
 rename lib/libc/x86_64/sys/{sbrk.S => fake_sbrk.S} (98%)

DragonFly BSD source repository

More information about the Commits mailing list