Fix OSX support

This involves some workaround for `BLKGETSIZE64`, `O_DIRECT` and `memalign`.

Test pass but I'm far from being 100% confident on these, so please review.

This should fix #1