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); }
void mdescplugin_init(void) { int status; status = ptree_get_root(&root_node); if (status != PICL_SUCCESS) { return; } mdp = mdesc_devinit(); if (mdp == NULL) return; /* * update the cpu configuration in case the snapshot cache used by the * devtree plugin is out of date. */ (void) update_devices(OBP_CPU, DEV_ADD); (void) update_devices(OBP_CPU, DEV_REMOVE); rootnode = md_root_node(mdp); /* * This is the start of the CPU property augmentation code. * add_cpu_prop and the rest of the CPU code lives in cpu_prop_update.c */ status = ptree_walk_tree_by_class(root_node, "cpu", NULL, add_cpu_prop); if (status != PICL_SUCCESS) { return; } signal_devtree(); (void) disk_discovery(); /* * register dsc_handler for both "sysevent-device-added" and * and for "sysevent-device-removed" PICL events */ (void) ptree_register_handler(PICLEVENT_SYSEVENT_DEVICE_ADDED, dsc_handler, NULL); (void) ptree_register_handler(PICLEVENT_SYSEVENT_DEVICE_REMOVED, dsc_handler, NULL); (void) ptree_register_handler(PICLEVENT_DR_AP_STATE_CHANGE, dr_handler, NULL); mdesc_devfini(mdp); }
/* * This function is the init entry point of the plugin. * It initializes the /frutree tree */ static void picl_frutree_init() { int err; err = add_all_nodes(); if (err != PICL_SUCCESS) { (void) remove_all_nodes(frutreeh); return; } /* Register the event handler routine */ (void) ptree_register_handler(PICLEVENT_SYSEVENT_DEVICE_ADDED, picl_frutree_evhandler, NULL); (void) ptree_register_handler(PICLEVENT_SYSEVENT_DEVICE_REMOVED, picl_frutree_evhandler, NULL); }
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); }