libc - Use sbrk() system call, remove brk() (2)
commitdc676eaefa61b0f47bbea1c53eab86fd5ccd78c6
authorMatthew Dillon <dillon@apollo.backplane.com>
Tue, 19 Feb 2019 17:34:28 +0000 (19 09:34 -0800)
committerMatthew Dillon <dillon@apollo.backplane.com>
Tue, 19 Feb 2019 17:37:17 +0000 (19 09:37 -0800)
tree9e33597047c1675fde8f96386f002d7f7bcb1325
parent15ae7f05144a0f3b7961f1b9e5095d988dbb7e78
libc - Use sbrk() system call, remove brk() (2)

* Change the initial TLS allocation to use mmap() instead of sbrk()
  in order to maintain compatibility with older kernels.

* Using sbrk() will work with a fully updated system, but will not
  work with an old kernel because it returns an error and sets errno,
  but setting errno requires the TLS to already be installed.  So
  even though we have back-off code in libc, it seg-faults before
  it gets to it.

* Only affects a few programs in base such as 'chflags' so not a
  disaster.  But still, the intent was to maintain compatibility
  with older kernels.
lib/libc/gen/tls.c