1 KSTAT_NAMED_INIT(9F)     Kernel Functions for Drivers     KSTAT_NAMED_INIT(9F)
   2 
   3 NAME
   4      kstat_named_init kstat_named_setstr - initialize a named kstat
   5 
   6 SYNOPSIS
   7      <sys/types.h>
   8      <sys/kstat.h>
   9 
  10      void
  11      kstat_named_init(kstat_named_t *knp, const char *name,
  12          uchar_t data_type);
  13 
  14      void
  15      kstat_named_setstr(kstat_named_t *knp, const char *str);
  16 
  17 INTERFACE LEVEL
  18      Solaris DDI specific (Solaris DDI)
  19 
  20 PARAMETERS
  21      knp     Pointer to a kstat_named(9S) structure.
  22 
  23      name    The name of the statistic.
  24 
  25      data_type
  26              The type of value. This indicates which field of the
  27              kstat_named(9S) structure should be used. Valid values are:
  28 
  29              KSTAT_DATA_CHAR
  30                      The "char" field.
  31 
  32              KSTAT_DATA_LONG
  33                      The "long" field.
  34 
  35              KSTAT_DATA_ULONG
  36                      The "unsigned long" field.
  37 
  38              KSTAT_DATA_LONGLONG
  39                      Obsolete. Use KSTAT_DATA_INT64.
  40 
  41              KSTAT_DATA_ULONGLONG
  42                      Obsolete. Use KSTAT_DATA_UINT64.
  43 
  44              KSTAT_DATA_STRING
  45                      Arbitrary length "long string" field.
  46 
  47              KSTAT_DATA_TIME
  48                      The high resolution time stamp field.  Note that this
  49                      should only be used for absolute time stamps, such as
  50                      returned by gethrtime(9F), and not for relative
  51                      durations.  For relative durations, KSTAT_DATA_UINT64 is
  52                      preferred.
  53 
  54      str     Pointer to a NULL-terminated string.
  55 
  56 DESCRIPTION
  57      kstat_named_init() associates a name and a type with a kstat_named(9S)
  58      structure.
  59 
  60      kstat_named_setstr() associates str with the named kstat knp.  It is an
  61      error for knp to be of type other than KSTAT_DATA_STRING.  The string
  62      argument must remain valid even after the function that is calling
  63      kstat_named_setstr() is returned. If KSTAT_DATA_STRING is used in a
  64      persistent kstat the string argument must remain valid even after the
  65      module that created the kstat is unloaded.  This is the only supported
  66      method of changing the value of long strings.
  67 
  68 CONTEXT
  69      kstat_named_init() and kstat_named_setstr() can be called from user or
  70      kernel context.
  71 
  72 RETURN VALUES
  73      None.
  74 
  75 SEE ALSO
  76      gethrtime(9F), kstat_create(9F), kstat_install(9F), kstat(9S),
  77      kstat_named(9S)
  78 
  79      Writing Device Drivers.
  80 
  81 illumos                        January 27, 2016                        illumos