mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-17 22:50:51 +00:00
Use sysconf() by default instead of getpagesize(). getpagesize() still used if
sysconf() not present. Since getpagesize is deprecated, it's only used as a fallback.
This commit is contained in:
parent
9b63402f12
commit
810dfb29e6
1 changed files with 10 additions and 1 deletions
|
@ -201,6 +201,7 @@ Sys_PathType (const char *path)
|
|||
free (comp);
|
||||
return type;
|
||||
}
|
||||
|
||||
/*
|
||||
Sys_SetPrintf
|
||||
|
||||
|
@ -339,12 +340,20 @@ Sys_MakeCodeWriteable (unsigned long startaddr, unsigned long length)
|
|||
# ifdef HAVE_MPROTECT
|
||||
int r;
|
||||
unsigned long endaddr = startaddr + length;
|
||||
# ifdef HAVE_UNISTD_H
|
||||
long psize = sysconf (_SC_PAGESIZE);
|
||||
|
||||
# ifdef HAVE_GETPAGESIZE
|
||||
startaddr &= ~(psize - 1);
|
||||
endaddr = (endaddr + psize - 1) & ~(psize -1);
|
||||
# else
|
||||
# ifdef HAVE_GETPAGESIZE
|
||||
int psize = getpagesize ();
|
||||
|
||||
startaddr &= ~(psize - 1);
|
||||
endaddr = (endaddr + psize - 1) & ~(psize - 1);
|
||||
# else
|
||||
# error Unknown page size
|
||||
# endif
|
||||
# endif
|
||||
|
||||
r = mprotect ((char *) startaddr, endaddr - startaddr,
|
||||
|
|
Loading…
Reference in a new issue