Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 14 Nov 2010 23:37:49 +0200
From:      Kostik Belousov <kostikbel@gmail.com>
To:        Anonymous <swell.k@gmail.com>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, freebsd-ports@freebsd.org
Subject:   Re: svn commit: r215309 - in head/sys: amd64/amd64 i386/i386 sys vm
Message-ID:  <20101114213749.GW2392@deviant.kiev.zoral.com.ua>
In-Reply-To: <86wrofob4q.fsf@gmail.com>
References:  <201011141824.oAEIOCtN089920@svn.freebsd.org> <86wrofob4q.fsf@gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--LKH70Ka7gWbFxE9+
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Mon, Nov 15, 2010 at 12:20:37AM +0300, Anonymous wrote:
> Konstantin Belousov <kib@FreeBSD.org> writes:
>=20
> > 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 con=
stants.
> >  =20
> >   MFC after:   1 week
> [...]
> > Modified: head/sys/sys/param.h
> > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D
> > --- 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 */
> > =20
> > +#ifdef _KERNEL
> > +#define	__FreeBSD_version_SIGSEGV	700004
> > +#define	__FreeBSD_version_MAP_ANON	800104
> > +#endif
> > +
>=20
> This breaks bsd.port.mk regexp to determine OSVERSION.
>=20
>   # Get __FreeBSD_version
>   .if !defined(OSVERSION)
>   .if exists(/usr/include/sys/param.h)
>   OSVERSION!=3D	${AWK} '/^\#define[[:blank:]]__FreeBSD_version/ {print $$=
3}' < /usr/include/sys/param.h
>   .elif exists(/usr/src/sys/sys/param.h)
>   OSVERSION!=3D	${AWK} '/^\#define[[:blank::]]__FreeBSD_version/ {print $=
$3}' < /usr/src/sys/sys/param.h
>   .else
>   OSVERSION!=3D	${SYSCTL} -n kern.osreldate
>   .endif
>   .endif
>=20
>   $ make -V OSVERSION
>   900025 700004 800104
>=20
> And every port chokes on it.
>=20
>  $ make -C devel/libpthread-stubs
>   "Makefile", line 26: warning: String comparison operator should be eith=
er =3D=3D or !=3D
>   "Makefile", line 26: Malformed conditional (${OSVERSION} < 700000)
>   "Makefile", line 28: if-less endif
>   "/usr/ports/Mk/bsd.port.mk", line 1739: warning: String comparison oper=
ator should be either =3D=3D or !=3D
>   "/usr/ports/Mk/bsd.port.mk", line 1739: Malformed conditional (defined(=
USE_XZ) && ( (${OSVERSION} >=3D 900000 && ${OSVERSION} < 900012) || ${OSVER=
SION} < 800505 ))
>   "/usr/ports/Mk/bsd.port.mk", line 6394: if-less endif
>   make: fatal errors encountered -- cannot continue
>=20
> %%
> Index: Mk/bsd.port.mk
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> RCS file: /a/.cvsup/ports/Mk/bsd.port.mk,v
> retrieving revision 1.654
> diff -u -p -r1.654 bsd.port.mk
> --- Mk/bsd.port.mk	8 Nov 2010 16:07:03 -0000	1.654
> +++ Mk/bsd.port.mk	14 Nov 2010 21:18:32 -0000
> @@ -1219,9 +1219,9 @@ OSREL!=3D	${UNAME} -r | ${SED} -e 's/[-(].
>  # Get __FreeBSD_version
>  .if !defined(OSVERSION)
>  .if exists(/usr/include/sys/param.h)
> -OSVERSION!=3D	${AWK} '/^\#define[[:blank:]]__FreeBSD_version/ {print $$3=
}' < /usr/include/sys/param.h
> +OSVERSION!=3D	${AWK} '/^\#define[[:blank:]]__FreeBSD_version[[:blank:]]/=
 {print $$3}' < /usr/include/sys/param.h
