Subject: Re: sys_sbrk()? sys_sstk()?
To: None <tech-kern@netbsd.org>
From: Thor Lancelot Simon <tls@rek.tjls.com>
List: tech-kern
Date: 10/14/2001 20:23:37
On Sun, Oct 14, 2001 at 07:32:18PM -0400, Perry E. Metzger wrote:
> 
> eeh@netbsd.org writes:
> > We seem to have sys_sbrk() and sys_sstk() that don't seem to do
> > anything.  Why are we keeping them?
> 
> Ah, a fascinating topic! Have a look some time at the several PRs I
> filed on the topic of the entire brk system. There are a number of
> oddities there, none of which have a solid explanation.
> 
> All that said, someday we should make brk/sbrk merely a front end for
> mmap.

For the record, I think I originally set Perry on this wild goose
chase, after Seriously Confusing myself over the same issue.  The
relevant PRs (that are still open) are:

7933	brk/sbrk are strangely implemented
7934	misc. problems remaining in brk/sbrk main page
7935	mmap(2) API incompletely documented
7937	malloc/sbrk interaction poorly documented

How, exactly, would we replace sbrk with mmap()?  By keeping a s3kr1t
global that's the highest address that has ever been returned and
mapping there with MAP_FIXED?  There are myriad other icky issues.

Thor