17c478bd9Sstevel@tonic-gate /* 27c478bd9Sstevel@tonic-gate * CDDL HEADER START 37c478bd9Sstevel@tonic-gate * 47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*c42872d4Smh27603 * Common Development and Distribution License (the "License"). 6*c42872d4Smh27603 * You may not use this file except in compliance with the License. 77c478bd9Sstevel@tonic-gate * 87c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 97c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 107c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 117c478bd9Sstevel@tonic-gate * and limitations under the License. 127c478bd9Sstevel@tonic-gate * 137c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 147c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 157c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 167c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 177c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 187c478bd9Sstevel@tonic-gate * 197c478bd9Sstevel@tonic-gate * CDDL HEADER END 207c478bd9Sstevel@tonic-gate */ 217c478bd9Sstevel@tonic-gate /* 22*c42872d4Smh27603 * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 237c478bd9Sstevel@tonic-gate * Use is subject to license terms. 247c478bd9Sstevel@tonic-gate */ 257c478bd9Sstevel@tonic-gate 267c478bd9Sstevel@tonic-gate #ifndef _PMCONFIG_H 277c478bd9Sstevel@tonic-gate #define _PMCONFIG_H 287c478bd9Sstevel@tonic-gate 297c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 307c478bd9Sstevel@tonic-gate 317c478bd9Sstevel@tonic-gate #ifdef __cplusplus 327c478bd9Sstevel@tonic-gate extern "C" { 337c478bd9Sstevel@tonic-gate #endif 347c478bd9Sstevel@tonic-gate 357c478bd9Sstevel@tonic-gate #include <sys/types.h> 367c478bd9Sstevel@tonic-gate #include <sys/stat.h> 377c478bd9Sstevel@tonic-gate #include <sys/cpr.h> 387c478bd9Sstevel@tonic-gate #include <sys/pm.h> 397c478bd9Sstevel@tonic-gate #include <strings.h> 407c478bd9Sstevel@tonic-gate #include <limits.h> 417c478bd9Sstevel@tonic-gate #include <libintl.h> 427c478bd9Sstevel@tonic-gate #include <stdlib.h> 437c478bd9Sstevel@tonic-gate #include <unistd.h> 447c478bd9Sstevel@tonic-gate #include <stdio.h> 457c478bd9Sstevel@tonic-gate #include <fcntl.h> 467c478bd9Sstevel@tonic-gate #include <errno.h> 477c478bd9Sstevel@tonic-gate 487c478bd9Sstevel@tonic-gate 497c478bd9Sstevel@tonic-gate #define LINEARG(an) *(line_args + an) 507c478bd9Sstevel@tonic-gate #define LINELEN 80 517c478bd9Sstevel@tonic-gate #define MOREARGS 4 527c478bd9Sstevel@tonic-gate 537c478bd9Sstevel@tonic-gate #define ESTAR_VNONE 0 547c478bd9Sstevel@tonic-gate #define ESTAR_V2 '2' 557c478bd9Sstevel@tonic-gate #define ESTAR_V3 '3' 567c478bd9Sstevel@tonic-gate 577c478bd9Sstevel@tonic-gate #define LPAREN '(' 587c478bd9Sstevel@tonic-gate #define RPAREN ')' 597c478bd9Sstevel@tonic-gate 607c478bd9Sstevel@tonic-gate #define MDEBUG 0 617c478bd9Sstevel@tonic-gate #define MEXIT 1 627c478bd9Sstevel@tonic-gate #define MERR -1 637c478bd9Sstevel@tonic-gate 647c478bd9Sstevel@tonic-gate /* 657c478bd9Sstevel@tonic-gate * return values from handler routines; 667c478bd9Sstevel@tonic-gate * chosen to match syscall return values 677c478bd9Sstevel@tonic-gate */ 687c478bd9Sstevel@tonic-gate #define NOUP -1 697c478bd9Sstevel@tonic-gate #define OKUP 0 707c478bd9Sstevel@tonic-gate 717c478bd9Sstevel@tonic-gate #define DFLT_THOLD 0.04 727c478bd9Sstevel@tonic-gate 737c478bd9Sstevel@tonic-gate 747c478bd9Sstevel@tonic-gate struct perm_update { 757c478bd9Sstevel@tonic-gate int perm; /* cpr or pm permission */ 767c478bd9Sstevel@tonic-gate int update; /* flag updates from cpr/pm data */ 777c478bd9Sstevel@tonic-gate char *set; /* "cpr" or "pm" */ 787c478bd9Sstevel@tonic-gate }; 797c478bd9Sstevel@tonic-gate typedef struct perm_update prmup_t; 807c478bd9Sstevel@tonic-gate 817c478bd9Sstevel@tonic-gate 827c478bd9Sstevel@tonic-gate struct cinfo { 837c478bd9Sstevel@tonic-gate char *keyword; /* keyword string */ 847c478bd9Sstevel@tonic-gate int (*handler)(void); /* keyword handler routine */ 857c478bd9Sstevel@tonic-gate prmup_t *status; /* permission and update status */ 867c478bd9Sstevel@tonic-gate char *cmt; /* config file comment */ 877c478bd9Sstevel@tonic-gate short argc; /* config line arg count */ 887c478bd9Sstevel@tonic-gate uint8_t any; /* 0: match argc, 1: at least argc */ 897c478bd9Sstevel@tonic-gate uint8_t alt; /* conf line OK from an alt source */ 907c478bd9Sstevel@tonic-gate }; 917c478bd9Sstevel@tonic-gate typedef struct cinfo cinfo_t; 927c478bd9Sstevel@tonic-gate 937c478bd9Sstevel@tonic-gate typedef void (*vact_t)(char *, size_t, cinfo_t *); 947c478bd9Sstevel@tonic-gate 957c478bd9Sstevel@tonic-gate 967c478bd9Sstevel@tonic-gate /* 977c478bd9Sstevel@tonic-gate * "conf.c" 987c478bd9Sstevel@tonic-gate */ 997c478bd9Sstevel@tonic-gate extern prmup_t cpr_status, pm_status; 1007c478bd9Sstevel@tonic-gate extern struct cprconfig new_cc; 1017c478bd9Sstevel@tonic-gate extern struct stat def_info; 1027c478bd9Sstevel@tonic-gate extern char estar_vers; 1037c478bd9Sstevel@tonic-gate extern int pm_fd, ua_err; 1047c478bd9Sstevel@tonic-gate extern uid_t ruid; 1057c478bd9Sstevel@tonic-gate extern int def_src; 1067c478bd9Sstevel@tonic-gate extern void mesg(int, char *, ...); 1077c478bd9Sstevel@tonic-gate 1087c478bd9Sstevel@tonic-gate 1097c478bd9Sstevel@tonic-gate /* 1107c478bd9Sstevel@tonic-gate * "parse.c" 1117c478bd9Sstevel@tonic-gate */ 1127c478bd9Sstevel@tonic-gate extern int lineno; 1137c478bd9Sstevel@tonic-gate extern char **line_args; 1147c478bd9Sstevel@tonic-gate extern void lookup_estar_vers(void); 1157c478bd9Sstevel@tonic-gate extern void lookup_perms(void); 1167c478bd9Sstevel@tonic-gate extern void parse_conf_file(char *, vact_t); 1177c478bd9Sstevel@tonic-gate 1187c478bd9Sstevel@tonic-gate /* 1197c478bd9Sstevel@tonic-gate * handlers.c 1207c478bd9Sstevel@tonic-gate */ 1217c478bd9Sstevel@tonic-gate extern int autopm(void); 1227c478bd9Sstevel@tonic-gate extern int autosd(void); 123*c42872d4Smh27603 extern int cpupm(void); 124*c42872d4Smh27603 extern int cputhr(void); 1257c478bd9Sstevel@tonic-gate extern int ddprop(void); 1267c478bd9Sstevel@tonic-gate extern int devdep(void); 1277c478bd9Sstevel@tonic-gate extern int devthr(void); 1287c478bd9Sstevel@tonic-gate extern int dreads(void); 1297c478bd9Sstevel@tonic-gate extern int idlechk(void); 1307c478bd9Sstevel@tonic-gate extern int loadavg(void); 1317c478bd9Sstevel@tonic-gate extern int nfsreq(void); 1327c478bd9Sstevel@tonic-gate extern int sfpath(void); 1337c478bd9Sstevel@tonic-gate extern int systhr(void); 1347c478bd9Sstevel@tonic-gate extern int tchars(void); 1357c478bd9Sstevel@tonic-gate 1367c478bd9Sstevel@tonic-gate #ifdef __cplusplus 1377c478bd9Sstevel@tonic-gate } 1387c478bd9Sstevel@tonic-gate #endif 1397c478bd9Sstevel@tonic-gate 1407c478bd9Sstevel@tonic-gate #endif /* _PMCONFIG_H */ 141