src/util/dirwatch.c
/**
 * dirwatch_dispatch() - dispatch the directory watch
 * @dw:                 directory watch to operate on
 *
 * This dispatches all active events on the dirwatch. If a file-system
 * modification was detected, DIRWATCH_E_TRIGGERED is signalled to the caller.
 *
 * Return: 0 is returned on success, DIRWATCH_E_TRIGGERED if a file-system
 *         modification was detected, a negative error code on failure.
 */
dispatch the directory watch
@dw:                 directory watch to operate on

This dispatches all active events on the dirwatch. If a file-system
modification was detected, DIRWATCH_E_TRIGGERED is signalled to the caller.

0 is returned on success, DIRWATCH_E_TRIGGERED if a file-system
modification was detected, a negative error code on failure.
dispatch the directory watch @dw : directory watch to operate on This dispatches all active events on the dirwatch . If a file - system modification was detected DIRWATCH_E_TRIGGERED is signalled to the caller . 0 is returned on success DIRWATCH_E_TRIGGERED if a file - system modification was detected a negative error code on failure .
int dirwatch_dispatch(Dirwatch *dw) {
        uint8_t buffer[16 * (sizeof(struct inotify_event) + NAME_MAX + 1)];
        bool triggered = false;
        ssize_t l;
        do {
                l = read(dw->inotify_fd, buffer, sizeof(buffer));
                if (l > 0) {
                        triggered = true;
                } else if (!l) {
                        return error_origin(-EINVAL);
                } else if (errno != EAGAIN) {
                        return error_origin(-errno);
                }
        } while (l > 0);
        return triggered ? DIRWATCH_E_TRIGGERED : 0;
}
int dirwatch_dispatch ( Dirwatch * dw ) { uint8_t buffer [ 16 * ( sizeof ( struct inotify_event ) + NAME_MAX + 1 ) ] ; bool triggered = false ; ssize_t l ; do { l = read ( dw -> inotify_fd , buffer , sizeof ( buffer ) ) ; if ( l > 0 ) { triggered = true ; } else if ( ! l ) { return error_origin ( - EINVAL ) ; } else if ( errno != EAGAIN ) { return error_origin ( - errno ) ; } } while ( l > 0 ) ; return triggered ? DIRWATCH_E_TRIGGERED : 0 ; }
dirwatch_dispatch() - dispatch the directory watch
 @dw:                 directory watch to operate on
dirwatch_dispatch () - dispatch the directory watch @dw : directory watch to operate on