9804 hal-set-property should support --direct option
[unleashed.git] / usr / src / cmd / power / pmconfig.h
blob839426b19a877b46cdb06fe6879cc6ebdb831cf9
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
19 * CDDL HEADER END
22 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
26 #ifndef _PMCONFIG_H
27 #define _PMCONFIG_H
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
33 #include <sys/types.h>
34 #include <sys/stat.h>
35 #include <sys/cpr.h>
36 #include <sys/pm.h>
37 #include <strings.h>
38 #include <limits.h>
39 #include <libintl.h>
40 #include <stdlib.h>
41 #include <unistd.h>
42 #include <stdio.h>
43 #include <fcntl.h>
44 #include <errno.h>
47 #define LINEARG(an) *(line_args + an)
48 #define LINELEN 80
49 #define MOREARGS 4
51 #define ESTAR_VNONE 0
52 #define ESTAR_V2 '2'
53 #define ESTAR_V3 '3'
55 #define LPAREN '('
56 #define RPAREN ')'
58 #define MDEBUG 0
59 #define MEXIT 1
60 #define MERR -1
63 * return values from handler routines;
64 * chosen to match syscall return values
66 #define NOUP -1
67 #define OKUP 0
69 #define DFLT_THOLD 0.04
72 struct perm_update {
73 int perm; /* cpr or pm permission */
74 int update; /* flag updates from cpr/pm data */
75 char *set; /* "cpr" or "pm" */
77 typedef struct perm_update prmup_t;
80 struct cinfo {
81 char *keyword; /* keyword string */
82 int (*handler)(void); /* keyword handler routine */
83 prmup_t *status; /* permission and update status */
84 char *cmt; /* config file comment */
85 short argc; /* config line arg count */
86 uint8_t any; /* 0: match argc, 1: at least argc */
87 uint8_t alt; /* conf line OK from an alt source */
89 typedef struct cinfo cinfo_t;
91 typedef void (*vact_t)(char *, size_t, cinfo_t *);
93 /* Suspend/Resume flags */
94 extern int whitelist_only;
95 extern int verify;
98 * "conf.c"
100 extern prmup_t cpr_status, pm_status;
101 extern struct cprconfig new_cc;
102 extern struct stat def_info;
103 extern char estar_vers;
104 extern int pm_fd, ua_err;
105 extern uid_t ruid;
106 extern int def_src;
107 extern void mesg(int, char *, ...);
110 * "parse.c"
112 extern int lineno;
113 extern char **line_args;
114 extern void lookup_estar_vers(void);
115 extern void lookup_perms(void);
116 extern void parse_conf_file(char *, vact_t, boolean_t);
119 * handlers.c
121 extern int S3_helper(char *, char *, int, int, char *, char *, int *, int);
122 extern int S3sup(void);
123 extern int autoS3(void);
124 extern int autopm(void);
125 extern int autosd(void);
126 extern int cpupm(void);
127 extern int cpuidle(void);
128 extern int cputhr(void);
129 extern int ddprop(void);
130 extern int devdep(void);
131 extern int devthr(void);
132 extern int dreads(void);
133 extern int idlechk(void);
134 extern int loadavg(void);
135 extern int nfsreq(void);
136 extern int sfpath(void);
137 extern int systhr(void);
138 extern int tchars(void);
140 #ifdef __cplusplus
142 #endif
144 #endif /* _PMCONFIG_H */