Shreyas Bhatewara wrote:


On Wed, Dec 16, 2009 at 2:08 PM, Darren J Moffat <darr...@opensolaris.org <mailto:darr...@opensolaris.org>> wrote:

    Shreyas Bhatewara wrote:

        Folks,

        I am writing a device driver for current and past versions of
        (Open)Solaris

        How can I check the version of the running kernel in the driver
        code ? I tried using utsname.version (/.release) but it does not
        exist for Solaris 10 or older kernels. Is there any other
        literal/variable which spans current and old Solaris kernels
        which can give the kernel version/ release information ? For Eg
        : linux has LINUX_VERSION_CODE


    Why do you think you need to do that ?

    Unlike Linux Solaris has a very very stable API and ABI for device
    drivers.



Yes, I certainly agree to that.
Recently, I am trying to compile the driver with a literal : MAC_VERSION (this is a nic driver) and somehow the compilation fails to get latest value of this literal (post b111 MAC_VERSION is 2, earlier it was 1). I completely fail to understand where the compilation gets (wrong ) value of MAC_VERSION. It does not exist in /usr/include/sys and the file mac_provider.h does not exist on the Opensolaris machine anywhere.
Fed up of solving this problem, I decided to use the versioin number.
if (version < 111)
 mac_version = 1;
else
 mac_version = 2;

You are attempting to use a private interface not covered as part of the DDI (Device Driver Interface). That interface is being made Committed now see:

http://arc.opensolaris.org/caselog/PSARC/2009/638/proposal.txt


--
Darren J Moffat
_______________________________________________
opensolaris-code mailing list
opensolaris-code@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code

Reply via email to