mirror of
https://git.code.sf.net/p/quake/quake2forge
synced 2024-12-12 13:42:21 +00:00
Fix compiling linux target for use on non-linux systems. Doesn't fix my puzzlement on why people do these things. ;)
This commit is contained in:
parent
8d78a44c1b
commit
f564ce6a2c
1 changed files with 27 additions and 0 deletions
|
@ -65,6 +65,7 @@ void *Hunk_Alloc (int size)
|
|||
return buf;
|
||||
}
|
||||
|
||||
#ifdef mremap
|
||||
int Hunk_End (void)
|
||||
{
|
||||
byte *n;
|
||||
|
@ -76,6 +77,32 @@ int Hunk_End (void)
|
|||
|
||||
return curhunksize;
|
||||
}
|
||||
#else
|
||||
int Hunk_End (void)
|
||||
{
|
||||
long pgsz, newsz, modsz;
|
||||
|
||||
pgsz = sysconf(_SC_PAGESIZE);
|
||||
if (pgsz == -1)
|
||||
Sys_Error("Hunk_End: Sysconf() failed: %s", strerror(errno));
|
||||
|
||||
newsz = curhunksize + sizeof(int);
|
||||
|
||||
if (newsz > maxhunksize)
|
||||
Sys_Error("Hunk_End Overflow");
|
||||
else if (newsz < maxhunksize) {
|
||||
modsz = newsz % pgsz;
|
||||
if (modsz) newsz += pgsz - modsz;
|
||||
|
||||
if (munmap(membase + newsz, maxhunksize - newsz) == -1)
|
||||
Sys_Error("Hunk_End: munmap() failed: %s", strerror(errno));
|
||||
}
|
||||
|
||||
*((int *)membase) = curhunksize + sizeof(int);
|
||||
|
||||
return curhunksize;
|
||||
}
|
||||
#endif
|
||||
|
||||
void Hunk_Free (void *base)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue