/*
* 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 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include <assert.h>
#include <errno.h>
#include <libsysevent.h>
#include <libnvpair.h>
#include <string.h>
#include <unistd.h>
#include "events.h"
#include "ncp.h"
#include "ncu.h"
#include "objects.h"
#include "util.h"
/*
* sysevent_events.c - this file contains routines to retrieve sysevents
* from the system and package them for high level processing.
*/
/*
* At present, we only handle EC_DEV_ADD/EC_DEV_REMOVE sysevents of
* For EC_DEV_ADD, we:
* - combine these to get interface name and create associated NCUs
* - enable those instances
* For EC_DEV_REMOVE, we:
*/
static void
{
char *driver;
return;
}
/*
* Retrieve driver name and instance attributes, and combine to
* get interface name.
*/
return;
}
"of attributes failed: %m");
return;
}
/* Ignore sysevent events for other zones */
return;
/* Create event for link */
if (link_event != NULL)
}
/* ARGSUSED0 */
static void *
{
do {
(void) sleep(1);
} while (sysevent_handle == NULL);
/*
* Subscribe to ESC_NETWORK subclass of EC_DEV_ADD and EC_DEV_REMOVE
* events. As a result, we get sysevent notification of hotplug
*/
!= 0 ||
1) != 0)
return (NULL);
}
/*
* We can't initialize in the main thread because we may need to wait until
* initialize in.
*/
void
{
int rc;
if (rc != 0) {
pfail("nwamd_sysevents_init: pthread_attr_init failed: %s",
}
if (rc != 0) {
pfail("nwamd_sysevents_init: pthread_attr_setdetachstate "
}
if (rc != 0) {
pfail("nwamd_sysevents_init: couldn't start sysevent init "
}
(void) pthread_attr_destroy(&attr);
}
void
{
if (sysevent_handle != NULL) {
}
}