separate unix-related codes to make Swarm buildable on Windows

Signed-off-by: Chanwit Kaewkasi <chanwit@gmail.com>
Merge pull request #205 from chanwit/dev

Cleanup: separate unix-related codes to make Swarm buildable on Windows