That's a kernel function, not available to application programs.

Generally all of sys/ddi.h an sys/sunddi.h (and most other things in
sys/, but not all of them) are available only in the kernel.  These are
things that are documented in section 9 of the system manual -- they
exist for folks writing device drivers and kernel modules.

        - Garret

On Fri, 2010-07-23 at 17:14 +0800, 邓宁 wrote:
> 
> Dear solaris gurus,
> 
> I have a stupid question when writing a program under solaris. In the
> program, I want to use the system function ddi_fls() and ddi_ffs(). 
> 
> From its description at
> http://docs.sun.com/app/docs/doc/819-2256/ddi-ffs-9f?q=StarOffice&s=t&a=view, 
> I think it can meet my requirement.
> 
> I haven't use a solaris function inside the user application before.
> Yet I've tried it this way:
> 
> #include <sys/conf.h>
> 
> #include <sys/ddi.h>
> 
> #include <sys/sunddi.h>
> 
> #include <stdio.h> 
> 
> 
> void main()
> {
>     long bitmap = 8300; //binary format: 10 0000 0110 1100
> 
>     //try ddi_ffs() and ddi_fls()
> 
> 
>     printf("The index of the first set bit in the bitmap is:%dth\n",
> ddi_ffs(bitmap));
> 
>     printf("The index of the last set bit in the bitmap is:%dth\n",
> ddi_fls(bitmap));
> 
> }
> 
> Then, I compiled it by:
> 
> "gcc -o test.o test.c" 
> 
> and got some error at linking stage:
> 
> Undefined symbol                                 first referenced in
> file
> ddi_ffs                                                    /var/tmp//ccu...
> ddi_fls                                                    /var/tmp//...
> 
> ld: fatal: symbol referencing errors. 
> 
> 
> Can you show me how to use the ddi_XXXX() function in my userland
> code?  
> 
> 
> Thank you in advance. 
> 
> -- 
> Regards
> Ning Deng
> 
> School Of Computer Science and Technology 
> Beijng Institute of Technology, China, 100081
> [email protected]
> 
> _______________________________________________
> driver-discuss mailing list
> [email protected]
> http://mail.opensolaris.org/mailman/listinfo/driver-discuss


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

Reply via email to