xref: /titanic_52/usr/src/cmd/power/pmconfig.h (revision 731682d81d6004ade5d139920d1186cdccaa5418)
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
5c42872d4Smh27603  * Common Development and Distribution License (the "License").
6c42872d4Smh27603  * 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 /*
220e751525SEric Saxe  * Copyright 2009 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 #ifdef	__cplusplus
307c478bd9Sstevel@tonic-gate extern "C" {
317c478bd9Sstevel@tonic-gate #endif
327c478bd9Sstevel@tonic-gate 
337c478bd9Sstevel@tonic-gate #include <sys/types.h>
347c478bd9Sstevel@tonic-gate #include <sys/stat.h>
357c478bd9Sstevel@tonic-gate #include <sys/cpr.h>
367c478bd9Sstevel@tonic-gate #include <sys/pm.h>
377c478bd9Sstevel@tonic-gate #include <strings.h>
387c478bd9Sstevel@tonic-gate #include <limits.h>
397c478bd9Sstevel@tonic-gate #include <libintl.h>
407c478bd9Sstevel@tonic-gate #include <stdlib.h>
417c478bd9Sstevel@tonic-gate #include <unistd.h>
427c478bd9Sstevel@tonic-gate #include <stdio.h>
437c478bd9Sstevel@tonic-gate #include <fcntl.h>
447c478bd9Sstevel@tonic-gate #include <errno.h>
457c478bd9Sstevel@tonic-gate 
467c478bd9Sstevel@tonic-gate 
477c478bd9Sstevel@tonic-gate #define	LINEARG(an)		*(line_args + an)
487c478bd9Sstevel@tonic-gate #define	LINELEN			80
497c478bd9Sstevel@tonic-gate #define	MOREARGS		4
507c478bd9Sstevel@tonic-gate 
517c478bd9Sstevel@tonic-gate #define	ESTAR_VNONE		0
527c478bd9Sstevel@tonic-gate #define	ESTAR_V2		'2'
537c478bd9Sstevel@tonic-gate #define	ESTAR_V3		'3'
547c478bd9Sstevel@tonic-gate 
557c478bd9Sstevel@tonic-gate #define	LPAREN			'('
567c478bd9Sstevel@tonic-gate #define	RPAREN			')'
577c478bd9Sstevel@tonic-gate 
587c478bd9Sstevel@tonic-gate #define	MDEBUG			0
597c478bd9Sstevel@tonic-gate #define	MEXIT			1
607c478bd9Sstevel@tonic-gate #define	MERR			-1
617c478bd9Sstevel@tonic-gate 
627c478bd9Sstevel@tonic-gate /*
637c478bd9Sstevel@tonic-gate  * return values from handler routines;
647c478bd9Sstevel@tonic-gate  * chosen to match syscall return values
657c478bd9Sstevel@tonic-gate  */
667c478bd9Sstevel@tonic-gate #define	NOUP			-1
677c478bd9Sstevel@tonic-gate #define	OKUP			0
687c478bd9Sstevel@tonic-gate 
697c478bd9Sstevel@tonic-gate #define	DFLT_THOLD		0.04
707c478bd9Sstevel@tonic-gate 
717c478bd9Sstevel@tonic-gate 
727c478bd9Sstevel@tonic-gate struct perm_update {
737c478bd9Sstevel@tonic-gate 	int	perm;			/* cpr or pm permission */
747c478bd9Sstevel@tonic-gate 	int	update;			/* flag updates from cpr/pm data */
757c478bd9Sstevel@tonic-gate 	char	*set;			/* "cpr" or "pm" */
767c478bd9Sstevel@tonic-gate };
777c478bd9Sstevel@tonic-gate typedef struct perm_update prmup_t;
787c478bd9Sstevel@tonic-gate 
797c478bd9Sstevel@tonic-gate 
807c478bd9Sstevel@tonic-gate struct cinfo {
817c478bd9Sstevel@tonic-gate 	char	*keyword;		/* keyword string */
827c478bd9Sstevel@tonic-gate 	int	(*handler)(void);	/* keyword handler routine */
837c478bd9Sstevel@tonic-gate 	prmup_t	*status;		/* permission and update status */
847c478bd9Sstevel@tonic-gate 	char	*cmt;			/* config file comment */
857c478bd9Sstevel@tonic-gate 	short	argc;			/* config line arg count */
867c478bd9Sstevel@tonic-gate 	uint8_t	any;			/* 0: match argc, 1: at least argc */
877c478bd9Sstevel@tonic-gate 	uint8_t	alt;			/* conf line OK from an alt source */
887c478bd9Sstevel@tonic-gate };
897c478bd9Sstevel@tonic-gate typedef struct cinfo cinfo_t;
907c478bd9Sstevel@tonic-gate 
917c478bd9Sstevel@tonic-gate typedef void (*vact_t)(char *, size_t, cinfo_t *);
927c478bd9Sstevel@tonic-gate 
932df1fe9cSrandyf /* Suspend/Resume flags */
942df1fe9cSrandyf extern int whitelist_only;
952df1fe9cSrandyf extern int verify;
967c478bd9Sstevel@tonic-gate 
977c478bd9Sstevel@tonic-gate /*
987c478bd9Sstevel@tonic-gate  * "conf.c"
997c478bd9Sstevel@tonic-gate  */
1007c478bd9Sstevel@tonic-gate extern prmup_t cpr_status, pm_status;
1017c478bd9Sstevel@tonic-gate extern struct cprconfig new_cc;
1027c478bd9Sstevel@tonic-gate extern struct stat def_info;
1037c478bd9Sstevel@tonic-gate extern char estar_vers;
1047c478bd9Sstevel@tonic-gate extern int pm_fd, ua_err;
1057c478bd9Sstevel@tonic-gate extern uid_t ruid;
1067c478bd9Sstevel@tonic-gate extern int def_src;
1077c478bd9Sstevel@tonic-gate extern void mesg(int, char *, ...);
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);
116*731682d8SSeth Goldberg extern void parse_conf_file(char *, vact_t, boolean_t);
1177c478bd9Sstevel@tonic-gate 
1187c478bd9Sstevel@tonic-gate /*
1197c478bd9Sstevel@tonic-gate  * handlers.c
1207c478bd9Sstevel@tonic-gate  */
1212df1fe9cSrandyf extern int S3_helper(char *, char *, int, int, char *, char *, int *, int);
1222df1fe9cSrandyf extern int S3sup(void);
1232df1fe9cSrandyf extern int autoS3(void);
1247c478bd9Sstevel@tonic-gate extern int autopm(void);
1257c478bd9Sstevel@tonic-gate extern int autosd(void);
126c42872d4Smh27603 extern int cpupm(void);
1270e751525SEric Saxe extern int cpuidle(void);
128c42872d4Smh27603 extern int cputhr(void);
1297c478bd9Sstevel@tonic-gate extern int ddprop(void);
1307c478bd9Sstevel@tonic-gate extern int devdep(void);
1317c478bd9Sstevel@tonic-gate extern int devthr(void);
1327c478bd9Sstevel@tonic-gate extern int dreads(void);
1337c478bd9Sstevel@tonic-gate extern int idlechk(void);
1347c478bd9Sstevel@tonic-gate extern int loadavg(void);
1357c478bd9Sstevel@tonic-gate extern int nfsreq(void);
1367c478bd9Sstevel@tonic-gate extern int sfpath(void);
1377c478bd9Sstevel@tonic-gate extern int systhr(void);
1387c478bd9Sstevel@tonic-gate extern int tchars(void);
1397c478bd9Sstevel@tonic-gate 
1407c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
1417c478bd9Sstevel@tonic-gate }
1427c478bd9Sstevel@tonic-gate #endif
1437c478bd9Sstevel@tonic-gate 
1447c478bd9Sstevel@tonic-gate #endif	/* _PMCONFIG_H */
145