/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
*/
/*
* This program is strictly for demonstration purposes and not for
* production use. It demonstrates how to access the dynamic memory
* caching statistics and turning variables via the kstat library.
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <stropts.h>
#include <ctype.h>
#include <unistd.h>
#include <memory.h>
#include <string.h>
#include <fcntl.h>
#include <errno.h>
#include <signal.h>
#include <locale.h>
#include <kstat.h>
#define FALSE 0
typedef struct {
int instance;
typedef struct {
char *named;
int newval;
typedef enum {
MONITOR = 0,
SEC1,
SEC2,
SEC3,
CAND,
} arglist_id;
};
/*
* Print Usage
*/
static void
{
(void) printf("USAGE: wake - wakeup thread, hys - max hysteresis\n");
(void) printf(" mon 1 - monitor shutdown\n");
(void) printf(" 2 - monitor thread stats1\n");
(void) printf(" 4 - monitor thread stats2\n");
(void) printf(" age1 n - num cyc to full host aging and "
"dealloc\n");
(void) printf(" age2 n - num cyc to full meta aging and "
"dealloc\n");
(void) printf(" age3 n - num cyc to full one pg aging and "
"dealloc\n");
(void) printf(" sec1 n - sec1 aging time\n");
(void) printf(" sec2 n - sec2 aging time\n");
(void) printf(" sec3 n - sec3 aging time\n");
(void) printf(" hdpcnt n - max percent of cents for holds\n");
(void) printf(" list n - host+pest max len\n");
(void) printf("No Args - print current settings only\n");
}
/*
* Main
*/
/* ARGSUSED */
#ifdef lint
int
#else
int
#endif
{
int val;
/*
* grab and parse argument list
*/
while (*pargs) {
pargs++;
print_usage();
return (0);
}
continue;
}
continue;
}
val);
pargs++;
}
val);
pargs++;
}
val);
pargs++;
}
val);
pargs++;
}
val);
pargs++;
if (val == 0)
break;
else {
continue;
}
}
pargs++;
val);
if (val == 0)
break;
else {
continue;
}
}
pargs++;
val);
if (val == 0)
break;
else {
continue;
}
}
pargs++;
val);
if (val == 0)
break;
else {
continue;
}
}
pargs++;
val);
if (val == 0)
break;
else {
continue;
}
}
pargs++;
val);
if (val < 0)
break;
else {
continue;
}
}
pargs++;
val);
if (val == 0)
break;
else {
continue;
}
}
} /* while(*pargs && cl) */
/*
* open the kstat library
*/
kctl = kstat_open();
(void) printf("kstat_open() failed\n");
return (1);
}
/*
* is the name module about
*/
(void) printf("No module to report\n");
return (1);
}
/*
* using the info get a copy of the data
*/
(void) printf("Can't read kstat\n");
return (1);
}
/*
* print the current data
*/
while (p_dynmem_knp->named) {
p_dynmem_knp->knp =
(void) printf("kstat_data_lookup(%s) failed\n",
return (1);
} else {
p_dynmem_knp++;
}
}
/*
* modify the data and write it back
*/
while (p_dynmem_knp->named) {
p_dynmem_knp++;
}
(void) printf("kstat_write() failed\n");
return (1);
}
(void) printf("Finished (h for help)\n");
return (0);
}