Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 14 Nov 2010 18:24:12 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r215309 - in head/sys: amd64/amd64 i386/i386 sys vm
Message-ID:  <201011141824.oAEIOCtN089920@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Sun Nov 14 18:24:12 2010
New Revision: 215309
URL: http://svn.freebsd.org/changeset/base/215309

Log:
  Use symbolic names instead of hardcoding values for magic p_osrel constants.
  
  MFC after:   1 week

Modified:
  head/sys/amd64/amd64/trap.c
  head/sys/i386/i386/trap.c
  head/sys/sys/param.h
  head/sys/vm/vm_mmap.c

Modified: head/sys/amd64/amd64/trap.c
==============================================================================
--- head/sys/amd64/amd64/trap.c	Sun Nov 14 18:05:03 2010	(r215308)
+++ head/sys/amd64/amd64/trap.c	Sun Nov 14 18:24:12 2010	(r215309)
@@ -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 {

Modified: head/sys/i386/i386/trap.c
==============================================================================
--- head/sys/i386/i386/trap.c	Sun Nov 14 18:05:03 2010	(r215308)
+++ head/sys/i386/i386/trap.c	Sun Nov 14 18:24:12 2010	(r215309)
@@ -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 {

Modified: head/sys/sys/param.h
==============================================================================
--- head/sys/sys/param.h	Sun Nov 14 18:05:03 2010	(r215308)
+++ head/sys/sys/param.h	Sun Nov 14 18:24:12 2010	(r215309)
@@ -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

Modified: head/sys/vm/vm_mmap.c
==============================================================================
--- head/sys/vm/vm_mmap.c	Sun Nov 14 18:05:03 2010	(r215308)
+++ head/sys/vm/vm_mmap.c	Sun Nov 14 18:24:12 2010	(r215309)
@@ -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);
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201011141824.oAEIOCtN089920>