10Sstevel@tonic-gate /* 20Sstevel@tonic-gate * CDDL HEADER START 30Sstevel@tonic-gate * 40Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*3028Smh27603 * Common Development and Distribution License (the "License"). 6*3028Smh27603 * You may not use this file except in compliance with the License. 70Sstevel@tonic-gate * 80Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 90Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 100Sstevel@tonic-gate * See the License for the specific language governing permissions 110Sstevel@tonic-gate * and limitations under the License. 120Sstevel@tonic-gate * 130Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 140Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 150Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 160Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 170Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 180Sstevel@tonic-gate * 190Sstevel@tonic-gate * CDDL HEADER END 200Sstevel@tonic-gate */ 210Sstevel@tonic-gate /* 22*3028Smh27603 * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 230Sstevel@tonic-gate * Use is subject to license terms. 240Sstevel@tonic-gate */ 250Sstevel@tonic-gate 260Sstevel@tonic-gate #ifndef _PMCONFIG_H 270Sstevel@tonic-gate #define _PMCONFIG_H 280Sstevel@tonic-gate 290Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 300Sstevel@tonic-gate 310Sstevel@tonic-gate #ifdef __cplusplus 320Sstevel@tonic-gate extern "C" { 330Sstevel@tonic-gate #endif 340Sstevel@tonic-gate 350Sstevel@tonic-gate #include <sys/types.h> 360Sstevel@tonic-gate #include <sys/stat.h> 370Sstevel@tonic-gate #include <sys/cpr.h> 380Sstevel@tonic-gate #include <sys/pm.h> 390Sstevel@tonic-gate #include <strings.h> 400Sstevel@tonic-gate #include <limits.h> 410Sstevel@tonic-gate #include <libintl.h> 420Sstevel@tonic-gate #include <stdlib.h> 430Sstevel@tonic-gate #include <unistd.h> 440Sstevel@tonic-gate #include <stdio.h> 450Sstevel@tonic-gate #include <fcntl.h> 460Sstevel@tonic-gate #include <errno.h> 470Sstevel@tonic-gate 480Sstevel@tonic-gate 490Sstevel@tonic-gate #define LINEARG(an) *(line_args + an) 500Sstevel@tonic-gate #define LINELEN 80 510Sstevel@tonic-gate #define MOREARGS 4 520Sstevel@tonic-gate 530Sstevel@tonic-gate #define ESTAR_VNONE 0 540Sstevel@tonic-gate #define ESTAR_V2 '2' 550Sstevel@tonic-gate #define ESTAR_V3 '3' 560Sstevel@tonic-gate 570Sstevel@tonic-gate #define LPAREN '(' 580Sstevel@tonic-gate #define RPAREN ')' 590Sstevel@tonic-gate 600Sstevel@tonic-gate #define MDEBUG 0 610Sstevel@tonic-gate #define MEXIT 1 620Sstevel@tonic-gate #define MERR -1 630Sstevel@tonic-gate 640Sstevel@tonic-gate /* 650Sstevel@tonic-gate * return values from handler routines; 660Sstevel@tonic-gate * chosen to match syscall return values 670Sstevel@tonic-gate */ 680Sstevel@tonic-gate #define NOUP -1 690Sstevel@tonic-gate #define OKUP 0 700Sstevel@tonic-gate 710Sstevel@tonic-gate #define DFLT_THOLD 0.04 720Sstevel@tonic-gate 730Sstevel@tonic-gate 740Sstevel@tonic-gate struct perm_update { 750Sstevel@tonic-gate int perm; /* cpr or pm permission */ 760Sstevel@tonic-gate int update; /* flag updates from cpr/pm data */ 770Sstevel@tonic-gate char *set; /* "cpr" or "pm" */ 780Sstevel@tonic-gate }; 790Sstevel@tonic-gate typedef struct perm_update prmup_t; 800Sstevel@tonic-gate 810Sstevel@tonic-gate 820Sstevel@tonic-gate struct cinfo { 830Sstevel@tonic-gate char *keyword; /* keyword string */ 840Sstevel@tonic-gate int (*handler)(void); /* keyword handler routine */ 850Sstevel@tonic-gate prmup_t *status; /* permission and update status */ 860Sstevel@tonic-gate char *cmt; /* config file comment */ 870Sstevel@tonic-gate short argc; /* config line arg count */ 880Sstevel@tonic-gate uint8_t any; /* 0: match argc, 1: at least argc */ 890Sstevel@tonic-gate uint8_t alt; /* conf line OK from an alt source */ 900Sstevel@tonic-gate }; 910Sstevel@tonic-gate typedef struct cinfo cinfo_t; 920Sstevel@tonic-gate 930Sstevel@tonic-gate typedef void (*vact_t)(char *, size_t, cinfo_t *); 940Sstevel@tonic-gate 950Sstevel@tonic-gate 960Sstevel@tonic-gate /* 970Sstevel@tonic-gate * "conf.c" 980Sstevel@tonic-gate */ 990Sstevel@tonic-gate extern prmup_t cpr_status, pm_status; 1000Sstevel@tonic-gate extern struct cprconfig new_cc; 1010Sstevel@tonic-gate extern struct stat def_info; 1020Sstevel@tonic-gate extern char estar_vers; 1030Sstevel@tonic-gate extern int pm_fd, ua_err; 1040Sstevel@tonic-gate extern uid_t ruid; 1050Sstevel@tonic-gate extern int def_src; 1060Sstevel@tonic-gate extern void mesg(int, char *, ...); 1070Sstevel@tonic-gate 1080Sstevel@tonic-gate 1090Sstevel@tonic-gate /* 1100Sstevel@tonic-gate * "parse.c" 1110Sstevel@tonic-gate */ 1120Sstevel@tonic-gate extern int lineno; 1130Sstevel@tonic-gate extern char **line_args; 1140Sstevel@tonic-gate extern void lookup_estar_vers(void); 1150Sstevel@tonic-gate extern void lookup_perms(void); 1160Sstevel@tonic-gate extern void parse_conf_file(char *, vact_t); 1170Sstevel@tonic-gate 1180Sstevel@tonic-gate /* 1190Sstevel@tonic-gate * handlers.c 1200Sstevel@tonic-gate */ 1210Sstevel@tonic-gate extern int autopm(void); 1220Sstevel@tonic-gate extern int autosd(void); 123*3028Smh27603 extern int cpupm(void); 124*3028Smh27603 extern int cputhr(void); 1250Sstevel@tonic-gate extern int ddprop(void); 1260Sstevel@tonic-gate extern int devdep(void); 1270Sstevel@tonic-gate extern int devthr(void); 1280Sstevel@tonic-gate extern int dreads(void); 1290Sstevel@tonic-gate extern int idlechk(void); 1300Sstevel@tonic-gate extern int loadavg(void); 1310Sstevel@tonic-gate extern int nfsreq(void); 1320Sstevel@tonic-gate extern int sfpath(void); 1330Sstevel@tonic-gate extern int systhr(void); 1340Sstevel@tonic-gate extern int tchars(void); 1350Sstevel@tonic-gate 1360Sstevel@tonic-gate #ifdef __cplusplus 1370Sstevel@tonic-gate } 1380Sstevel@tonic-gate #endif 1390Sstevel@tonic-gate 1400Sstevel@tonic-gate #endif /* _PMCONFIG_H */ 141