plan9fox/sys
cinap_lenrek 1d3644a168 cc, ?l: fix gethunk() to actually grow allocation
the compilers and linkers use ther own memory allocator.
free memory is between hunk and hunk+nhunk. allocation
works by checking if nhunk is bigger or equal to the
amount needed, and if not, repeatedly call gethunk()
until there is. after that, the allocated amount is added
from hunk and subtracted from nhunk by the user.

the problem was when the needed amount was bigger than
the default NHUNK size gethunk() allocates per call.
gethunk() would not actually grow nhunk, but instead
just set hunk and nhunk variables to the last allocated
block. this resulted in a infinite loop of calls to
gethunk() until sbrk() would hit the maximum size for
the BSS segment.

this change makes gethunk() actually grow the hunk space,
increasing nhunk, and only updating hunk when nhunk was
previously zero. we assume that mysbrk() retuns increasing
addresses and that the space between the previous hunk+nhunk
and the new block base returned by mysbrk() is usable.
2020-04-10 23:11:25 +02:00
..
doc /sys/doc: fix mkfile to and remove files that now can be regenerated 2017-05-09 16:23:48 +02:00
games/lib add games/linden and games/turtle 2019-11-03 13:49:23 +00:00
include lib9p: fix re-use of root Qid when using createfile(); remove unused dirqidgen 2020-03-29 17:39:30 +00:00
lib update colemak kbmap, simpler version with scroll working (thanks jeremy) 2020-03-21 01:50:11 +01:00
man notify(2): fix typo 2020-04-07 12:14:12 +09:30
src cc, ?l: fix gethunk() to actually grow allocation 2020-04-10 23:11:25 +02:00