Use symbolic names instead of hardcoding values for magic p_osrel constants.

MFC after:   1 week
This commit is contained in:
kib 2010-11-14 18:24:12 +00:00
parent 217241ab5e
commit 336fd1996d
4 changed files with 12 additions and 7 deletions

View File

@ -415,9 +415,9 @@ trap(struct trapframe *frame)
* This check also covers the images
* without the ABI-tag ELF note.
*/
if (SV_CURPROC_ABI() ==
SV_ABI_FREEBSD &&
p->p_osrel >= 700004) {
if (SV_CURPROC_ABI() == SV_ABI_FREEBSD
&& p->p_osrel >=
__FreeBSD_version_SIGSEGV) {
i = SIGSEGV;
ucode = SEGV_ACCERR;
} else {

View File

@ -461,9 +461,9 @@ trap(struct trapframe *frame)
* This check also covers the images
* without the ABI-tag ELF note.
*/
if (SV_CURPROC_ABI() ==
SV_ABI_FREEBSD &&
p->p_osrel >= 700004) {
if (SV_CURPROC_ABI() == SV_ABI_FREEBSD
&& p->p_osrel >=
__FreeBSD_version_SIGSEGV) {
i = SIGSEGV;
ucode = SEGV_ACCERR;
} else {

View File

@ -60,6 +60,11 @@
#undef __FreeBSD_version
#define __FreeBSD_version 900025 /* Master, propagated to newvers */
#ifdef _KERNEL
#define __FreeBSD_version_SIGSEGV 700004
#define __FreeBSD_version_MAP_ANON 800104
#endif
#ifndef LOCORE
#include <sys/types.h>
#endif

View File

@ -232,7 +232,7 @@ mmap(td, uap)
/* Make sure mapping fits into numeric range, etc. */
if ((uap->len == 0 && !SV_CURPROC_FLAG(SV_AOUT) &&
curproc->p_osrel >= 800104) ||
curproc->p_osrel >= __FreeBSD_version_MAP_ANON) ||
((flags & MAP_ANON) && (uap->fd != -1 || pos != 0)))
return (EINVAL);