Lines Matching refs:nhdl

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