Mail Archives: djgpp/1997/11/09/05:37:48
On Thu, 6 Nov 1997, Christopher Croughton wrote:
> How standard is the sbrk(2) function? It's on every Unix I've seen,
> and appears to be in DJGPP as well, but it's not as far as I can tell
> ANSI.
It's neither ANSI nor POSIX. (You can tell that by looking at the
DJGPP header that declares it: the prototype is AFTER the
#ifndef _POSIX_SOURCE directive.)
But I have yet to see a C library that doesn't have `sbrk'. I think
you can pretty much count on it.
> Does it actually work under DJGPP as it does in Unix?
Yes, but note these two gotchas:
1) It doesn't return memory to the DPMI host when called with a
negative argument;
2) It doesn't zero out the memory it gets from the DPMI host
(unless you use the _CRT0_FLAG_FILL_SBRK_MEMORY flag).
> How about the mmap(2) function? That sounds really useful if it works...
AFAIK, `mmap' isn't possible with DPMI 0.9, because it doesn't support
page-level protection. Only DPMI 1.0 can do that.
- Raw text -