Move more of the Unix I/O to device.ml

Signed-off-by: David Scott <dave.scott@eu.citrix.com>