Maybe you could use this one: https://github.com/joyent/libuv/blob/master/src/fs-poll.c#L194 it takes more things into account.