Lines Matching refs:scp
76 will_deadlock(evchan_t *scp) in will_deadlock() argument
79 evchan_impl_hdl_t *hdl = EVCHAN_IMPL_HNDL(scp); in will_deadlock()
119 evchan_t *scp; in sysevent_evc_bind() local
144 scp = calloc(1, sizeof (evchan_impl_hdl_t)); in sysevent_evc_bind()
145 if (scp == NULL) { in sysevent_evc_bind()
154 EV_FD(scp) = open(DEVSYSEVENT, O_RDWR); in sysevent_evc_bind()
155 if (EV_FD(scp) == -1) { in sysevent_evc_bind()
158 free(scp); in sysevent_evc_bind()
162 EV_FD(scp) = open(DEVICESYSEVENT, O_RDWR); in sysevent_evc_bind()
163 if (EV_FD(scp) == -1) { in sysevent_evc_bind()
165 free(scp); in sysevent_evc_bind()
176 (void) fcntl(EV_FD(scp), F_SETFD, FD_CLOEXEC); in sysevent_evc_bind()
182 if (ioctl(EV_FD(scp), SEV_CHAN_OPEN, &uargs) != 0) { in sysevent_evc_bind()
184 (void) close(EV_FD(scp)); in sysevent_evc_bind()
185 free(scp); in sysevent_evc_bind()
190 EV_PID(scp) = getpid(); in sysevent_evc_bind()
191 (void) mutex_init(EV_LOCK(scp), USYNC_THREAD, NULL); in sysevent_evc_bind()
193 *scpp = scp; in sysevent_evc_bind()
202 sysevent_evc_unbind(evchan_t *scp) in sysevent_evc_unbind() argument
208 if (scp == NULL || misaligned(scp)) in sysevent_evc_unbind()
211 if (will_deadlock(scp)) in sysevent_evc_unbind()
214 (void) mutex_lock(EV_LOCK(scp)); in sysevent_evc_unbind()
219 if (EV_PID(scp) == getpid()) { in sysevent_evc_unbind()
226 if (ioctl(EV_FD(scp), SEV_UNSUBSCRIBE, (intptr_t)&uargs) != 0) { in sysevent_evc_unbind()
228 (void) mutex_unlock(EV_LOCK(scp)); in sysevent_evc_unbind()
233 while ((subp = EV_SUB_NEXT(scp)) != NULL) { in sysevent_evc_unbind()
234 EV_SUB_NEXT(scp) = subp->evsub_next; in sysevent_evc_unbind()
247 (void) mutex_unlock(EV_LOCK(scp)); in sysevent_evc_unbind()
253 (void) close(EV_FD(scp)); in sysevent_evc_unbind()
254 (void) mutex_destroy(EV_LOCK(scp)); in sysevent_evc_unbind()
255 free(scp); in sysevent_evc_unbind()
264 sysevent_evc_publish(evchan_t *scp, const char *class, in sysevent_evc_publish() argument
274 if (scp == NULL || misaligned(scp)) { in sysevent_evc_publish()
279 if (EV_PID(scp) != getpid()) { in sysevent_evc_publish()
293 (void) mutex_lock(EV_LOCK(scp)); in sysevent_evc_publish()
295 rc = ioctl(EV_FD(scp), SEV_PUBLISH, (intptr_t)&uargs); in sysevent_evc_publish()
298 (void) mutex_unlock(EV_LOCK(scp)); in sysevent_evc_publish()
446 sysevent_evc_subscribe_cmn(evchan_t *scp, const char *sid, const char *class, in sysevent_evc_subscribe_cmn() argument
457 if (scp == NULL || misaligned(scp) || sid == NULL || class == NULL) { in sysevent_evc_subscribe_cmn()
462 if (EV_PID(scp) != getpid()) { in sysevent_evc_subscribe_cmn()
505 subp->ev_subhead = EVCHAN_IMPL_HNDL(scp); in sysevent_evc_subscribe_cmn()
537 (void) mutex_lock(EV_LOCK(scp)); in sysevent_evc_subscribe_cmn()
545 if (ioctl(EV_FD(scp), SEV_SUBSCRIBE, (intptr_t)&uargs) != 0) { in sysevent_evc_subscribe_cmn()
547 (void) mutex_unlock(EV_LOCK(scp)); in sysevent_evc_subscribe_cmn()
557 subp->evsub_next = EV_SUB_NEXT(scp); in sysevent_evc_subscribe_cmn()
558 EV_SUB_NEXT(scp) = subp; in sysevent_evc_subscribe_cmn()
560 (void) mutex_unlock(EV_LOCK(scp)); in sysevent_evc_subscribe_cmn()
571 sysevent_evc_subscribe(evchan_t *scp, const char *sid, const char *class, in sysevent_evc_subscribe() argument
575 return (sysevent_evc_subscribe_cmn(scp, sid, class, event_handler, in sysevent_evc_subscribe()
600 sysevent_evc_xsubscribe(evchan_t *scp, const char *sid, const char *class, in sysevent_evc_xsubscribe() argument
613 return (sysevent_evc_subscribe_cmn(scp, sid, class, event_handler, in sysevent_evc_xsubscribe()
686 sysevent_evc_unsubscribe(evchan_t *scp, const char *sid) in sysevent_evc_unsubscribe() argument
694 if (scp == NULL || misaligned(scp)) in sysevent_evc_unsubscribe()
702 if (EV_PID(scp) != getpid()) in sysevent_evc_unsubscribe()
715 if (will_deadlock(scp)) in sysevent_evc_unsubscribe()
718 (void) mutex_lock(EV_LOCK(scp)); in sysevent_evc_unsubscribe()
723 rc = ioctl(EV_FD(scp), SEV_UNSUBSCRIBE, (intptr_t)&uargs); in sysevent_evc_unsubscribe()
727 (void) mutex_unlock(EV_LOCK(scp)); in sysevent_evc_unsubscribe()
738 subp = EV_SUB_NEXT(scp); in sysevent_evc_unsubscribe()
742 EV_SUB_NEXT(scp) = subp->evsub_next; in sysevent_evc_unsubscribe()
767 (void) mutex_unlock(EV_LOCK(scp)); in sysevent_evc_unsubscribe()
776 sysevent_evc_control(evchan_t *scp, int cmd, /* arg */ ...) in sysevent_evc_control() argument
783 if (scp == NULL || misaligned(scp)) { in sysevent_evc_control()
788 if (EV_PID(scp) != getpid()) { in sysevent_evc_control()
796 (void) mutex_lock(EV_LOCK(scp)); in sysevent_evc_control()
806 rc = ioctl(EV_FD(scp), SEV_CHAN_CONTROL, (intptr_t)&uargs); in sysevent_evc_control()
813 rc = ioctl(EV_FD(scp), SEV_CHAN_CONTROL, (intptr_t)&uargs); in sysevent_evc_control()
820 (void) mutex_unlock(EV_LOCK(scp)); in sysevent_evc_control()
832 sysevent_evc_setpropnvl(evchan_t *scp, nvlist_t *nvl) in sysevent_evc_setpropnvl() argument
839 if (scp == NULL || misaligned(scp)) in sysevent_evc_setpropnvl()
849 rc = ioctl(EV_FD(scp), SEV_SETPROPNVL, (intptr_t)&uargs); in sysevent_evc_setpropnvl()
858 sysevent_evc_getpropnvl(evchan_t *scp, nvlist_t **nvlp) in sysevent_evc_getpropnvl() argument
867 if (scp == NULL || misaligned(scp) || nvlp == NULL) in sysevent_evc_getpropnvl()
876 rc = ioctl(EV_FD(scp), SEV_GETPROPNVL, (intptr_t)&uargs); in sysevent_evc_getpropnvl()