Пример #1
0
static void
piclsbl_init(void)
{
	char	platbuf[SYS_NMLN];

	/* check for Erie platform name */
	if ((sysinfo(SI_PLATFORM, platbuf, SYS_NMLN) != -1) &&
	    ((strcmp(platbuf, ERIE_PLATFORM) == 0) ||
	    (strcmp(platbuf, ERIE_PLATFORM2) == 0)))
		return;

	/* retrieve the root node for lookups in the event handler */
	if ((ptree_get_root(&root_node)) != NULL)
		return;

	/* load libpcp */
	if (load_pcp_libs()) {
		syslog(LOG_ERR, "piclsbl: failed to load libpcp");
		syslog(LOG_ERR, "piclsbl: aborting");
		return;
	}

	/*
	 * register piclsbl_handler for both "sysevent-device-added" and
	 * and for "sysevent-device-removed" PICL events
	 */
	(void) ptree_register_handler(PICLEVENT_SYSEVENT_DEVICE_ADDED,
	    piclsbl_handler, NULL);
	(void) ptree_register_handler(PICLEVENT_SYSEVENT_DEVICE_REMOVED,
	    piclsbl_handler, NULL);
}
Пример #2
0
static void
piclsbl_init(void)
{
	/* retrieve the root node for lookups in the event handler */
	if ((ptree_get_root(&root_node)) != NULL)
		return;

	/* load libpcp */
	if (load_pcp_libs()) {
		syslog(LOG_ERR, "piclsbl: failed to load libpcp");
		syslog(LOG_ERR, "piclsbl: aborting");
		return;
	}

	/*
	 * register piclsbl_handler for both "sysevent-device-added" and
	 * and for "sysevent-device-removed" PICL events
	 */
	(void) ptree_register_handler(PICLEVENT_SYSEVENT_DEVICE_ADDED,
	    piclsbl_handler, NULL);
	(void) ptree_register_handler(PICLEVENT_SYSEVENT_DEVICE_REMOVED,
	    piclsbl_handler, NULL);
}