use PIPE_BUF instead of own constant
add a write error log function to save space
use write instead of write_fully when writing to pipes - guaranteed full
define FD_BUF, which can be larger than PIPE_BUF
add cast for string
inline the write_fully function for the common case
use max(PIPE_BUF, 4096) as FD_BUF
move non-hot code out of read_write_loop into separate functions
move non-hot code out of read_write_from_children into separate function