Lines Matching defs:nhdl

31 nd_cleanup(nd_hdl_t *nhdl)
33 nd_debug(nhdl, "Cleaning up ...");
34 if (nhdl->nh_evhdl)
35 (void) fmev_shdl_fini(nhdl->nh_evhdl);
37 if (nhdl->nh_msghdl)
38 fmd_msg_fini(nhdl->nh_msghdl);
40 nhdl->nh_keep_running = B_FALSE;
41 (void) fclose(nhdl->nh_log_fd);
58 nd_debug(nd_hdl_t *nhdl, const char *format, ...)
63 if (nhdl->nh_debug) {
65 (void) fprintf(nhdl->nh_log_fd, "[ %s ", timestamp);
67 (void) vfprintf(nhdl->nh_log_fd, format, ap);
69 (void) fprintf(nhdl->nh_log_fd, " ]\n");
71 (void) fflush(nhdl->nh_log_fd);
75 nd_dump_nvlist(nd_hdl_t *nhdl, nvlist_t *nvl)
77 if (nhdl->nh_debug)
78 nvlist_print(nhdl->nh_log_fd, nvl);
83 nd_error(nd_hdl_t *nhdl, const char *format, ...)
89 (void) fprintf(nhdl->nh_log_fd, "[ %s ", timestamp);
91 (void) vfprintf(nhdl->nh_log_fd, format, ap);
93 (void) fprintf(nhdl->nh_log_fd, " ]\n");
94 (void) fflush(nhdl->nh_log_fd);
99 nd_abort(nd_hdl_t *nhdl, const char *format, ...)
105 (void) fprintf(nhdl->nh_log_fd, "[ %s ", timestamp);
107 (void) vfprintf(nhdl->nh_log_fd, format, ap);
109 (void) fprintf(nhdl->nh_log_fd, " ]\n");
110 (void) fflush(nhdl->nh_log_fd);
111 nd_cleanup(nhdl);
115 nd_daemonize(nd_hdl_t *nhdl)
120 nd_abort(nhdl, "Failed to fork child (%s)", strerror(errno));
131 nhdl->nh_is_daemon = B_TRUE;
140 nd_get_pg(nd_hdl_t *nhdl, scf_handle_t *handle, const char *svcname,
152 nd_error(nhdl, "Failed to allocate libscf structures");
173 nd_get_astring_prop(nd_hdl_t *nhdl, const char *svcname, const char *pgname,
186 if ((pg = nd_get_pg(nhdl, handle, svcname, pgname)) == NULL) {
187 nd_error(nhdl, "Failed to read retrieve %s "
194 nd_error(nhdl, "Failed to allocate SMF structures");
200 nd_error(nhdl, "Failed to retrieve %s prop (%s)", propname,
217 nd_get_boolean_prop(nd_hdl_t *nhdl, const char *svcname, const char *pgname,
229 if ((pg = nd_get_pg(nhdl, handle, svcname, pgname)) == NULL) {
230 nd_error(nhdl, "Failed to read retrieve %s "
237 nd_error(nhdl, "Failed to allocate SMF structures");
243 nd_error(nhdl, "Failed to retrieve %s prop (%s)", propname,
259 nd_get_event_fmri(nd_hdl_t *nhdl, fmev_t ev)
265 nd_error(nhdl, "Failed to lookup event attr nvlist");
270 nd_error(nhdl, "Malformed event 0x%p", (void *)ev_nvl);
278 nd_get_notify_prefs(nd_hdl_t *nhdl, const char *mech, fmev_t ev,
286 nd_error(nhdl, "Failed to lookup event attr nvlist");
293 nd_debug(nhdl, "No notification preferences specified "
297 nd_error(nhdl, "Error looking up notification "
299 nd_dump_nvlist(nhdl, top_nvl);
306 nd_error(nhdl, "Malformed nvlist");
307 nd_dump_nvlist(nhdl, top_nvl);
322 nd_debug(nhdl, "No %s notification preferences specified",
350 nd_split_list(nd_hdl_t *nhdl, char *list, char *delim, char ***arr,
363 nd_error(nhdl, "Error allocating memory (%s)", strerror(errno));
387 nd_merge_strarray(nd_hdl_t *nhdl, char **arr1, uint_t n1, char **arr2,
404 nd_error(nhdl, "Error allocating memory (%s)", strerror(errno));
431 nd_join_strarray(nd_hdl_t *nhdl, char **arr, uint_t arrsz, char **buf)
445 nd_error(nhdl, "Error allocating memory (%s)", strerror(errno));
472 nd_get_diagcode(nd_hdl_t *nhdl, const char *dict, const char *class, char *buf,
481 dlen = (strlen(nhdl->nh_rootdir) + strlen(ND_DICTDIR) + 2);
483 (void) snprintf(dirpath, dlen, "%s/%s", nhdl->nh_rootdir, ND_DICTDIR);
486 nd_error(nhdl, "fm_dc_opendict failed for %s/%s",
494 nd_error(nhdl, "fm_dc_key2code failed for %s", key[0]);
511 nd_get_event_info(nd_hdl_t *nhdl, const char *class, fmev_t ev,
519 nd_error(nhdl, "Failed to allocate memory");
541 nd_get_diagcode(nhdl, "SMF", class, evi->ei_diagcode, 32)
543 evi->ei_severity = fmd_msg_getitem_id(nhdl->nh_msghdl,
545 evi->ei_descr = fmd_msg_getitem_id(nhdl->nh_msghdl,
547 evi->ei_url = fmd_msg_getitem_id(nhdl->nh_msghdl,
564 nd_error(nhdl, "Malformed event");
565 nd_dump_nvlist(nhdl, evi->ei_payload);
571 if ((fmri = nd_get_event_fmri(nhdl, ev)) == NULL) {
572 nd_error(nhdl, "Failed to get fmri from event payload");
580 nd_error(nhdl, "Malformed event");
581 nd_dump_nvlist(nhdl, evi->ei_payload);