1fcf3ce44SJohn Forte /* 2fcf3ce44SJohn Forte * CDDL HEADER START 3fcf3ce44SJohn Forte * 4fcf3ce44SJohn Forte * The contents of this file are subject to the terms of the 5fcf3ce44SJohn Forte * Common Development and Distribution License (the "License"). 6fcf3ce44SJohn Forte * You may not use this file except in compliance with the License. 7fcf3ce44SJohn Forte * 8fcf3ce44SJohn Forte * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9fcf3ce44SJohn Forte * or http://www.opensolaris.org/os/licensing. 10fcf3ce44SJohn Forte * See the License for the specific language governing permissions 11fcf3ce44SJohn Forte * and limitations under the License. 12fcf3ce44SJohn Forte * 13fcf3ce44SJohn Forte * When distributing Covered Code, include this CDDL HEADER in each 14fcf3ce44SJohn Forte * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15fcf3ce44SJohn Forte * If applicable, add the following below this CDDL HEADER, with the 16fcf3ce44SJohn Forte * fields enclosed by brackets "[]" replaced with your own identifying 17fcf3ce44SJohn Forte * information: Portions Copyright [yyyy] [name of copyright owner] 18fcf3ce44SJohn Forte * 19fcf3ce44SJohn Forte * CDDL HEADER END 20fcf3ce44SJohn Forte */ 21fcf3ce44SJohn Forte /* 22*44c4f64bSJohn Levon * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. 23fcf3ce44SJohn Forte */ 24fcf3ce44SJohn Forte 25fcf3ce44SJohn Forte /* 26fcf3ce44SJohn Forte * This program is strictly for demonstration purposes and not for 27fcf3ce44SJohn Forte * production use. It demonstrates how to access the dynamic memory 28fcf3ce44SJohn Forte * caching statistics and turning variables via the kstat library. 29fcf3ce44SJohn Forte */ 30fcf3ce44SJohn Forte 31fcf3ce44SJohn Forte #include <stdio.h> 32fcf3ce44SJohn Forte #include <stdlib.h> 33fcf3ce44SJohn Forte #include <stdarg.h> 34fcf3ce44SJohn Forte #include <stropts.h> 35fcf3ce44SJohn Forte #include <ctype.h> 36fcf3ce44SJohn Forte #include <unistd.h> 37fcf3ce44SJohn Forte #include <memory.h> 38fcf3ce44SJohn Forte #include <string.h> 39fcf3ce44SJohn Forte #include <fcntl.h> 40fcf3ce44SJohn Forte #include <errno.h> 41fcf3ce44SJohn Forte #include <signal.h> 42fcf3ce44SJohn Forte #include <locale.h> 43fcf3ce44SJohn Forte #include <kstat.h> 44fcf3ce44SJohn Forte 45fcf3ce44SJohn Forte #include <sys/types.h> 46fcf3ce44SJohn Forte #include <sys/time.h> 47fcf3ce44SJohn Forte #include <sys/sysinfo.h> 48fcf3ce44SJohn Forte #include <sys/buf.h> 49fcf3ce44SJohn Forte #include <sys/vfs.h> 50fcf3ce44SJohn Forte #include <sys/dnlc.h> 51fcf3ce44SJohn Forte 52fcf3ce44SJohn Forte #define TRUE 1 53fcf3ce44SJohn Forte #define FALSE 0 54fcf3ce44SJohn Forte #define SDBC_KSTAT_MODULE "sdbc" 55fcf3ce44SJohn Forte #define SDBC_KSTAT_DYNMEM "dynmem" 56fcf3ce44SJohn Forte 57fcf3ce44SJohn Forte typedef struct { 58fcf3ce44SJohn Forte int instance; 59fcf3ce44SJohn Forte kstat_t *ksp; 60fcf3ce44SJohn Forte } KSTAT_INFO_DEF; 61fcf3ce44SJohn Forte 62fcf3ce44SJohn Forte typedef struct { 63fcf3ce44SJohn Forte kstat_named_t *knp; 64fcf3ce44SJohn Forte char *named; 65fcf3ce44SJohn Forte int newval; 66fcf3ce44SJohn Forte } DYNMEM_KNP_DEFN; 67fcf3ce44SJohn Forte 68fcf3ce44SJohn Forte typedef enum { 69fcf3ce44SJohn Forte MONITOR = 0, 70fcf3ce44SJohn Forte MAXLIST, 71fcf3ce44SJohn Forte AGECT1, 72fcf3ce44SJohn Forte AGECT2, 73fcf3ce44SJohn Forte AGECT3, 74fcf3ce44SJohn Forte SEC1, 75fcf3ce44SJohn Forte SEC2, 76fcf3ce44SJohn Forte SEC3, 77fcf3ce44SJohn Forte PCNT1, 78fcf3ce44SJohn Forte PCNT2, 79fcf3ce44SJohn Forte HDPCNT, 80fcf3ce44SJohn Forte ALLOC, 81fcf3ce44SJohn Forte DEALLOC, 82fcf3ce44SJohn Forte HISTORY, 83fcf3ce44SJohn Forte NODATA, 84fcf3ce44SJohn Forte CAND, 85fcf3ce44SJohn Forte DEALLOCS, 86fcf3ce44SJohn Forte HOSTS, 87fcf3ce44SJohn Forte PESTS, 88fcf3ce44SJohn Forte METAS, 89fcf3ce44SJohn Forte HOLDS, 90fcf3ce44SJohn Forte OTHERS, 91fcf3ce44SJohn Forte NOTAVAIL, 92fcf3ce44SJohn Forte DIRECTIVE, 93fcf3ce44SJohn Forte SIMPLECT 94fcf3ce44SJohn Forte } arglist_id; 95fcf3ce44SJohn Forte 96fcf3ce44SJohn Forte #define NO_VALUE -1 97fcf3ce44SJohn Forte 98fcf3ce44SJohn Forte DYNMEM_KNP_DEFN dynmem_knp[] = { 99fcf3ce44SJohn Forte NULL, "sdbc_monitor_dynmem", NO_VALUE, 100fcf3ce44SJohn Forte NULL, "sdbc_max_dyn_list", NO_VALUE, 101fcf3ce44SJohn Forte NULL, "sdbc_cache_aging_ct1", NO_VALUE, 102fcf3ce44SJohn Forte NULL, "sdbc_cache_aging_ct2", NO_VALUE, 103fcf3ce44SJohn Forte NULL, "sdbc_cache_aging_ct3", NO_VALUE, 104fcf3ce44SJohn Forte NULL, "sdbc_cache_aging_sec1", NO_VALUE, 105fcf3ce44SJohn Forte NULL, "sdbc_cache_aging_sec2", NO_VALUE, 106fcf3ce44SJohn Forte NULL, "sdbc_cache_aging_sec3", NO_VALUE, 107fcf3ce44SJohn Forte NULL, "sdbc_cache_aging_pcnt1", NO_VALUE, 108fcf3ce44SJohn Forte NULL, "sdbc_cache_aging_pcnt2", NO_VALUE, 109fcf3ce44SJohn Forte NULL, "sdbc_max_holds_pcnt", NO_VALUE, 110fcf3ce44SJohn Forte NULL, "sdbc_alloc_cnt", NO_VALUE, 111fcf3ce44SJohn Forte NULL, "sdbc_dealloc_cnt", NO_VALUE, 112fcf3ce44SJohn Forte NULL, "sdbc_history", NO_VALUE, 113fcf3ce44SJohn Forte NULL, "sdbc_nodatas", NO_VALUE, 114fcf3ce44SJohn Forte NULL, "sdbc_candidates", NO_VALUE, 115fcf3ce44SJohn Forte NULL, "sdbc_deallocs", NO_VALUE, 116fcf3ce44SJohn Forte NULL, "sdbc_hosts", NO_VALUE, 117fcf3ce44SJohn Forte NULL, "sdbc_pests", NO_VALUE, 118fcf3ce44SJohn Forte NULL, "sdbc_metas", NO_VALUE, 119fcf3ce44SJohn Forte NULL, "sdbc_holds", NO_VALUE, 120fcf3ce44SJohn Forte NULL, "sdbc_others", NO_VALUE, 121fcf3ce44SJohn Forte NULL, "sdbc_notavail", NO_VALUE, 122fcf3ce44SJohn Forte NULL, "sdbc_process_directive", NO_VALUE, 123fcf3ce44SJohn Forte NULL, "sdbc_simplect", NO_VALUE, 124fcf3ce44SJohn Forte NULL, NULL, NO_VALUE 125fcf3ce44SJohn Forte }; 126fcf3ce44SJohn Forte 127fcf3ce44SJohn Forte /* 128fcf3ce44SJohn Forte * Print Usage 129fcf3ce44SJohn Forte */ 130fcf3ce44SJohn Forte static void 131fcf3ce44SJohn Forte print_usage() 132fcf3ce44SJohn Forte { 133fcf3ce44SJohn Forte (void) printf("USAGE: wake - wakeup thread, hys - max hysteresis\n"); 134fcf3ce44SJohn Forte (void) printf(" mon 1 - monitor shutdown\n"); 135fcf3ce44SJohn Forte (void) printf(" 2 - monitor thread stats1\n"); 136fcf3ce44SJohn Forte (void) printf(" 4 - monitor thread stats2\n"); 137fcf3ce44SJohn Forte (void) printf(" age1 n - num cyc to full host aging and " 138fcf3ce44SJohn Forte "dealloc\n"); 139fcf3ce44SJohn Forte (void) printf(" age2 n - num cyc to full meta aging and " 140fcf3ce44SJohn Forte "dealloc\n"); 141fcf3ce44SJohn Forte (void) printf(" age3 n - num cyc to full one pg aging and " 142fcf3ce44SJohn Forte "dealloc\n"); 143fcf3ce44SJohn Forte (void) printf(" sec1 n - sec1 aging time\n"); 144fcf3ce44SJohn Forte (void) printf(" sec2 n - sec2 aging time\n"); 145fcf3ce44SJohn Forte (void) printf(" sec3 n - sec3 aging time\n"); 146fcf3ce44SJohn Forte (void) printf(" pcnt1 n - percent to sec1/sec2 trans\n"); 147fcf3ce44SJohn Forte (void) printf(" pcnt2 n - percent to sec2/sec3 trans\n"); 148fcf3ce44SJohn Forte (void) printf(" hdpcnt n - max percent of cents for holds\n"); 149fcf3ce44SJohn Forte (void) printf(" list n - host+pest max len\n"); 150fcf3ce44SJohn Forte (void) printf("No Args - print current settings only\n"); 151fcf3ce44SJohn Forte } 152fcf3ce44SJohn Forte 153fcf3ce44SJohn Forte /* 154fcf3ce44SJohn Forte * Main 155fcf3ce44SJohn Forte */ 156fcf3ce44SJohn Forte /* ARGSUSED */ 157fcf3ce44SJohn Forte #ifdef lint 158fcf3ce44SJohn Forte int 159fcf3ce44SJohn Forte sd_dynmem_lintmain(int argc, char *argv[]) 160fcf3ce44SJohn Forte #else 161fcf3ce44SJohn Forte int 162fcf3ce44SJohn Forte main(int argc, char *argv[]) 163fcf3ce44SJohn Forte #endif 164fcf3ce44SJohn Forte { 165fcf3ce44SJohn Forte DYNMEM_KNP_DEFN *p_dynmem_knp; 166fcf3ce44SJohn Forte kstat_ctl_t *kctl; 167fcf3ce44SJohn Forte KSTAT_INFO_DEF info_ksp; 168fcf3ce44SJohn Forte int val; 169fcf3ce44SJohn Forte char **pargs, **cur_pargs; 170fcf3ce44SJohn Forte 171fcf3ce44SJohn Forte /* 172fcf3ce44SJohn Forte * grab and parse argument list 173fcf3ce44SJohn Forte */ 174fcf3ce44SJohn Forte p_dynmem_knp = dynmem_knp; 175fcf3ce44SJohn Forte pargs = argv; 176fcf3ce44SJohn Forte while (*pargs) { 177fcf3ce44SJohn Forte (void) printf("pargs=%x - %s\n", (uint_t)pargs, *pargs); 178fcf3ce44SJohn Forte 179fcf3ce44SJohn Forte cur_pargs = pargs; 180fcf3ce44SJohn Forte pargs++; 181fcf3ce44SJohn Forte 182fcf3ce44SJohn Forte if (strcmp(*cur_pargs, "h") == 0) { 183fcf3ce44SJohn Forte print_usage(); 184fcf3ce44SJohn Forte return (0); 185fcf3ce44SJohn Forte } 186fcf3ce44SJohn Forte 187fcf3ce44SJohn Forte if (strcmp(*cur_pargs, "wake") == 0) { 188fcf3ce44SJohn Forte if ((p_dynmem_knp+DIRECTIVE)->newval == NO_VALUE) 189fcf3ce44SJohn Forte (p_dynmem_knp+DIRECTIVE)->newval = 0; 190fcf3ce44SJohn Forte (p_dynmem_knp+DIRECTIVE)->newval |= 0x01; 191fcf3ce44SJohn Forte continue; 192fcf3ce44SJohn Forte } 193fcf3ce44SJohn Forte 194fcf3ce44SJohn Forte if (strcmp(*cur_pargs, "hys") == 0) { 195fcf3ce44SJohn Forte if ((p_dynmem_knp+DIRECTIVE)->newval == NO_VALUE) 196fcf3ce44SJohn Forte (p_dynmem_knp+DIRECTIVE)->newval = 0; 197fcf3ce44SJohn Forte (p_dynmem_knp+DIRECTIVE)->newval |= 0x02; 198fcf3ce44SJohn Forte continue; 199fcf3ce44SJohn Forte } 200fcf3ce44SJohn Forte 201fcf3ce44SJohn Forte if (strcmp (*cur_pargs, "mon") == 0) { 202fcf3ce44SJohn Forte val = atoi(*pargs); 203fcf3ce44SJohn Forte (void) printf("errno=%x, %s=%x\n", errno, *cur_pargs, 204fcf3ce44SJohn Forte val); 205fcf3ce44SJohn Forte pargs++; 206fcf3ce44SJohn Forte (p_dynmem_knp+MONITOR)->newval = val; 207fcf3ce44SJohn Forte } 208fcf3ce44SJohn Forte 209fcf3ce44SJohn Forte if (strcmp (*cur_pargs, "age1") == 0) { 210fcf3ce44SJohn Forte val = atoi(*pargs); 211fcf3ce44SJohn Forte (void) printf("errno=%x, %s=%x\n", errno, *cur_pargs, 212fcf3ce44SJohn Forte val); 213fcf3ce44SJohn Forte pargs++; 214fcf3ce44SJohn Forte (p_dynmem_knp+AGECT1)->newval = val; 215fcf3ce44SJohn Forte } 216fcf3ce44SJohn Forte 217fcf3ce44SJohn Forte if (strcmp(*cur_pargs, "age2") == 0) { 218fcf3ce44SJohn Forte val = atoi(*pargs); 219fcf3ce44SJohn Forte (void) printf("errno=%x, %s=%x\n", errno, *cur_pargs, 220fcf3ce44SJohn Forte val); 221fcf3ce44SJohn Forte pargs++; 222fcf3ce44SJohn Forte (p_dynmem_knp+AGECT2)->newval = val; 223fcf3ce44SJohn Forte } 224fcf3ce44SJohn Forte 225fcf3ce44SJohn Forte if (strcmp(*cur_pargs, "age3") == 0) { 226fcf3ce44SJohn Forte val = atoi(*pargs); 227fcf3ce44SJohn Forte (void) printf("errno=%x, %s=%x\n", errno, *cur_pargs, 228fcf3ce44SJohn Forte val); 229fcf3ce44SJohn Forte pargs++; 230fcf3ce44SJohn Forte (p_dynmem_knp+AGECT3)->newval = val; 231fcf3ce44SJohn Forte } 232fcf3ce44SJohn Forte 233fcf3ce44SJohn Forte if (strcmp (*cur_pargs, "sec1") == 0) { 234fcf3ce44SJohn Forte val = atoi(*pargs); 235fcf3ce44SJohn Forte (void) printf("errno=%x, %s=%x\n", errno, *cur_pargs, 236fcf3ce44SJohn Forte val); 237fcf3ce44SJohn Forte pargs++; 238fcf3ce44SJohn Forte if (val == 0) 239fcf3ce44SJohn Forte break; 240fcf3ce44SJohn Forte else { 241fcf3ce44SJohn Forte (p_dynmem_knp+SEC1)->newval = val; 242fcf3ce44SJohn Forte continue; 243fcf3ce44SJohn Forte } 244fcf3ce44SJohn Forte } 245fcf3ce44SJohn Forte 246fcf3ce44SJohn Forte if (strcmp(*cur_pargs, "sec2") == 0) { 247fcf3ce44SJohn Forte val = atoi(*pargs); 248fcf3ce44SJohn Forte pargs++; 249fcf3ce44SJohn Forte (void) printf("errno=%x, %s=%x\n", errno, *cur_pargs, 250fcf3ce44SJohn Forte val); 251fcf3ce44SJohn Forte if (val == 0) 252fcf3ce44SJohn Forte break; 253fcf3ce44SJohn Forte else { 254fcf3ce44SJohn Forte (p_dynmem_knp+SEC2)->newval = val; 255fcf3ce44SJohn Forte continue; 256fcf3ce44SJohn Forte } 257fcf3ce44SJohn Forte } 258fcf3ce44SJohn Forte 259fcf3ce44SJohn Forte if (strcmp(*cur_pargs, "sec3") == 0) { 260fcf3ce44SJohn Forte val = atoi(*pargs); 261fcf3ce44SJohn Forte pargs++; 262fcf3ce44SJohn Forte (void) printf("errno=%x, %s=%x\n", errno, *cur_pargs, 263fcf3ce44SJohn Forte val); 264fcf3ce44SJohn Forte if (val == 0) 265fcf3ce44SJohn Forte break; 266fcf3ce44SJohn Forte else { 267fcf3ce44SJohn Forte (p_dynmem_knp+SEC3)->newval = val; 268fcf3ce44SJohn Forte continue; 269fcf3ce44SJohn Forte } 270fcf3ce44SJohn Forte } 271fcf3ce44SJohn Forte 272fcf3ce44SJohn Forte if (strcmp(*cur_pargs, "pcnt1") == 0) { 273fcf3ce44SJohn Forte val = atoi(*pargs); 274fcf3ce44SJohn Forte pargs++; 275fcf3ce44SJohn Forte (void) printf("errno=%x, %s=%x\n", errno, *cur_pargs, 276fcf3ce44SJohn Forte val); 277fcf3ce44SJohn Forte if (val == 0) 278fcf3ce44SJohn Forte break; 279fcf3ce44SJohn Forte else { 280fcf3ce44SJohn Forte (p_dynmem_knp+PCNT1)->newval = val; 281fcf3ce44SJohn Forte continue; 282fcf3ce44SJohn Forte } 283fcf3ce44SJohn Forte } 284fcf3ce44SJohn Forte 285fcf3ce44SJohn Forte if (strcmp(*cur_pargs, "pcnt2") == 0) { 286fcf3ce44SJohn Forte val = atoi(*pargs); 287fcf3ce44SJohn Forte pargs++; 288fcf3ce44SJohn Forte (void) printf("errno=%x, %s=%x\n", errno, *cur_pargs, 289fcf3ce44SJohn Forte val); 290fcf3ce44SJohn Forte if (val == 0) 291fcf3ce44SJohn Forte break; 292fcf3ce44SJohn Forte else { 293fcf3ce44SJohn Forte (p_dynmem_knp+PCNT2)->newval = val; 294fcf3ce44SJohn Forte continue; 295fcf3ce44SJohn Forte } 296fcf3ce44SJohn Forte } 297fcf3ce44SJohn Forte 298fcf3ce44SJohn Forte if (strcmp(*cur_pargs, "hdpcnt") == 0) { 299fcf3ce44SJohn Forte val = atoi(*pargs); 300fcf3ce44SJohn Forte pargs++; 301fcf3ce44SJohn Forte (void) printf("errno=%x, %s=%x\n", errno, *cur_pargs, 302fcf3ce44SJohn Forte val); 303fcf3ce44SJohn Forte if (val < 0) 304fcf3ce44SJohn Forte break; 305fcf3ce44SJohn Forte else { 306fcf3ce44SJohn Forte (p_dynmem_knp+HDPCNT)->newval = val; 307fcf3ce44SJohn Forte continue; 308fcf3ce44SJohn Forte } 309fcf3ce44SJohn Forte } 310fcf3ce44SJohn Forte 311fcf3ce44SJohn Forte if (strcmp(*cur_pargs, "list") == 0) { 312fcf3ce44SJohn Forte val = atoi(*pargs); 313fcf3ce44SJohn Forte pargs++; 314fcf3ce44SJohn Forte (void) printf("errno=%x, %s=%x\n", errno, *cur_pargs, 315fcf3ce44SJohn Forte val); 316fcf3ce44SJohn Forte if (val == 0) 317fcf3ce44SJohn Forte break; 318fcf3ce44SJohn Forte else { 319fcf3ce44SJohn Forte (p_dynmem_knp+MAXLIST)->newval = val; 320fcf3ce44SJohn Forte continue; 321fcf3ce44SJohn Forte } 322fcf3ce44SJohn Forte } 323fcf3ce44SJohn Forte } /* while(*pargs && cl) */ 324fcf3ce44SJohn Forte 325fcf3ce44SJohn Forte /* 326fcf3ce44SJohn Forte * open the kstat library 327fcf3ce44SJohn Forte */ 328fcf3ce44SJohn Forte kctl = kstat_open(); 329fcf3ce44SJohn Forte if (kctl == NULL) { 330fcf3ce44SJohn Forte (void) printf("kstat_open() failed\n"); 331fcf3ce44SJohn Forte return (1); 332fcf3ce44SJohn Forte } 333fcf3ce44SJohn Forte 334fcf3ce44SJohn Forte /* 335fcf3ce44SJohn Forte * is the name module about 336fcf3ce44SJohn Forte */ 337fcf3ce44SJohn Forte info_ksp.instance = 0; 338fcf3ce44SJohn Forte info_ksp.ksp = kstat_lookup(kctl, SDBC_KSTAT_MODULE, 0, 339fcf3ce44SJohn Forte SDBC_KSTAT_DYNMEM); 340fcf3ce44SJohn Forte if (info_ksp.ksp == NULL) { 341fcf3ce44SJohn Forte (void) printf("No module to report\n"); 342fcf3ce44SJohn Forte return (1); 343fcf3ce44SJohn Forte } 344fcf3ce44SJohn Forte 345fcf3ce44SJohn Forte /* 346fcf3ce44SJohn Forte * using the info get a copy of the data 347fcf3ce44SJohn Forte */ 348fcf3ce44SJohn Forte if (kstat_read(kctl, info_ksp.ksp, NULL) == -1) { 349fcf3ce44SJohn Forte (void) printf("Can't read kstat\n"); 350fcf3ce44SJohn Forte return (1); 351fcf3ce44SJohn Forte } 352fcf3ce44SJohn Forte 353fcf3ce44SJohn Forte /* 354fcf3ce44SJohn Forte * print the current data 355fcf3ce44SJohn Forte */ 356fcf3ce44SJohn Forte p_dynmem_knp = dynmem_knp; 357fcf3ce44SJohn Forte while (p_dynmem_knp->named) { 358fcf3ce44SJohn Forte p_dynmem_knp->knp = 359fcf3ce44SJohn Forte kstat_data_lookup(info_ksp.ksp, p_dynmem_knp->named); 360fcf3ce44SJohn Forte if (p_dynmem_knp->knp == NULL) { 361fcf3ce44SJohn Forte (void) printf("kstat_data_lookup(%s) failed\n", 362fcf3ce44SJohn Forte p_dynmem_knp->named); 363fcf3ce44SJohn Forte return (1); 364fcf3ce44SJohn Forte } else { 365fcf3ce44SJohn Forte (void) printf("%s: %x\n", p_dynmem_knp->named, 366fcf3ce44SJohn Forte (uint_t)p_dynmem_knp->knp->value.ul); 367fcf3ce44SJohn Forte p_dynmem_knp++; 368fcf3ce44SJohn Forte } 369fcf3ce44SJohn Forte } 370fcf3ce44SJohn Forte 371fcf3ce44SJohn Forte /* 372fcf3ce44SJohn Forte * modify the data and write it back 373fcf3ce44SJohn Forte */ 374fcf3ce44SJohn Forte p_dynmem_knp = dynmem_knp; 375fcf3ce44SJohn Forte while (p_dynmem_knp->named) { 376fcf3ce44SJohn Forte if (p_dynmem_knp->newval != NO_VALUE) 377fcf3ce44SJohn Forte p_dynmem_knp->knp->value.ul = p_dynmem_knp->newval; 378fcf3ce44SJohn Forte p_dynmem_knp++; 379fcf3ce44SJohn Forte } 380fcf3ce44SJohn Forte 381fcf3ce44SJohn Forte if (kstat_write(kctl, info_ksp.ksp, NULL) == -1) { 382fcf3ce44SJohn Forte (void) printf("kstat_write() failed\n"); 383fcf3ce44SJohn Forte return (1); 384fcf3ce44SJohn Forte } 385fcf3ce44SJohn Forte 386fcf3ce44SJohn Forte (void) printf("Finished (h for help)\n"); 387fcf3ce44SJohn Forte return (0); 388fcf3ce44SJohn Forte } 389