From owner-freebsd-hackers@FreeBSD.ORG Wed Jun 4 02:12:24 2014 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9B23C9D3; Wed, 4 Jun 2014 02:12:24 +0000 (UTC) Received: from vps1.elischer.org (vps1.elischer.org [204.109.63.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "vps1.elischer.org", Issuer "CA Cert Signing Authority" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 6543F23F2; Wed, 4 Jun 2014 02:12:24 +0000 (UTC) Received: from Julian-MBP3.local (etroy.elischer.org [121.45.232.70]) (authenticated bits=0) by vps1.elischer.org (8.14.8/8.14.8) with ESMTP id s542CCmI088493 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Tue, 3 Jun 2014 19:12:15 -0700 (PDT) (envelope-from julian@freebsd.org) Message-ID: <538E8076.1060809@freebsd.org> Date: Wed, 04 Jun 2014 10:12:06 +0800 From: Julian Elischer User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 MIME-Version: 1.0 To: Benjamin Kaduk , Sreenivasa Honnur Subject: Re: How to Check kernel version in code? References: <538B61EC.9000403@mu.org> <5B82C892-12A4-4251-B3D2-A6D3EAAF90F9@dataix.net> <538B6FCC.9090301@mu.org> <538B761C.7060300@mu.org> <50E51CBE-7F7B-4093-86A5-320ACE81072E@dataix.net> <538B7937.2030104@mu.org> <098847BE-04B5-4E6F-98B8-87B5C7055C69@mail.turbofuzz.com> <538B8494.3040701@mu.org> <7977A65A-5ABE-49DD-8E76-074B54943D64@mail.turbofuzz.com> <538BDDF5.708@mu.org> <409ccb2cf1dc027bdf6ff7ccbda08723.authenticated@ultimatedns.net> <538C8DDF.3030602@mu.org> <538D4C93.1060808@freebsd.org> <538D50B3.300@freebsd.org> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: "freebsd-hackers@freebsd.org" X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Jun 2014 02:12:24 -0000 On 6/3/14, 11:43 PM, Benjamin Kaduk wrote: > On Tue, 3 Jun 2014, Sreenivasa Honnur wrote: > >> I want to enable some code based on FBSD kernel versions like below: >> >> #ifdef FreeBSD_VERSION_10 >> >> #endif >> >> #ifdef FreeBSD_VERSION_9.2 >> >> #endif >> >> >> How can I do achieve this? > > __FreeBSD_version is defined in sys/param.h, and is incremented for > major version changes as well as other events of note. > > Increments are tabulated at > http://www.freebsd.org/doc/en/books/porters-handbook/freebsd-versions.html Realise though that this is hte version of the environment where the BUILD is done, not the environment where the program is running. The use of #if suggests this is what you want, but there are also dynamic ways to test. > > -Ben Kaduk > _______________________________________________ > freebsd-hackers@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-hackers > To unsubscribe, send any mail to > "freebsd-hackers-unsubscribe@freebsd.org" > >