From 94bce4535d4a57162c57fdcda2f13b098d4e712e Mon Sep 17 00:00:00 2001 From: Konstantin Belousov Date: Sun, 14 Nov 2010 18:24:12 +0000 Subject: [PATCH] Use symbolic names instead of hardcoding values for magic p_osrel constants. MFC after: 1 week --- sys/amd64/amd64/trap.c | 6 +++--- sys/i386/i386/trap.c | 6 +++--- sys/sys/param.h | 5 +++++ sys/vm/vm_mmap.c | 2 +- 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/sys/amd64/amd64/trap.c b/sys/amd64/amd64/trap.c index 786d8ecf2a91..a1a3ebcf0ffb 100644 --- a/sys/amd64/amd64/trap.c +++ b/sys/amd64/amd64/trap.c @@ -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 { diff --git a/sys/i386/i386/trap.c b/sys/i386/i386/trap.c index dc105594b35c..b6f843aef076 100644 --- a/sys/i386/i386/trap.c +++ b/sys/i386/i386/trap.c @@ -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 { diff --git a/sys/sys/param.h b/sys/sys/param.h index acd1f519e383..3e4cdf640659 100644 --- a/sys/sys/param.h +++ b/sys/sys/param.h @@ -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 #endif diff --git a/sys/vm/vm_mmap.c b/sys/vm/vm_mmap.c index 80a2d0acf7a7..5c6f17324206 100644 --- a/sys/vm/vm_mmap.c +++ b/sys/vm/vm_mmap.c @@ -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);