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 53028Smh27603 * Common Development and Distribution License (the "License"). 63028Smh27603 * 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 /* 228906SEric.Saxe@Sun.COM * Copyright 2009 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 #ifdef __cplusplus 300Sstevel@tonic-gate extern "C" { 310Sstevel@tonic-gate #endif 320Sstevel@tonic-gate 330Sstevel@tonic-gate #include <sys/types.h> 340Sstevel@tonic-gate #include <sys/stat.h> 350Sstevel@tonic-gate #include <sys/cpr.h> 360Sstevel@tonic-gate #include <sys/pm.h> 370Sstevel@tonic-gate #include <strings.h> 380Sstevel@tonic-gate #include <limits.h> 390Sstevel@tonic-gate #include <libintl.h> 400Sstevel@tonic-gate #include <stdlib.h> 410Sstevel@tonic-gate #include <unistd.h> 420Sstevel@tonic-gate #include <stdio.h> 430Sstevel@tonic-gate #include <fcntl.h> 440Sstevel@tonic-gate #include <errno.h> 450Sstevel@tonic-gate 460Sstevel@tonic-gate 470Sstevel@tonic-gate #define LINEARG(an) *(line_args + an) 480Sstevel@tonic-gate #define LINELEN 80 490Sstevel@tonic-gate #define MOREARGS 4 500Sstevel@tonic-gate 510Sstevel@tonic-gate #define ESTAR_VNONE 0 520Sstevel@tonic-gate #define ESTAR_V2 '2' 530Sstevel@tonic-gate #define ESTAR_V3 '3' 540Sstevel@tonic-gate 550Sstevel@tonic-gate #define LPAREN '(' 560Sstevel@tonic-gate #define RPAREN ')' 570Sstevel@tonic-gate 580Sstevel@tonic-gate #define MDEBUG 0 590Sstevel@tonic-gate #define MEXIT 1 600Sstevel@tonic-gate #define MERR -1 610Sstevel@tonic-gate 620Sstevel@tonic-gate /* 630Sstevel@tonic-gate * return values from handler routines; 640Sstevel@tonic-gate * chosen to match syscall return values 650Sstevel@tonic-gate */ 660Sstevel@tonic-gate #define NOUP -1 670Sstevel@tonic-gate #define OKUP 0 680Sstevel@tonic-gate 690Sstevel@tonic-gate #define DFLT_THOLD 0.04 700Sstevel@tonic-gate 710Sstevel@tonic-gate 720Sstevel@tonic-gate struct perm_update { 730Sstevel@tonic-gate int perm; /* cpr or pm permission */ 740Sstevel@tonic-gate int update; /* flag updates from cpr/pm data */ 750Sstevel@tonic-gate char *set; /* "cpr" or "pm" */ 760Sstevel@tonic-gate }; 770Sstevel@tonic-gate typedef struct perm_update prmup_t; 780Sstevel@tonic-gate 790Sstevel@tonic-gate 800Sstevel@tonic-gate struct cinfo { 810Sstevel@tonic-gate char *keyword; /* keyword string */ 820Sstevel@tonic-gate int (*handler)(void); /* keyword handler routine */ 830Sstevel@tonic-gate prmup_t *status; /* permission and update status */ 840Sstevel@tonic-gate char *cmt; /* config file comment */ 850Sstevel@tonic-gate short argc; /* config line arg count */ 860Sstevel@tonic-gate uint8_t any; /* 0: match argc, 1: at least argc */ 870Sstevel@tonic-gate uint8_t alt; /* conf line OK from an alt source */ 880Sstevel@tonic-gate }; 890Sstevel@tonic-gate typedef struct cinfo cinfo_t; 900Sstevel@tonic-gate 910Sstevel@tonic-gate typedef void (*vact_t)(char *, size_t, cinfo_t *); 920Sstevel@tonic-gate 935295Srandyf /* Suspend/Resume flags */ 945295Srandyf extern int whitelist_only; 955295Srandyf extern int verify; 960Sstevel@tonic-gate 970Sstevel@tonic-gate /* 980Sstevel@tonic-gate * "conf.c" 990Sstevel@tonic-gate */ 1000Sstevel@tonic-gate extern prmup_t cpr_status, pm_status; 1010Sstevel@tonic-gate extern struct cprconfig new_cc; 1020Sstevel@tonic-gate extern struct stat def_info; 1030Sstevel@tonic-gate extern char estar_vers; 1040Sstevel@tonic-gate extern int pm_fd, ua_err; 1050Sstevel@tonic-gate extern uid_t ruid; 1060Sstevel@tonic-gate extern int def_src; 1070Sstevel@tonic-gate extern void mesg(int, char *, ...); 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); 116*9057SSeth.Goldberg@Sun.COM extern void parse_conf_file(char *, vact_t, boolean_t); 1170Sstevel@tonic-gate 1180Sstevel@tonic-gate /* 1190Sstevel@tonic-gate * handlers.c 1200Sstevel@tonic-gate */ 1215295Srandyf extern int S3_helper(char *, char *, int, int, char *, char *, int *, int); 1225295Srandyf extern int S3sup(void); 1235295Srandyf extern int autoS3(void); 1240Sstevel@tonic-gate extern int autopm(void); 1250Sstevel@tonic-gate extern int autosd(void); 1263028Smh27603 extern int cpupm(void); 1278906SEric.Saxe@Sun.COM extern int cpuidle(void); 1283028Smh27603 extern int cputhr(void); 1290Sstevel@tonic-gate extern int ddprop(void); 1300Sstevel@tonic-gate extern int devdep(void); 1310Sstevel@tonic-gate extern int devthr(void); 1320Sstevel@tonic-gate extern int dreads(void); 1330Sstevel@tonic-gate extern int idlechk(void); 1340Sstevel@tonic-gate extern int loadavg(void); 1350Sstevel@tonic-gate extern int nfsreq(void); 1360Sstevel@tonic-gate extern int sfpath(void); 1370Sstevel@tonic-gate extern int systhr(void); 1380Sstevel@tonic-gate extern int tchars(void); 1390Sstevel@tonic-gate 1400Sstevel@tonic-gate #ifdef __cplusplus 1410Sstevel@tonic-gate } 1420Sstevel@tonic-gate #endif 1430Sstevel@tonic-gate 1440Sstevel@tonic-gate #endif /* _PMCONFIG_H */ 145