Lines Matching refs:ihdl

66 #define	IHDL2HDL(ihdl)	((fmev_shdl_t)(ihdl))  argument
69 #define FMEV_SHDL_VALID(ihdl) ((ihdl)->sh_cmn.hc_magic == _FMEV_SHMAGIC) argument
99 shdlctl_start(fmev_shdl_impl_t *ihdl) in shdlctl_start() argument
101 (void) pthread_mutex_lock(&ihdl->sh_lock); in shdlctl_start()
103 if (ihdl->sh_subcnt == 0) { in shdlctl_start()
106 (void) pthread_mutex_unlock(&ihdl->sh_lock); in shdlctl_start()
112 shdlctl_end(fmev_shdl_impl_t *ihdl) in shdlctl_end() argument
114 (void) pthread_mutex_unlock(&ihdl->sh_lock); in shdlctl_end()
120 fmev_shdl_impl_t *ihdl = HDL2IHDL(hdl); in fmev_shdlctl_serialize() local
125 if (!shdlctl_start(ihdl)) in fmev_shdlctl_serialize()
128 if (!(ihdl->sh_flags & SHDL_FL_SERIALIZE)) { in fmev_shdlctl_serialize()
129 (void) pthread_mutex_init(&ihdl->sh_srlz_lock, NULL); in fmev_shdlctl_serialize()
130 ihdl->sh_flags |= SHDL_FL_SERIALIZE; in fmev_shdlctl_serialize()
133 shdlctl_end(ihdl); in fmev_shdlctl_serialize()
140 fmev_shdl_impl_t *ihdl = HDL2IHDL(hdl); in fmev_shdlctl_thrattr() local
145 if (!shdlctl_start(ihdl)) in fmev_shdlctl_thrattr()
148 sysevent_subattr_thrattr(ihdl->sh_attr, attr); in fmev_shdlctl_thrattr()
150 shdlctl_end(ihdl); in fmev_shdlctl_thrattr()
157 fmev_shdl_impl_t *ihdl = HDL2IHDL(hdl); in fmev_shdlctl_sigmask() local
162 if (!shdlctl_start(ihdl)) in fmev_shdlctl_sigmask()
165 sysevent_subattr_sigmask(ihdl->sh_attr, set); in fmev_shdlctl_sigmask()
167 shdlctl_end(ihdl); in fmev_shdlctl_sigmask()
175 fmev_shdl_impl_t *ihdl = HDL2IHDL(hdl); in fmev_shdlctl_thrsetup() local
180 if (!shdlctl_start(ihdl)) in fmev_shdlctl_thrsetup()
183 sysevent_subattr_thrsetup(ihdl->sh_attr, func, cookie); in fmev_shdlctl_thrsetup()
185 shdlctl_end(ihdl); in fmev_shdlctl_thrsetup()
193 fmev_shdl_impl_t *ihdl = HDL2IHDL(hdl); in fmev_shdlctl_thrcreate() local
198 if (!shdlctl_start(ihdl)) in fmev_shdlctl_thrcreate()
201 sysevent_subattr_thrcreate(ihdl->sh_attr, func, cookie); in fmev_shdlctl_thrcreate()
203 shdlctl_end(ihdl); in fmev_shdlctl_thrcreate()
218 fmev_shdl_impl_t *ihdl = sip->si_ihdl; in fmev_proxy_cb() local
223 if ((ev = fmev_sysev2fmev(IHDL2HDL(ihdl), sep, &class, &nvl)) == NULL) { in fmev_proxy_cb()
228 if (ihdl->sh_flags & SHDL_FL_SERIALIZE) in fmev_proxy_cb()
229 (void) pthread_mutex_lock(&ihdl->sh_srlz_lock); in fmev_proxy_cb()
233 if (ihdl->sh_flags & SHDL_FL_SERIALIZE) in fmev_proxy_cb()
234 (void) pthread_mutex_unlock(&ihdl->sh_srlz_lock); in fmev_proxy_cb()
247 fmev_shdl_impl_t *ihdl = HDL2IHDL(hdl); in fmev_shdl_subscribe() local
273 uu_avl_node_init(sip, &sip->si_node, ihdl->sh_pool); in fmev_shdl_subscribe()
275 (void) pthread_mutex_lock(&ihdl->sh_lock); in fmev_shdl_subscribe()
277 if (uu_avl_find(ihdl->sh_avl, sip, NULL, &idx) != NULL) { in fmev_shdl_subscribe()
278 (void) pthread_mutex_unlock(&ihdl->sh_lock); in fmev_shdl_subscribe()
292 sip->si_ihdl = ihdl; in fmev_shdl_subscribe()
296 if ((serr = sysevent_evc_xsubscribe(ihdl->sh_binding, sip->si_sid, in fmev_shdl_subscribe()
297 sip->si_pat, fmev_proxy_cb, sip, 0, ihdl->sh_attr)) != 0) { in fmev_shdl_subscribe()
300 (void) pthread_mutex_unlock(&ihdl->sh_lock); in fmev_shdl_subscribe()
316 uu_avl_insert(ihdl->sh_avl, sip, idx); in fmev_shdl_subscribe()
317 ihdl->sh_subcnt++; in fmev_shdl_subscribe()
319 (void) pthread_mutex_unlock(&ihdl->sh_lock); in fmev_shdl_subscribe()
325 fmev_subinfo_fini(fmev_shdl_impl_t *ihdl, struct fmev_subinfo *sip, in fmev_subinfo_fini() argument
330 ASSERT(sip->si_ihdl == ihdl); in fmev_subinfo_fini()
332 err = sysevent_evc_unsubscribe(ihdl->sh_binding, sip->si_sid); in fmev_subinfo_fini()
336 uu_avl_remove(ihdl->sh_avl, sip); in fmev_subinfo_fini()
337 uu_avl_node_fini(sip, &sip->si_node, ihdl->sh_pool); in fmev_subinfo_fini()
339 fmev_shdl_free(IHDL2HDL(ihdl), sip, sizeof (*sip)); in fmev_subinfo_fini()
340 ihdl->sh_subcnt--; in fmev_subinfo_fini()
349 fmev_shdl_impl_t *ihdl = HDL2IHDL(hdl); in fmev_shdl_unsubscribe() local
367 (void) pthread_mutex_lock(&ihdl->sh_lock); in fmev_shdl_unsubscribe()
369 if ((sip = uu_avl_find(ihdl->sh_avl, &si, NULL, NULL)) != NULL) { in fmev_shdl_unsubscribe()
370 if ((err = fmev_subinfo_fini(ihdl, sip, B_TRUE)) == 0) { in fmev_shdl_unsubscribe()
382 (void) pthread_mutex_unlock(&ihdl->sh_lock); in fmev_shdl_unsubscribe()
390 fmev_shdl_impl_t *ihdl = HDL2IHDL(hdl); in fmev_shdl_alloc() local
395 return (ihdl->sh_cmn.hc_alloc(sz)); in fmev_shdl_alloc()
401 fmev_shdl_impl_t *ihdl = HDL2IHDL(hdl); in fmev_shdl_zalloc() local
406 return (ihdl->sh_cmn.hc_zalloc(sz)); in fmev_shdl_zalloc()
412 fmev_shdl_impl_t *ihdl = HDL2IHDL(hdl); in fmev_shdl_free() local
417 ihdl->sh_cmn.hc_free(buf, sz); in fmev_shdl_free()
423 fmev_shdl_impl_t *ihdl = HDL2IHDL(hdl); in fmev_shdl_strdup() local
432 if ((dst = ihdl->sh_cmn.hc_alloc(srclen + 1)) == NULL) { in fmev_shdl_strdup()
445 fmev_shdl_impl_t *ihdl = HDL2IHDL(hdl); in fmev_shdl_strfree() local
449 ihdl->sh_cmn.hc_free(buf, strlen(buf) + 1); in fmev_shdl_strfree()
472 fmev_shdl_impl_t *ihdl; in fmev_shdl_init() local
493 ihdl = dflt_zalloc(sizeof (*ihdl)); in fmev_shdl_init()
495 ihdl = hdlzalloc(sizeof (*ihdl)); in fmev_shdl_init()
497 if (ihdl == NULL) { in fmev_shdl_init()
502 ihdl->sh_cmn = hc; in fmev_shdl_init()
504 if ((ihdl->sh_attr = sysevent_subattr_alloc()) == NULL) { in fmev_shdl_init()
509 (void) pthread_mutex_init(&ihdl->sh_lock, NULL); in fmev_shdl_init()
524 if (sysevent_evc_bind(chan_name, &ihdl->sh_binding, in fmev_shdl_init()
541 if ((ihdl->sh_pool = uu_avl_pool_create("subinfo_pool", in fmev_shdl_init()
549 if ((ihdl->sh_avl = uu_avl_create(ihdl->sh_pool, NULL, in fmev_shdl_init()
555 return (IHDL2HDL(ihdl)); in fmev_shdl_init()
558 (void) fmev_shdl_fini(IHDL2HDL(ihdl)); in fmev_shdl_init()
566 fmev_shdl_impl_t *ihdl = HDL2IHDL(hdl); in fmev_shdl_getauthority() local
573 (void) pthread_mutex_lock(&ihdl->sh_lock); in fmev_shdl_getauthority()
575 if (sysevent_evc_getpropnvl(ihdl->sh_binding, &propnvl) != 0) { in fmev_shdl_getauthority()
577 (void) pthread_mutex_unlock(&ihdl->sh_lock); in fmev_shdl_getauthority()
595 (void) pthread_mutex_unlock(&ihdl->sh_lock); in fmev_shdl_getauthority()
608 fmev_shdl_impl_t *ihdl = HDL2IHDL(hdl); in fmev_shdl_nvl2str() local
617 (void) pthread_mutex_lock(&ihdl->sh_lock); in fmev_shdl_nvl2str()
620 (void) pthread_mutex_unlock(&ihdl->sh_lock); in fmev_shdl_nvl2str()
654 fmev_shdl_impl_t *ihdl = HDL2IHDL(hdl); in fmev_shdl_fini() local
659 (void) pthread_mutex_lock(&ihdl->sh_lock); in fmev_shdl_fini()
665 if (sysevent_evc_unsubscribe(ihdl->sh_binding, "invalidsid") == in fmev_shdl_fini()
667 (void) pthread_mutex_unlock(&ihdl->sh_lock); in fmev_shdl_fini()
671 if (ihdl->sh_avl) { in fmev_shdl_fini()
675 while ((sip = uu_avl_teardown(ihdl->sh_avl, &cookie)) != NULL) in fmev_shdl_fini()
676 (void) fmev_subinfo_fini(ihdl, sip, B_FALSE); in fmev_shdl_fini()
678 uu_avl_destroy(ihdl->sh_avl); in fmev_shdl_fini()
679 ihdl->sh_avl = NULL; in fmev_shdl_fini()
682 ASSERT(ihdl->sh_subcnt == 0); in fmev_shdl_fini()
684 if (ihdl->sh_binding) { in fmev_shdl_fini()
685 (void) sysevent_evc_unbind(ihdl->sh_binding); in fmev_shdl_fini()
686 ihdl->sh_binding = NULL; in fmev_shdl_fini()
689 if (ihdl->sh_pool) { in fmev_shdl_fini()
690 uu_avl_pool_destroy(ihdl->sh_pool); in fmev_shdl_fini()
691 ihdl->sh_pool = NULL; in fmev_shdl_fini()
694 if (ihdl->sh_attr) { in fmev_shdl_fini()
695 sysevent_subattr_free(ihdl->sh_attr); in fmev_shdl_fini()
696 ihdl->sh_attr = NULL; in fmev_shdl_fini()
699 ihdl->sh_cmn.hc_magic = 0; in fmev_shdl_fini()
706 (void) pthread_mutex_unlock(&ihdl->sh_lock); in fmev_shdl_fini()
707 (void) pthread_mutex_destroy(&ihdl->sh_lock); in fmev_shdl_fini()
709 fmev_shdl_free(hdl, hdl, sizeof (*ihdl)); in fmev_shdl_fini()