Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 22 Nov 2011 18:53:40 +0100
From:      Robert Millan <rmh@freebsd.org>
To:        Kostik Belousov <kostikbel@gmail.com>
Cc:        Robert Millan <rmh@debian.org>, freebsd-current@freebsd.org, Adrian Chadd <adrian@freebsd.org>, Bruce Evans <brde@optusnet.com.au>, freebsd-arch@freebsd.org
Subject:   Re: [PATCH] Detect GNU/kFreeBSD in user-visible kernel headers
Message-ID:  <20111122175340.GA44367@thorin>
In-Reply-To: <20111122093515.GK50300@deviant.kiev.zoral.com.ua>
References:  <201111171632.34979.jhb@freebsd.org> <CAOfDtXMFk%2BC_eUsb6190UHHM0cgu3jf1M_M9oq4ibuYuke4pYQ@mail.gmail.com> <CAOfDtXP6ShN3DezN0u4PUVt9ft__2a%2BYwo3in9w01eQnfAQ7sQ@mail.gmail.com> <20111119175620.GV50300@deviant.kiev.zoral.com.ua> <20111120114042.GA1256@thorin> <20111120174807.GY50300@deviant.kiev.zoral.com.ua> <20111121133954.A1108@besplex.bde.org> <20111121092749.GD50300@deviant.kiev.zoral.com.ua> <CAOfDtXNypUhu-dWznLyHcZMN-ZPSn_qTC6pSuL68r2M2hOjZTg@mail.gmail.com> <20111122093515.GK50300@deviant.kiev.zoral.com.ua>

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

--6sX45UoQRIJXqkqR
Content-Type: multipart/mixed; boundary="lrZ03NoBR/3+SXJZ"
Content-Disposition: inline


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

On Tue, Nov 22, 2011 at 11:35:15AM +0200, Kostik Belousov wrote:
> I am fine with __FreeBSD_kernel being empty, please submit the patch.

Here.

--=20
Robert Millan

--lrZ03NoBR/3+SXJZ
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment; filename="freebsd_kernel.diff"
Content-Transfer-Encoding: quoted-printable

Index: 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
--- sys/sys/param.h	(revision 227580)
+++ sys/sys/param.h	(working copy)
@@ -60,6 +60,22 @@
 #undef __FreeBSD_version
 #define __FreeBSD_version 1000001	/* Master, propagated to newvers */
=20
+/*
+ * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBS=
D,
+ * which by definition is always true on FreeBSD. This macro is also defin=
ed
+ * on other systems that use the kernel of FreeBSD, such as GNU/kFreeBSD
+ *
+ * It is tempting to use this macro in userland code when we want to enable
+ * kernel-specific routines, and in fact it's fine to do this in code that
+ * is part of FreeBSD itself.  However, be aware that as presence of this
+ * macro is still not widespread (e.g. older FreeBSD versions, 3rd party
+ * compilers, etc), it is STRONGLY DISCOURAGED to check for this macro in
+ * external applications without also checking for __FreeBSD__ as an
+ * alternative.
+ */
+#undef __FreeBSD_kernel__
+#define __FreeBSD_kernel__
+
 #ifdef _KERNEL
 #define	P_OSREL_SIGWAIT		700000
 #define	P_OSREL_SIGSEGV		700004

--lrZ03NoBR/3+SXJZ--

--6sX45UoQRIJXqkqR
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: Digital signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/kFreeBSD)

iQIcBAEBCAAGBQJOy+GjAAoJELd1onhloKnOUDgP+QFg4UkD/RNaWH1SPxcfaudV
U8V24pPqgTYnftLGc+R9IFK+pXcr+lIOL7em8whIa0QYbl4L0s4a9cStcKySJALa
BPLtHHv2b64WELfa8RVzPeXYZ87oCSYrhYroEU7l7yd2ezaHbZf6yq7ugrIzBtM8
uJNDUKwz2plFT2Mq2uf8s42o++cWZUXP2ifVlEiQNqvcsNTrfYaLA2iXDhs26tTV
eX1Y/aiD83PVIPRIpbiFPu7Wv4EkeF0aW/ejlH6fcEyaNjAo+mFDPaFL7Ci6OCfS
3V8gFERM3TZy3HAKcX6yuP1OuIfVAPt/LxMhF6bzADSh9rVjKDvDbbsRojp0z3w8
zHqZDQFcZYItee2HeCmUKcb8OGRNwP3Twqh78Tfy9AVmLaYFgdq3qVQ4HIO8UCJr
pTqZRnthZlIxA6EtTZqxQ4Gv59YD5Z7FKwjc83oMRdnxhIFcc1pQtKWIZBoPjgkE
N1iJhu9opqFUPH97lqoTFxFZnVVS/YsT5VaoPJcuADv+pc4GmlABZm1nid5tzEIx
v97pJSEfY0UweNUAAoVZFt63jgShvWYPJ4sZ9Fb4TVu5sJeztFJiFAKNp6+3CDXh
5HBrfmEJTS7vioAyaF4PpU1sYLSADV8jpRLbYwTrFvW73UrcQONTHRtRkAfAEclp
2Gvjex6xv0XjhsB6trrW
=mtIo
-----END PGP SIGNATURE-----

--6sX45UoQRIJXqkqR--



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