J Duff wrote:
I want to obtain status information for a disk using C code from
within the OpenSolaris kernel. What function do I use?

What do you really mean by "status information" ?

I can get the information using the command line by entering “stat
/dev/dsk/c4t10d0s0�. So, I tried the following C code:

/* The include below should have angle brackets, but */ /* they
caused the included text to be stripped in this post??? */ #include
sys/stat.h … struct stat fstatus; int rc =
stat(“/dev/c4t10d0s0�, &fstatus);

When I build the code above using the nightly script, I receive the
compilation message “warning: implicit function declaration: stat
(E_NO_IMPLICIT_DECL_ALLOWED).�

I really just want to obtain the disk’s device number (dev_t). Is
there a better way to do this from within the kernel code?

If you want to obtain the device's dev_t from kernel space,
then you should look at the ddi_minor information for your
device node.

If you want the device's dev_t from userland, then use the
stat(2) function from sys/stat.h.


What are you really trying to do?


James C. McPherson
--
Solaris kernel software engineer, system admin and troubleshooter
              http://www.jmcp.homeunix.com/blog
                  http://blogs.sun.com/jmcp
Find me on LinkedIn @ http://www.linkedin.com/in/jamescmcpherson

_______________________________________________
opensolaris-code mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code

Reply via email to