tools: Fix build on Visual Studio

As unistd.h is not universally available, don't include it unconditionally
and include the corresponding Windows headers where necessary.  Also, use
gssize in place of ssize_t and define STDOUT_FILENO on Windows when we
don't have unistd.h, which is a constant that is defined in unistd.h.

https://bugzilla.gnome.org/show_bug.cgi?id=723813