tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: SYS_sbrk removal proposal



Den 2017-12-19 kl. 13:11, skrev Kamil Rytarowski:
On 19.12.2017 12:51, Anders Magnusson wrote:
Den 2017-12-19 kl. 10:53, skrev Kamil Rytarowski:
I propose to remove the sbrk(2) syscall "change data segment size".

It has never been implemented by the NetBSD kernel since the inception
of the project and it is emulated in libc with SYS_brk (break, obreak).

This interface is a remnant from the old UNIX and has been marked
obsolete since the the advent of mmap(2) memory management.

I don't intend to remove the libc's sbrk(2) emulation.

Sounds good :-)

Just a note here:

about 15-20 years ago I did a test by removing the brk(2) syscall and
replacing its use
in malloc() by mmap(), and also add a libc wrapper for brk() that
mmap'ed MAXDSIZ/2 if ever called (as a fallback).

This approach worked very well for everything tested _except_ emacs.
There were something in emacs dump logic that seemed to expect that
brk() were continuing just above bss, or something.
I didn't go deeper into this back then.

Anyway, it might be an idea to revisit this.  IMHO it would be really
nice if brk(2) could be declared obsolete :-)

-- Ragge
Obsoleting SYS_brk (break/obreak) would be a candidate for COMPAT_80, as
there are definitely users in very old code. Unless we want to relax our
compat policy.

Removing it from libc and replacing with a wrapper with mmap(2) sounds
good. It's a waste of time nowadays to port new hardware to this old
syscall, as the code is in assembly.

Some digging and I found the original proposal.  Mostly of historical interest now, but it was lot of discussion :-)

https://mail-index.netbsd.org/tech-kern/2002/02/25/0017.html

-- R



Home | Main Index | Thread Index | Old Index