316 }
317
318 if (sysevent_bind_publisher(sysevent_hp) != 0) {
319 if (errno == EBUSY) {
320 sysevent_cleanup_publishers(sysevent_hp);
321 if (sysevent_bind_publisher(sysevent_hp) != 0) {
322 (void) sysevent_close_channel(sysevent_hp);
323 return (NULL);
324 }
325 }
326 }
327
328 sysevent_cleanup_subscribers(sysevent_hp);
329 cleanup = 0;
330 eventq_head = NULL;
331 eventq_tail = NULL;
332
333 (void) mutex_init(&evq_lock, USYNC_THREAD, NULL);
334 (void) cond_init(&evq_cv, USYNC_THREAD, NULL);
335
336 if (thr_create(NULL, NULL, (void *(*)(void *))devfsadmd_deliver_thr,
337 NULL, THR_BOUND, &deliver_thr_id) != 0) {
338 (void) mutex_destroy(&evq_lock);
339 (void) cond_destroy(&evq_cv);
340 sysevent_close_channel(sysevent_hp);
341 return (NULL);
342 }
343
344 return (&devfsadm_mod_ops);
345 }
346
347 void
348 slm_fini()
349 {
350 /* Wait for all events to be flushed out to devfsadmd */
351 (void) mutex_lock(&evq_lock);
352 cleanup = 1;
353 (void) cond_signal(&evq_cv);
354 (void) cond_wait(&evq_cv, &evq_lock);
355 (void) mutex_unlock(&evq_lock);
356
|
316 }
317
318 if (sysevent_bind_publisher(sysevent_hp) != 0) {
319 if (errno == EBUSY) {
320 sysevent_cleanup_publishers(sysevent_hp);
321 if (sysevent_bind_publisher(sysevent_hp) != 0) {
322 (void) sysevent_close_channel(sysevent_hp);
323 return (NULL);
324 }
325 }
326 }
327
328 sysevent_cleanup_subscribers(sysevent_hp);
329 cleanup = 0;
330 eventq_head = NULL;
331 eventq_tail = NULL;
332
333 (void) mutex_init(&evq_lock, USYNC_THREAD, NULL);
334 (void) cond_init(&evq_cv, USYNC_THREAD, NULL);
335
336 if (thr_create(NULL, 0, (void *(*)(void *))devfsadmd_deliver_thr,
337 NULL, THR_BOUND, &deliver_thr_id) != 0) {
338 (void) mutex_destroy(&evq_lock);
339 (void) cond_destroy(&evq_cv);
340 sysevent_close_channel(sysevent_hp);
341 return (NULL);
342 }
343
344 return (&devfsadm_mod_ops);
345 }
346
347 void
348 slm_fini()
349 {
350 /* Wait for all events to be flushed out to devfsadmd */
351 (void) mutex_lock(&evq_lock);
352 cleanup = 1;
353 (void) cond_signal(&evq_cv);
354 (void) cond_wait(&evq_cv, &evq_lock);
355 (void) mutex_unlock(&evq_lock);
356
|