/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (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 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <signal.h>
#include <syslog.h>
#include <string.h>
#include <fcntl.h>
#include <errno.h>
#include <time.h>
#include <config_admin.h>
#include <libsysevent.h>
/* Signal handler type */
typedef void (SigHandler)(int);
/* oplhpd process id file descriptor */
static int pid_fd;
/* Program Name */
/* Macros */
/* Event handler to get information */
/*
* Function Prototypes
*/
void quit_daemon(int signo);
void init_daemon(void);
void oplhpd_init(void);
void oplhpd_fini(void);
/*
* Terminate and Quit Daemon Process.
* signo = 0 ... normal quit
* > 0 ... signaled quit
* < 0 ... failure quit
*/
void
{
int status = 0;
if (signo < 0) {
}
}
/*
* Setting the signal handler utility
*/
{
}
return (SIG_ERR);
}
return (oact.sa_handler);
}
/*
* Setup oplhpd daemon
*/
void
{
int i;
int ret;
int fd;
if (geteuid() != 0) {
exit(1);
}
/*
* Daemonize
*/
perror("fork failed");
exit(1);
}
if (pid > 0) {
/* Parent, exit. */
exit(0);
}
(void) setsid();
(void) chdir("/");
(void) umask(0);
(void) closefrom(0);
(void) dup(1);
/*
* Create the lock file for singletonize
*/
exit(1);
}
} else {
}
exit(1);
}
continue;
}
if (ret < 0) {
exit(1);
}
}
/*
* Set signal handlers
*/
}
static void
{
/*
* Inform the SCF of the change in the state of the pci hot plug
* cassette.
*/
}
/*
* Initialization for hotplug event.
* - Bind event handler.
* - Subscribe the handler to the hotplug event.
*/
void
{
if (oplhpd_hdl == NULL) {
quit_daemon(-1);
}
quit_daemon(-1);
}
for (;;) {
(void) pause();
}
}
void
{
if (oplhpd_hdl != NULL) {
}
}
int
{
int opt;
/* Get Program Name */
oplhpd_prog_name = argv[0];
} else {
}
/* Check the daemon running lock and Initialize the signal */
init_daemon();
/* Subscribe to the hotplug event */
oplhpd_init();
/* Unsubscribe the hotplug event */
oplhpd_fini();
return (0);
}