1net_kstat_create(9F)     Kernel Functions for Drivers     net_kstat_create(9F)
2
3
4

NAME

6       net_kstat_create  -  create  and  initialize a new kstat for a specific
7       instance of IP
8

SYNOPSIS

10       #include <sys/types.h>
11       #include <sys/kstat.h>
12       #include <sys/neti.h>
13
14       kstat_t *net_kstat_create(netid_t netid, char *module,
15            int instance, char *name, char *class, uchar_type type,
16            ulong_t ndata, uchar_t ks_flag);
17
18

INTERFACE LEVEL

20       Solaris DDI specific (Solaris DDI).
21

PARAMETERS

23       netid       IP instance identifier.
24
25
26       module      The name of the provider's module  (such  as  "sd",  "esp",
27                   ...). The "core" kernel uses the name "unix".
28
29
30       instance    The     provider's     instance     number,     as     from
31                   ddi_get_instance(9F). Modules which do not have a  meaning‐
32                   ful instance number should use 0.
33
34
35       name        A  pointer to a string that uniquely identifies this struc‐
36                   ture. Only KSTAT_STRLEN − 1 characters are significant.
37
38
39       class       The general class that this kstat belongs to. The following
40                   classes  are currently in use: disk, tape, net, controller,
41                   vm, kvm, hat, streams, kstat, and misc.
42
43
44       type        The type of kstat to allocate. Valid types are:
45
46                   KSTAT_TYPE_NAMED
47
48                       Allows more than one data record per kstat.
49
50
51                   KSTAT_TYPE_INTR
52
53                       Interrupt; only one data record per kstat.
54
55
56                   KSTAT_TYPE_IO
57
58                       I/O; only one data record per kstat
59
60
61
62       ndata       The number of type-specific data records to allocate.
63
64
65       ks_flag     A bit-field of various flags for  this  kstat.  ks_flag  is
66                   some combination of:
67
68                   KSTAT_FLAG_VIRTUAL
69
70                       Tells  kstat_create()  not  to  allocate memory for the
71                       kstat data section; instead, the driver  will  set  the
72                       ks_data field to point to the data it wishes to export.
73                       This provides a convenient way to export existing  data
74                       structures.
75
76
77                   KSTAT_FLAG_WRITABLE
78
79                       Makes the kstat data section writable by root.
80
81
82                   KSTAT_FLAG_PERSISTENT
83
84                       Indicates  that  this  kstat  is  to be persistent over
85                       time. For persistent  kstats,  kstat_delete(9F)  simply
86                       marks the kstat as dormant; a subsequent kstat_create()
87                       reactivates the kstat. This feature is provided so that
88                       statistics  are not lost across driver close/open (such
89                       as raw disk I/O on a disk with no mounted  partitions.)
90                       Note:   Persistent  kstats  cannot  be  virtual,  since
91                       ks_data points to garbage as soon as  the  driver  goes
92                       away.
93
94
95

DESCRIPTION

97       The  net_kstat_create()  function allocates and initializes a kstat(9S)
98       structure. See kstat_create(9F) for a complete discussion of this func‐
99       tion.
100

RETURN VALUES

102       If  successful,  net_kstat_create()  returns a pointer to the allocated
103       kstat. NULL is returned upon failure.
104

CONTEXT

106       The net_kstat_create() function may be called from user or kernel  con‐
107       text.
108

ATTRIBUTES

110       See attributes(5) for descriptions of the following attributes:
111
112
113
114
115       ┌─────────────────────────────┬─────────────────────────────┐
116       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
117       ├─────────────────────────────┼─────────────────────────────┤
118       │Availability                 │SUNWcsu                      │
119       ├─────────────────────────────┼─────────────────────────────┤
120       │Interface Stability          │Committed                    │
121       └─────────────────────────────┴─────────────────────────────┘
122

SEE ALSO

124       ddi_get_instance(9F),        kstat_create(9F),        kstat_delete(9F),
125       net_kstat_delete(9F), hook_t(9S), kstat_named(9S)
126
127
128
129SunOS 5.11                        1 May 2008              net_kstat_create(9F)
Impressum