Lines Matching defs:scp

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