Abstract out the fork/exec/pipe process+pipe creation functionality,
and provide the Win32 code as well. This makes daemon PMDAs work in
dbpmda. It turns out that the send/recv workaround used in libpcp
earlier (for socket PDU communication) doesn't work for pipes. But,
after much hair-pulling and gnashing-of-teeth, an alternative has
been found - using the native Win32 ReadFile/WriteFile APIs, which
are able to be used on both types of HANDLE. Read timeouts are also
proving a non-obvious area in Win32, as it turns out select(2) can't
be used on pipes. Some of the functionality can be achieved using
the Win32 SetCommTimeouts interface, which this new code is also now
using in the libpcp pduread routine.
Abstract out the fork/exec/pipe process+pipe creation functionality,
and provide the Win32 code as well. This makes daemon PMDAs work in
dbpmda. It turns out that the send/recv workaround used in libpcp
earlier (for socket PDU communication) doesn't work for pipes. But,
after much hair-pulling and gnashing-of-teeth, an alternative has
been found - using the native Win32 ReadFile/WriteFile APIs, which
are able to be used on both types of HANDLE. Read timeouts are also
proving a non-obvious area in Win32, as it turns out select(2) can't
be used on pipes. Some of the functionality can be achieved using
the Win32 SetCommTimeouts interface, which this new code is also now
using in the libpcp pduread routine.