Exemple #1
0
void inotify_watch()
{
	int max_fd=0, i=0;
	fd_set fds;
	struct timeval tv;

	fsync_enable=1;
	while(fsync_enable)
	{
		tv.tv_sec = 0;
		tv.tv_usec = 100000;		// 100 * 1000   100ms
		FD_ZERO(&fds);
		FD_SET(inotify_fd, &fds);
		max_fd = inotify_fd;

		if(select(max_fd+1, &fds, NULL, NULL, &tv) < 0)
		{
			if(errno == EINTR || errno == EAGAIN)
				continue;
		}

		if(FD_ISSET(inotify_fd, &fds))
			read_inotify_fd(inotify_fd);
	}
}
Exemple #2
0
void * verify_fs_activity(void *arg)
{
    while (1) {
	    read_inotify_fd(ifd,arg);   	
		usleep(200*1000);
	}
    return NULL;
}