Lines Matching refs:ksp

54 	kstat_t *ksp, *nksp;  in kstat_chain_free()  local
56 ksp = kc->kc_chain; in kstat_chain_free()
57 while (ksp) { in kstat_chain_free()
58 nksp = ksp->ks_next; in kstat_chain_free()
59 free(ksp->ks_data); in kstat_chain_free()
60 free(ksp); in kstat_chain_free()
61 ksp = nksp; in kstat_chain_free()
104 kstat_read(kstat_ctl_t *kc, kstat_t *ksp, void *data) in kstat_read() argument
108 if (ksp->ks_data == NULL && ksp->ks_data_size > 0) { in kstat_read()
109 kstat_zalloc(&ksp->ks_data, ksp->ks_data_size, 0); in kstat_read()
110 if (ksp->ks_data == NULL) in kstat_read()
113 while ((kcid = (kid_t)ioctl(kc->kc_kd, KSTAT_IOC_READ, ksp)) == -1) { in kstat_read()
128 if (errno == ENOMEM && (ksp->ks_flags & in kstat_read()
130 kstat_zalloc(&ksp->ks_data, ksp->ks_data_size, 1); in kstat_read()
131 if (ksp->ks_data != NULL) in kstat_read()
137 (void) memcpy(data, ksp->ks_data, ksp->ks_data_size); in kstat_read()
138 if (ksp->ks_type == KSTAT_TYPE_NAMED && in kstat_read()
139 ksp->ks_data_size != in kstat_read()
140 ksp->ks_ndata * sizeof (kstat_named_t)) { in kstat_read()
147 for (i = 0; i < ksp->ks_ndata; i++, knp++) { in kstat_read()
161 (char *)ksp->ks_data); in kstat_read()
169 kstat_write(kstat_ctl_t *kc, kstat_t *ksp, void *data) in kstat_write() argument
173 if (ksp->ks_data == NULL && ksp->ks_data_size > 0) { in kstat_write()
174 kstat_zalloc(&ksp->ks_data, ksp->ks_data_size, 0); in kstat_write()
175 if (ksp->ks_data == NULL) in kstat_write()
179 (void) memcpy(ksp->ks_data, data, ksp->ks_data_size); in kstat_write()
180 if (ksp->ks_type == KSTAT_TYPE_NAMED) { in kstat_write()
182 kstat_named_t *nknp = KSTAT_NAMED_PTR(ksp); in kstat_write()
185 for (i = 0; i < ksp->ks_ndata; i++, oknp++, nknp++) { in kstat_write()
197 (char *)ksp->ks_data + in kstat_write()
203 while ((kcid = (kid_t)ioctl(kc->kc_kd, KSTAT_IOC_WRITE, ksp)) == -1) { in kstat_write()
303 kstat_t *ksp; in kstat_lookup() local
305 for (ksp = kc->kc_chain; ksp; ksp = ksp->ks_next) { in kstat_lookup()
307 strcmp(ksp->ks_module, ks_module) == 0) && in kstat_lookup()
308 (ks_instance == -1 || ksp->ks_instance == ks_instance) && in kstat_lookup()
309 (ks_name == NULL || strcmp(ksp->ks_name, ks_name) == 0)) in kstat_lookup()
310 return (ksp); in kstat_lookup()
318 kstat_data_lookup(kstat_t *ksp, char *name) in kstat_data_lookup() argument
323 switch (ksp->ks_type) { in kstat_data_lookup()
327 namep = KSTAT_NAMED_PTR(ksp)->name; in kstat_data_lookup()
332 namep = KSTAT_TIMER_PTR(ksp)->name; in kstat_data_lookup()
340 datap = ksp->ks_data; in kstat_data_lookup()
341 for (i = 0; i < ksp->ks_ndata; i++) { in kstat_data_lookup()