/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <unistd.h>
#include <picl.h>
#include <picltree.h>
#include <picldefs.h>
#include <pthread.h>
#include <syslog.h>
#include <string.h>
#include <libnvpair.h>
#include <libintl.h>
#include "piclenvmond.h"
/* external funcs and varaibles */
extern void env_handle_event(const char *, const void *, size_t);
extern picl_errno_t env_init();
extern void env_platmod_fini();
extern int sensor_fd;
extern pthread_t env_temp_thr_tid;
/* local defines */
#pragma init(piclenvmond_register)
/*
* Plugin registration entry points
*/
static void piclenvmond_register(void);
static void piclenvmond_init(void);
static void piclenvmond_fini(void);
static void piclenvmond_evhandler(const char *, const void *, size_t, void *);
"SUNW_piclenvmond",
};
typedef struct {
/*
* picld entry points
*/
static void
piclenvmond_register(void)
{
(void) picld_plugin_register(&envmond_reg_info);
}
/*
* picld entry point
* - do all the initialization
* - register for interested picl events
*/
static void
piclenvmond_init(void)
{
"error = %d"), rc);
return;
}
/* register handler for state change events */
/* register handler for condition change events */
}
static void
piclenvmond_fini(void)
{
void *exitval;
/* unregister event handler */
/* cancel all the threads */
(void) pthread_cancel(env_temp_thr_tid);
/* do any platform specific cleanups required */
}
/*ARGSUSED*/
static void
void *cookie)
{
}
/*
* Utility functions
*/
/*
* create_property -- Create a PICL property
*/
int (*readfn)(ptree_rarg_t *, void *),
int (*writefn)(ptree_warg_t *, const void *),
{
return (rc);
}
if (rc != PICL_SUCCESS) {
return (rc);
}
if (rc != PICL_SUCCESS) {
return (rc);
}
return (PICL_SUCCESS);
}
/*
* The picl event completion handler.
*/
/* ARGSUSED */
static void
{
}
/*
* utility routine to post PICL events
*/
/*ARGSUSED*/
static int
{
char *evname;
if (nodeh == 0) {
return (PICL_FAILURE);
}
return (PICL_FAILURE);
if (envl) {
return (PICL_FAILURE);
}
} else {
return (PICL_FAILURE);
}
}
return (PICL_FAILURE);
}
return (PICL_FAILURE);
}
}
event_completion_handler) != 0) {
" event."), ename);
return (PICL_FAILURE);
}
return (PICL_SUCCESS);
}
/*
* post dr_req events
*/
{
if (fruh == 0) {
return (PICL_INVALIDARG);
}
return (rc);
}
return (PICL_FAILURE);
}
return (PICL_FAILURE);
}
== -1) {
return (PICL_FAILURE);
}
return (PICL_FAILURE);
}
wait);
return (rc);
}
/*
* routine to post dr_ap_state change events
*/
{
if (nodehdl == 0) {
return (PICL_FAILURE);
}
return (rc);
}
return (PICL_FAILURE);
}
return (PICL_FAILURE);
}
return (PICL_FAILURE);
}
return (PICL_FAILURE);
}
return (rc);
}
{
if (fruh == 0) {
return (PICL_FAILURE);
}
return (PICL_FAILURE);
return (PICL_FAILURE);
}
event_type) == -1) {
return (PICL_FAILURE);
}
return (PICL_FAILURE);
}
return (rc);
}
int
{
if (hdl == 0)
return (PICL_FAILURE);
return (PICL_FAILURE);
sensor_evalue) == -1) {
return (PICL_FAILURE);
}
return (PICL_FAILURE);
}
sizeof (dr_ap_id)) == PICL_SUCCESS)
dr_ap_id);
}
return (rc);
}
/*
* return B_TRUE if admin lock is enabled
* return B_FALSE if admin lock is disabled
*/
{
!= PICL_SUCCESS) {
return (B_FALSE);
}
return (B_TRUE);
}
return (B_FALSE);
}