FreeBSD support

Hey Srned,

I was looking at your kqueue changes, and had to minor changes so that the code would build on FreeBSD. I'm sending you a pull request if you don't mind merging these changes into your branch that manjuraj will be looking at for kqueue support.

Please let me know if you have any questions. Thanks!