Re: How to Check kernel version in code?

看板FB_hackers作者時間11年前 (2014/06/04 10:32), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串3/3 (看更多)
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" > > _______________________________________________ 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"
文章代碼(AID): #1JZeKZsv (FB_hackers)
文章代碼(AID): #1JZeKZsv (FB_hackers)