Lines Matching refs:ksp

375 	kstat_t *ksp;  in kstat_hold()  local
380 ksp = avl_find(t, template, NULL); in kstat_hold()
381 if (ksp == NULL) in kstat_hold()
383 e = (ekstat_t *)ksp; in kstat_hold()
391 return (ksp); in kstat_hold()
395 kstat_rele(kstat_t *ksp) in kstat_rele() argument
397 ekstat_t *e = (ekstat_t *)ksp; in kstat_rele()
471 kstat_t *ksp; in kstat_init() local
497 ksp = kstat_create("unix", 0, "kstat_headers", "kstat", KSTAT_TYPE_RAW, in kstat_init()
499 if (ksp) { in kstat_init()
500 ksp->ks_lock = &kstat_chain_lock; in kstat_init()
501 ksp->ks_update = header_kstat_update; in kstat_init()
502 ksp->ks_snapshot = header_kstat_snapshot; in kstat_init()
503 kstat_install(ksp); in kstat_init()
508 ksp = kstat_create("unix", 0, "kstat_types", "kstat", in kstat_init()
510 if (ksp) { in kstat_init()
512 kstat_named_t *kn = KSTAT_NAMED_PTR(ksp); in kstat_init()
519 kstat_install(ksp); in kstat_init()
522 ksp = kstat_create("unix", 0, "sysinfo", "misc", KSTAT_TYPE_RAW, in kstat_init()
524 if (ksp) { in kstat_init()
525 ksp->ks_data = (void *) &sysinfo; in kstat_init()
526 kstat_install(ksp); in kstat_init()
529 ksp = kstat_create("unix", 0, "vminfo", "vm", KSTAT_TYPE_RAW, in kstat_init()
531 if (ksp) { in kstat_init()
532 ksp->ks_data = (void *) &vminfo; in kstat_init()
533 kstat_install(ksp); in kstat_init()
536 ksp = kstat_create("unix", 0, "segmap", "vm", KSTAT_TYPE_NAMED, in kstat_init()
538 if (ksp) { in kstat_init()
539 ksp->ks_data = (void *) segmapcnt_ptr; in kstat_init()
540 ksp->ks_update = segmap_kstat_update; in kstat_init()
541 kstat_install(ksp); in kstat_init()
544 ksp = kstat_create("unix", 0, "biostats", "misc", KSTAT_TYPE_NAMED, in kstat_init()
546 if (ksp) { in kstat_init()
547 ksp->ks_data = (void *) biostats_ptr; in kstat_init()
548 kstat_install(ksp); in kstat_init()
551 ksp = kstat_create("unix", 0, "var", "misc", KSTAT_TYPE_RAW, in kstat_init()
553 if (ksp) { in kstat_init()
554 ksp->ks_data = (void *) &v; in kstat_init()
555 kstat_install(ksp); in kstat_init()
558 ksp = kstat_create("unix", 0, "system_misc", "misc", KSTAT_TYPE_NAMED, in kstat_init()
561 if (ksp) { in kstat_init()
562 ksp->ks_data = (void *) &system_misc_kstat; in kstat_init()
563 ksp->ks_update = system_misc_kstat_update; in kstat_init()
564 kstat_install(ksp); in kstat_init()
567 ksp = kstat_create("unix", 0, "system_pages", "pages", KSTAT_TYPE_NAMED, in kstat_init()
570 if (ksp) { in kstat_init()
571 ksp->ks_data = (void *) &system_pages_kstat; in kstat_init()
572 ksp->ks_update = system_pages_kstat_update; in kstat_init()
573 kstat_install(ksp); in kstat_init()
576 ksp = kstat_create("poll", 0, "pollstats", "misc", KSTAT_TYPE_NAMED, in kstat_init()
579 if (ksp) { in kstat_init()
580 ksp->ks_data = pollstats_ptr; in kstat_init()
581 kstat_install(ksp); in kstat_init()
630 default_kstat_update(kstat_t *ksp, int rw) in default_kstat_update() argument
640 if (ksp->ks_data != NULL && ksp->ks_type == KSTAT_TYPE_NAMED && in default_kstat_update()
641 (ksp->ks_flags & (KSTAT_FLAG_VAR_SIZE | KSTAT_FLAG_LONGSTRINGS))) { in default_kstat_update()
646 knp = KSTAT_NAMED_PTR(ksp); in default_kstat_update()
647 for (i = 0; i < ksp->ks_ndata; i++, knp++) { in default_kstat_update()
651 ksp->ks_data_size = in default_kstat_update()
652 ksp->ks_ndata * sizeof (kstat_named_t) + len; in default_kstat_update()
658 default_kstat_snapshot(kstat_t *ksp, void *buf, int rw) in default_kstat_snapshot() argument
664 ksp->ks_snaptime = cur_time = gethrtime(); in default_kstat_snapshot()
667 if (!(ksp->ks_flags & KSTAT_FLAG_WRITABLE)) in default_kstat_snapshot()
669 bcopy(buf, ksp->ks_data, ksp->ks_data_size); in default_kstat_snapshot()
682 namedsz = sizeof (kstat_named_t) * ksp->ks_ndata; in default_kstat_snapshot()
683 if (ksp->ks_type == KSTAT_TYPE_NAMED && ksp->ks_data_size > namedsz) in default_kstat_snapshot()
684 bcopy(ksp->ks_data, buf, namedsz); in default_kstat_snapshot()
686 bcopy(ksp->ks_data, buf, ksp->ks_data_size); in default_kstat_snapshot()
691 switch (ksp->ks_type) { in default_kstat_snapshot()
727 if (ksp->ks_data_size > namedsz) { in default_kstat_snapshot()
730 char *dst = (char *)(knp + ksp->ks_ndata); in default_kstat_snapshot()
734 for (i = 0; i < ksp->ks_ndata; i++, knp++) { in default_kstat_snapshot()
743 ASSERT(dst <= ((char *)buf + ksp->ks_data_size)); in default_kstat_snapshot()
808 system_misc_kstat_update(kstat_t *ksp, int rw) in system_misc_kstat_update() argument
874 system_pages_kstat_update(kstat_t *ksp, int rw) in system_pages_kstat_update() argument
949 kstat_t *ksp; in kstat_create_zone() local
1024 ksp = kstat_hold_byname(ks_module, ks_instance, ks_name, ks_zoneid); in kstat_create_zone()
1025 if (ksp != NULL) { in kstat_create_zone()
1026 if (!(ksp->ks_flags & KSTAT_FLAG_DORMANT)) { in kstat_create_zone()
1031 kstat_rele(ksp); in kstat_create_zone()
1037 if ((strcmp(ksp->ks_class, ks_class) != 0) || in kstat_create_zone()
1038 (ksp->ks_type != ks_type) || in kstat_create_zone()
1039 (ksp->ks_ndata != ks_ndata) || in kstat_create_zone()
1045 kstat_rele(ksp); in kstat_create_zone()
1055 ksp->ks_flags |= KSTAT_FLAG_INVALID; in kstat_create_zone()
1056 kstat_rele(ksp); in kstat_create_zone()
1057 return (ksp); in kstat_create_zone()
1083 ksp = &e->e_ks; in kstat_create_zone()
1084 ksp->ks_crtime = gethrtime(); in kstat_create_zone()
1085 kstat_set_string(ksp->ks_module, ks_module); in kstat_create_zone()
1086 ksp->ks_instance = ks_instance; in kstat_create_zone()
1087 kstat_set_string(ksp->ks_name, ks_name); in kstat_create_zone()
1088 ksp->ks_type = ks_type; in kstat_create_zone()
1089 kstat_set_string(ksp->ks_class, ks_class); in kstat_create_zone()
1090 ksp->ks_flags = ks_flags | KSTAT_FLAG_INVALID; in kstat_create_zone()
1092 ksp->ks_data = NULL; in kstat_create_zone()
1094 ksp->ks_data = (void *)(e + 1); in kstat_create_zone()
1095 ksp->ks_ndata = ks_ndata; in kstat_create_zone()
1096 ksp->ks_data_size = ks_data_size; in kstat_create_zone()
1097 ksp->ks_snaptime = ksp->ks_crtime; in kstat_create_zone()
1098 ksp->ks_update = default_kstat_update; in kstat_create_zone()
1099 ksp->ks_private = NULL; in kstat_create_zone()
1100 ksp->ks_snapshot = default_kstat_snapshot; in kstat_create_zone()
1101 ksp->ks_lock = NULL; in kstat_create_zone()
1122 ksp->ks_kid = kstat_chain_id++; in kstat_create_zone()
1128 return (ksp); in kstat_create_zone()
1135 kstat_install(kstat_t *ksp) in kstat_install() argument
1137 zoneid_t zoneid = ((ekstat_t *)ksp)->e_zone.zoneid; in kstat_install()
1143 if ((ksp->ks_flags & KSTAT_FLAG_VAR_SIZE) && ksp->ks_lock == NULL) { in kstat_install()
1146 ksp->ks_module, ksp->ks_instance, ksp->ks_name); in kstat_install()
1149 if (kstat_hold_bykid(ksp->ks_kid, zoneid) != ksp) { in kstat_install()
1151 (void *)ksp); in kstat_install()
1155 if (ksp->ks_type == KSTAT_TYPE_NAMED && ksp->ks_data != NULL) { in kstat_install()
1157 kstat_named_t *knp = KSTAT_NAMED_PTR(ksp); in kstat_install()
1159 for (i = 0; i < ksp->ks_ndata; i++, knp++) { in kstat_install()
1161 ksp->ks_flags |= KSTAT_FLAG_LONGSTRINGS; in kstat_install()
1169 if ((ksp->ks_flags & KSTAT_FLAG_LONGSTRINGS) && in kstat_install()
1170 (ksp->ks_flags & KSTAT_FLAG_WRITABLE) && in kstat_install()
1171 (ksp->ks_snapshot == default_kstat_snapshot)) { in kstat_install()
1175 ksp->ks_module, ksp->ks_instance, ksp->ks_name); in kstat_install()
1179 if (ksp->ks_flags & KSTAT_FLAG_DORMANT) { in kstat_install()
1187 kmutex_t *lp = ksp->ks_lock; in kstat_install()
1190 (void) KSTAT_UPDATE(ksp, KSTAT_WRITE); in kstat_install()
1193 (void) KSTAT_UPDATE(ksp, KSTAT_WRITE); in kstat_install()
1195 ksp->ks_flags &= ~KSTAT_FLAG_DORMANT; in kstat_install()
1208 ksp->ks_flags &= ~KSTAT_FLAG_INVALID; in kstat_install()
1210 kstat_rele(ksp); in kstat_install()
1218 kstat_delete(kstat_t *ksp) in kstat_delete() argument
1221 ekstat_t *e = (ekstat_t *)ksp; in kstat_delete()
1225 ASSERT(ksp != NULL); in kstat_delete()
1227 if (ksp == NULL) in kstat_delete()
1232 lp = ksp->ks_lock; in kstat_delete()
1236 (void *)ksp, (void *)lp); in kstat_delete()
1239 if (kstat_hold_bykid(ksp->ks_kid, zoneid) != ksp) { in kstat_delete()
1241 (void *)ksp); in kstat_delete()
1245 if (ksp->ks_flags & KSTAT_FLAG_PERSISTENT) { in kstat_delete()
1250 KSTAT_ENTER(ksp); in kstat_delete()
1251 (void) KSTAT_UPDATE(ksp, KSTAT_READ); in kstat_delete()
1252 KSTAT_EXIT(ksp); in kstat_delete()
1259 ksp->ks_flags |= KSTAT_FLAG_DORMANT; in kstat_delete()
1260 ksp->ks_lock = NULL; in kstat_delete()
1261 ksp->ks_update = default_kstat_update; in kstat_delete()
1262 ksp->ks_private = NULL; in kstat_delete()
1263 ksp->ks_snapshot = default_kstat_snapshot; in kstat_delete()
1264 kstat_rele(ksp); in kstat_delete()
1286 kstat_rele(ksp); in kstat_delete()
1294 kstat_t *ksp; in kstat_delete_byname_zone() local
1296 ksp = kstat_hold_byname(ks_module, ks_instance, ks_name, ks_zoneid); in kstat_delete_byname_zone()
1297 if (ksp != NULL) { in kstat_delete_byname_zone()
1298 kstat_rele(ksp); in kstat_delete_byname_zone()
1299 kstat_delete(ksp); in kstat_delete_byname_zone()