>  .elif exists(/usr/src/sys/sys/param.h)
> -OSVERSION!=3D	${AWK} '/^\#define[[:blank::]]__FreeBSD_version/ {print $$=
3}' < /usr/src/sys/sys/param.h
> +OSVERSION!=3D	${AWK} '/^\#define[[:blank::]]__FreeBSD_version[[:blank:]]=
/ {print $$3}' < /usr/src/sys/sys/param.h
>  .else
>  OSVERSION!=3D	${SYSCTL} -n kern.osreldate
>  .endif
> %%

I think it is better to select different namespace for the special versions.
Can you confirm that the following patch fixes the ports mk for you ?
It is enough to cd /usr/src/include && make install after patching.

diff --git a/sys/amd64/amd64/trap.c b/sys/amd64/amd64/trap.c
index a1a3ebc..e5184a6 100644
--- a/sys/amd64/amd64/trap.c
+++ b/sys/amd64/amd64/trap.c
@@ -416,8 +416,7 @@ trap(struct trapframe *frame)
 					 * without the ABI-tag ELF note.
 					 */
 					if (SV_CURPROC_ABI() =3D=3D SV_ABI_FREEBSD
-					    && p->p_osrel >=3D
-					    __FreeBSD_version_SIGSEGV) {
+					    && p->p_osrel >=3D P_OSREL_SIGSEGV) {
 						i =3D SIGSEGV;
 						ucode =3D SEGV_ACCERR;
 					} else {
diff --git a/sys/i386/i386/trap.c b/sys/i386/i386/trap.c
index b6f843a..026ba9d 100644
--- a/sys/i386/i386/trap.c
+++ b/sys/i386/i386/trap.c
@@ -462,8 +462,7 @@ trap(struct trapframe *frame)
 					 * without the ABI-tag ELF note.
 					 */
 					if (SV_CURPROC_ABI() =3D=3D SV_ABI_FREEBSD
-					    && p->p_osrel >=3D
-					    __FreeBSD_version_SIGSEGV) {
+					    && p->p_osrel >=3D P_OSREL_SIGSEGV) {
 						i =3D SIGSEGV;
 						ucode =3D SEGV_ACCERR;
 					} else {
diff --git a/sys/sys/param.h b/sys/sys/param.h
index 3e4cdf6..ea90308 100644
--- a/sys/sys/param.h
+++ b/sys/sys/param.h
@@ -61,8 +61,8 @@
 #define __FreeBSD_version 900025	/* Master, propagated to newvers */
=20
 #ifdef _KERNEL
-#define	__FreeBSD_version_SIGSEGV	700004
-#define	__FreeBSD_version_MAP_ANON	800104
+#define	P_OSREL_SIGSEGV		700004
+#define	P_OSREL_MAP_ANON	800104
 #endif
=20
 #ifndef LOCORE
diff --git a/sys/vm/vm_mmap.c b/sys/vm/vm_mmap.c
index 4d92573..a6decc3 100644
--- a/sys/vm/vm_mmap.c
+++ b/sys/vm/vm_mmap.c
@@ -232,7 +232,7 @@ mmap(td, uap)
=20
 	/* Make sure mapping fits into numeric range, etc. */
 	if ((uap->len =3D=3D 0 && !SV_CURPROC_FLAG(SV_AOUT) &&
-	     curproc->p_osrel >=3D __FreeBSD_version_MAP_ANON) ||
+	     curproc->p_osrel >=3D P_OSREL_MAP_ANON) ||
 	    ((flags & MAP_ANON) && (uap->fd !=3D -1 || pos !=3D 0)))
 		return (EINVAL);
=20

--LKH70Ka7gWbFxE9+
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (FreeBSD)

iEYEARECAAYFAkzgVq0ACgkQC3+MBN1Mb4i5pACeN887Uxku6VZOrBfTMIuoDgh+
PrkAmQFkp9CRPb01V3/RIybTHUthu1Jg
=Spak
-----END PGP SIGNATURE-----

--LKH70Ka7gWbFxE9+--



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