Lines Matching defs:ihdl

62 #define	IHDL2HDL(ihdl)	((fmev_shdl_t)(ihdl))
65 #define FMEV_SHDL_VALID(ihdl) ((ihdl)->sh_cmn.hc_magic == _FMEV_SHMAGIC)
95 shdlctl_start(fmev_shdl_impl_t *ihdl)
97 (void) pthread_mutex_lock(&ihdl->sh_lock);
99 if (ihdl->sh_subcnt == 0) {
102 (void) pthread_mutex_unlock(&ihdl->sh_lock);
108 shdlctl_end(fmev_shdl_impl_t *ihdl)
110 (void) pthread_mutex_unlock(&ihdl->sh_lock);
116 fmev_shdl_impl_t *ihdl = HDL2IHDL(hdl);
121 if (!shdlctl_start(ihdl))
124 if (!(ihdl->sh_flags & SHDL_FL_SERIALIZE)) {
125 (void) pthread_mutex_init(&ihdl->sh_srlz_lock, NULL);
126 ihdl->sh_flags |= SHDL_FL_SERIALIZE;
129 shdlctl_end(ihdl);
136 fmev_shdl_impl_t *ihdl = HDL2IHDL(hdl);
141 if (!shdlctl_start(ihdl))
144 sysevent_subattr_thrattr(ihdl->sh_attr, attr);
146 shdlctl_end(ihdl);
153 fmev_shdl_impl_t *ihdl = HDL2IHDL(hdl);
158 if (!shdlctl_start(ihdl))
161 sysevent_subattr_sigmask(ihdl->sh_attr, set);
163 shdlctl_end(ihdl);
171 fmev_shdl_impl_t *ihdl = HDL2IHDL(hdl);
176 if (!shdlctl_start(ihdl))
179 sysevent_subattr_thrsetup(ihdl->sh_attr, func, cookie);
181 shdlctl_end(ihdl);
189 fmev_shdl_impl_t *ihdl = HDL2IHDL(hdl);
194 if (!shdlctl_start(ihdl))
197 sysevent_subattr_thrcreate(ihdl->sh_attr, func, cookie);
199 shdlctl_end(ihdl);
215 fmev_shdl_impl_t *ihdl = sip->si_ihdl;
225 if ((ev = fmev_sysev2fmev(IHDL2HDL(ihdl), sep, &class, &nvl)) == NULL) {
230 if (ihdl->sh_flags & SHDL_FL_SERIALIZE)
231 (void) pthread_mutex_lock(&ihdl->sh_srlz_lock);
235 if (ihdl->sh_flags & SHDL_FL_SERIALIZE)
236 (void) pthread_mutex_unlock(&ihdl->sh_srlz_lock);
249 fmev_shdl_impl_t *ihdl = HDL2IHDL(hdl);
275 uu_avl_node_init(sip, &sip->si_node, ihdl->sh_pool);
277 (void) pthread_mutex_lock(&ihdl->sh_lock);
279 if (uu_avl_find(ihdl->sh_avl, sip, NULL, &idx) != NULL) {
280 (void) pthread_mutex_unlock(&ihdl->sh_lock);
294 sip->si_ihdl = ihdl;
298 if ((serr = sysevent_evc_xsubscribe(ihdl->sh_binding, sip->si_sid,
299 sip->si_pat, fmev_proxy_cb, sip, 0, ihdl->sh_attr)) != 0) {
302 (void) pthread_mutex_unlock(&ihdl->sh_lock);
318 uu_avl_insert(ihdl->sh_avl, sip, idx);
319 ihdl->sh_subcnt++;
321 (void) pthread_mutex_unlock(&ihdl->sh_lock);
327 fmev_subinfo_fini(fmev_shdl_impl_t *ihdl, struct fmev_subinfo *sip,
332 ASSERT(sip->si_ihdl == ihdl);
334 err = sysevent_evc_unsubscribe(ihdl->sh_binding, sip->si_sid);
338 uu_avl_remove(ihdl->sh_avl, sip);
339 uu_avl_node_fini(sip, &sip->si_node, ihdl->sh_pool);
341 fmev_shdl_free(IHDL2HDL(ihdl), sip, sizeof (*sip));
342 ihdl->sh_subcnt--;
351 fmev_shdl_impl_t *ihdl = HDL2IHDL(hdl);
369 (void) pthread_mutex_lock(&ihdl->sh_lock);
371 if ((sip = uu_avl_find(ihdl->sh_avl, &si, NULL, NULL)) != NULL) {
372 if ((err = fmev_subinfo_fini(ihdl, sip, B_TRUE)) == 0) {
384 (void) pthread_mutex_unlock(&ihdl->sh_lock);
392 fmev_shdl_impl_t *ihdl = HDL2IHDL(hdl);
397 return (ihdl->sh_cmn.hc_alloc(sz));
403 fmev_shdl_impl_t *ihdl = HDL2IHDL(hdl);
408 return (ihdl->sh_cmn.hc_zalloc(sz));
414 fmev_shdl_impl_t *ihdl = HDL2IHDL(hdl);
419 ihdl->sh_cmn.hc_free(buf, sz);
425 fmev_shdl_impl_t *ihdl = HDL2IHDL(hdl);
434 if ((dst = ihdl->sh_cmn.hc_alloc(srclen + 1)) == NULL) {
447 fmev_shdl_impl_t *ihdl = HDL2IHDL(hdl);
451 ihdl->sh_cmn.hc_free(buf, strlen(buf) + 1);
474 fmev_shdl_impl_t *ihdl;
495 ihdl = dflt_zalloc(sizeof (*ihdl));
497 ihdl = hdlzalloc(sizeof (*ihdl));
499 if (ihdl == NULL) {
504 ihdl->sh_cmn = hc;
506 if ((ihdl->sh_attr = sysevent_subattr_alloc()) == NULL) {
511 (void) pthread_mutex_init(&ihdl->sh_lock, NULL);
526 if (sysevent_evc_bind(chan_name, &ihdl->sh_binding,
543 if ((ihdl->sh_pool = uu_avl_pool_create("subinfo_pool",
551 if ((ihdl->sh_avl = uu_avl_create(ihdl->sh_pool, NULL,
557 return (IHDL2HDL(ihdl));
560 (void) fmev_shdl_fini(IHDL2HDL(ihdl));
568 fmev_shdl_impl_t *ihdl = HDL2IHDL(hdl);
575 (void) pthread_mutex_lock(&ihdl->sh_lock);
577 if (sysevent_evc_getpropnvl(ihdl->sh_binding, &propnvl) != 0) {
579 (void) pthread_mutex_unlock(&ihdl->sh_lock);
597 (void) pthread_mutex_unlock(&ihdl->sh_lock);
610 fmev_shdl_impl_t *ihdl = HDL2IHDL(hdl);
619 (void) pthread_mutex_lock(&ihdl->sh_lock);
622 (void) pthread_mutex_unlock(&ihdl->sh_lock);
656 fmev_shdl_impl_t *ihdl = HDL2IHDL(hdl);
661 (void) pthread_mutex_lock(&ihdl->sh_lock);
667 if (sysevent_evc_unsubscribe(ihdl->sh_binding, "invalidsid") ==
669 (void) pthread_mutex_unlock(&ihdl->sh_lock);
673 if (ihdl->sh_avl) {
677 while ((sip = uu_avl_teardown(ihdl->sh_avl, &cookie)) != NULL)
678 (void) fmev_subinfo_fini(ihdl, sip, B_FALSE);
680 uu_avl_destroy(ihdl->sh_avl);
681 ihdl->sh_avl = NULL;
684 ASSERT(ihdl->sh_subcnt == 0);
686 if (ihdl->sh_binding) {
687 (void) sysevent_evc_unbind(ihdl->sh_binding);
688 ihdl->sh_binding = NULL;
691 if (ihdl->sh_pool) {
692 uu_avl_pool_destroy(ihdl->sh_pool);
693 ihdl->sh_pool = NULL;
696 if (ihdl->sh_attr) {
697 sysevent_subattr_free(ihdl->sh_attr);
698 ihdl->sh_attr = NULL;
701 ihdl->sh_cmn.hc_magic = 0;
708 (void) pthread_mutex_unlock(&ihdl->sh_lock);
709 (void) pthread_mutex_destroy(&ihdl->sh_lock);
711 ihdl->sh_cmn.hc_free(hdl, sizeof (*ihdl));