DragonFlyBSD/src 4b56655include unistd.h, lib/libc/sys brk.2

kernel - Implement sbrk(), change low-address mmap hinting

* Change mmap()'s internal lower address bound from dmax (32GB)
  to RLIMIT_DATA's current value.  This allows the rlimit to be
  e.g. reduced and for hinted mmap()s to then map space below
  the 4GB mark.  The default data rlimit is 32GB.

  This change is needed to support several languages, at least
  lua and probably another one or two, who use mmap hinting
  under the assumption that it can map space below the 4GB
  address mark.  The data limit must be lowered with a limit command
  too, which can be scripted or patched for such programs.

* Implement the sbrk() system call.  This system call was already
  present but just returned EOPNOTSUPP and libc previously had its
  own shim for sbrk() which used the ancient break() system call.
  (Note that the prior implementation did not ENOSYS or signal).

  sbrk() in the kernel is thread-safe for positive increments and
  is also byte-granular (the old libc sbrk() was only page-granular).

  sbrk() in the kernel does not implement negative increments and
  will return EOPNOTSUPP if asked to.  Negative increments were
  historically designed to be able to 'free' memory allocated with
  sbrk(), but it is not possible to implement the case in a modern
  VM system due to the mmap changes above.

  (1) Because the new mmap hinting changes make it possible for
  normal mmap()s to have mapped space prior to the RLIMIT_DATA resource
  limit being increased, causing intermingling of sbrk() and user mmap()d
  regions.  (2) because negative increments are not even remotely
  thread-safe.

* Note the previous commit refactored libc to use the kernel sbrk()
  and fall-back to its previous emulation code on failure, so libc
  supports both new and old kernels.

* Remove the brk() shim from libc.  brk() is not implemented by the
  kernel.  Symbol removed.  Requires testing against ports so we may
  have to add it back in but basically there is no way to implement
  brk() properly with the mmap() hinting fix

* Adjust manual pages.
DeltaFile
+113-4sys/vm/vm_unix.c
+40-10lib/libc/sys/brk.2
+27-11sys/vm/vm_map.c
+21-8sys/libkern/arc4random.c
+8-8sys/kern/kern_fork.c
+0-10sys/vm/vm_mmap.c
+4-4sys/kern/imgact_gzip.c
+4-4sys/kern/imgact_elf.c
+3-3sys/kern/kern_kinfo.c
+3-3sys/kern/kern_clock.c
+3-3sys/vm/vm_map.h
+3-2sys/kern/kern_exec.c
+4-1sys/sys/param.h
+2-2sys/kern/syscalls.master
+2-2sys/sys/ckpt.h
+2-2sys/kern/kern_checkpoint.c
+2-2sys/kern/imgact_aout.c
+1-1include/unistd.h
+1-1sys/kern/init_main.c
+1-0sys/sys/libkern.h
+244-8120 files

UnifiedSplitRaw