Re: [PATCH] Detect GNU/kFreeBSD in user-visible kernel headers
--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--
討論串 (同標題文章)
完整討論串 (本文為第 18 之 24 篇):