kstat(9s) 맨 페이지 - 윈디하나의 솔라나라

개요

섹션
맨 페이지 이름
검색(S)

kstat(9s)

Kernel & Driver Data Structures                                      kstat(9S)



NAME
       kstat - kernel statistics structure

SYNOPSIS
       #include <sys/types.h>
       #include <sys/kstat.h>
       #include <sys/ddi.h>
       #include <sys/sunddi.h>

INTERFACE LEVEL
       Solaris DDI specific (Solaris DDI)

DESCRIPTION
       Each  kernel statistic (kstat) exported by device drivers consists of a
       header section and a data section. The kstat structure  is  the  header
       portion of the statistic.


       A driver receives a pointer to a kstat structure from a successful call
       to kstat_create(9F). Drivers should never allocate a kstat structure in
       any other manner.


       After  allocation, the driver should perform any further initialization
       needed before calling the kstat_install() function to  actually  export
       the kstat. For more information, see the kstat_install(9F) man page.

STRUCTURE MEMBERS
         void      *ks_data;             /* kstat type-specif. data */
         ulong_t   ks_ndata;             /* # of type-specif. data
                                              records */
         ulong_t   ks_data_size;         /* total size of kstat data
                                            section */
         int       (*ks_update)(struct kstat *, int);
         void      *ks_private;          /* arbitrary provider-private
                                            data */
         void      *ks_lock;             /* protects kstat's data */



       The  members  of  the  kstat structure available to examine or set by a
       driver are as follows:

       ks_data         Points to the data portion of the kstat.  Either  allo‐
                       cated  by  the  kstat_create() function for the drivers
                       use, or by the driver if it is  using  virtual  kstats.
                       For  more  information,  see  the  kstat_create(9F) man
                       page.


       ks_ndata        The number of data records in this kstat.  Set  by  the
                       ks_update(9E) routine.


       ks_data_size    The  amount  of  data pointed to by ks_data. Set by the
                       ks_update(9E) routine.


       ks_update       Pointer to a routine that  dynamically  updates  kstat.
                       This  is useful for drivers where the underlying device
                       keeps cheap hardware statistics, but  where  extraction
                       is  expensive.  Instead of constantly keeping the kstat
                       data section up  to  date,  the  driver  can  supply  a
                       ks_update()  function  that updates the kstat data sec‐
                       tion  on  demand.  For  more   information,   see   the
                       ks_update(9E)  man page. To take advantage of this fea‐
                       ture,  set  the  ks_update  field  before  calling  the
                       kstat_install() function. For more information, see the
                       kstat_install(9F) man page.


       ks_private      Is a private field for the driver's use. Often used  in
                       the ks_update() function. For more information, see the
                       ks_update(9E) man page.


       ks_lock         Is a pointer to a mutex that protects this kstat. kstat
                       data sections are optionally protected by the per-kstat
                       ks_lock. If ks_lock is non-NULL, kstat clients (such as
                       /dev/kstat)  will  acquire  this  lock for all of their
                       operations on  that  kstat.  It  is  up  to  the  kstat
                       provider to decide whether guaranteeing consistent data
                       to kstat clients is sufficiently important  to  justify
                       the  locking  cost.  Note, however, that most statistic
                       updates already  occur  under  one  of  the  provider's
                       mutexes.  If the provider sets ks_lock to point to that
                       mutex, then kstat data  locking  is  free.  ks_lock  is
                       really  of  type (kmutex_t*) and is declared as (void*)
                       in the kstat header. That way, users do not have to  be
                       exposed to all of the kernel's lock-related data struc‐
                       tures.


SEE ALSO
       kstat_create(9F), kstat2(9S), kstat2_create(9F)


       Writing Device Drivers in Oracle Solaris 11.4

NOTES
       With the introduction of kstats v2, direct use of these fields is  dep‐
       recated.  They  may be renamed or removed in a future release of Oracle
       Solaris. For more information on how to access fields  in  a  v2  kstat
       created  by the kstat2_create() function, see the kstat2_create(9F) and
       kstat2(9S) man pages.



Oracle Solaris 11.4               31 Aug 2016                        kstat(9S)
맨 페이지 내용의 저작권은 맨 페이지 작성자에게 있습니다.
RSS ATOM XHTML 5 CSS3