separate unix-related codes to make Swarm buildable on Windows