Update the Unix code (including tests) to the new Cstruct interface

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