488 */
489 if (!removal)
490 mutex_exit(&state->ins_lock);
491 return;
492 }
493
494 if (name != NULL) {
495 len = strlen(name) + 1;
496 len = roundup(len, sizeof (struct inotify_event));
497 } else {
498 len = 0;
499 }
500
501 event = kmem_zalloc(sizeof (inotify_kevent_t) + len, KM_SLEEP);
502 event->ine_event.wd = wd;
503 event->ine_event.mask = (uint32_t)mask;
504 event->ine_event.cookie = cookie;
505 event->ine_event.len = len;
506
507 if (name != NULL)
508 strcpy(event->ine_event.name, name);
509
510 if (tail != NULL) {
511 tail->ine_next = event;
512 } else {
513 VERIFY(state->ins_head == NULL);
514 state->ins_head = event;
515 cv_broadcast(&state->ins_cv);
516 }
517
518 state->ins_tail = event;
519 state->ins_nevents++;
520 state->ins_size += sizeof (event->ine_event) + len;
521
522 if (removal)
523 return;
524
525 if ((watch->inw_mask & IN_ONESHOT) && !watch->inw_fired) {
526 /*
527 * If this is a one-shot, we need to remove the watch. (Note
528 * that this will recurse back into inotify_watch_event() to
|
488 */
489 if (!removal)
490 mutex_exit(&state->ins_lock);
491 return;
492 }
493
494 if (name != NULL) {
495 len = strlen(name) + 1;
496 len = roundup(len, sizeof (struct inotify_event));
497 } else {
498 len = 0;
499 }
500
501 event = kmem_zalloc(sizeof (inotify_kevent_t) + len, KM_SLEEP);
502 event->ine_event.wd = wd;
503 event->ine_event.mask = (uint32_t)mask;
504 event->ine_event.cookie = cookie;
505 event->ine_event.len = len;
506
507 if (name != NULL)
508 (void) strcpy(event->ine_event.name, name);
509
510 if (tail != NULL) {
511 tail->ine_next = event;
512 } else {
513 VERIFY(state->ins_head == NULL);
514 state->ins_head = event;
515 cv_broadcast(&state->ins_cv);
516 }
517
518 state->ins_tail = event;
519 state->ins_nevents++;
520 state->ins_size += sizeof (event->ine_event) + len;
521
522 if (removal)
523 return;
524
525 if ((watch->inw_mask & IN_ONESHOT) && !watch->inw_fired) {
526 /*
527 * If this is a one-shot, we need to remove the watch. (Note
528 * that this will recurse back into inotify_watch_event() to
|