https://bugs.kde.org/show_bug.cgi?id=487862

--- Comment #3 from Paul Floyd <pjfl...@wanadoo.fr> ---
(In reply to John Reiser from comment #2)
> (In reply to Paul Floyd from comment #1)
> > brk() is fairly old, removed from posix accordingly to the Linux manpage.
> > Increasingly I see it getting removed from platforms.
> 
> In this case "old" means good, well-documented, well-debugged, reliable.
> Please name explicitly some platforms which are removing brk(), and their
> typical usage environments.

The fist thing in the FreeBSD man page, in BOLD letters is

DESCRIPTION
     The brk() and sbrk() functions are legacy interfaces from before the
     advent of modern virtual memory management.  They are deprecated and not
     present on the arm64 or riscv architectures.  The mmap(2) interface
     should be used to allocate pages instead.

FreeBSD has (or had) two system calls, brk and sbrk. sbrk was recently removed
from FreeBSD 15 (probably because it has just returned EOPNOTSUPP for as long
as I can remember).

> brk() is multi-thread safe and async-signal safe without requiring

The FreeBSD man page says

     brk() and sbrk() are not thread-safe.

Some other juicy bits from SUSv1

"The behaviour of brk( ) and sbrk( ) is unspecified if an application also uses
any other memory
functions (such as malloc ( ), mmap( ), free( )). Other functions may use these
other memory
functions silently."

and

"It is unspecified whether the pointer returned by sbrk( ) is aligned suitably
for any purpose."

So, it's not portable, not thread-safe, not safe to use with malloc and
provides no alignment guarantees. "removed in POSIX.1-2001" twenty three years
ago isn't what I'd call well documented.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to