fileutils: set_nonblocking

Add a helper function (and test) to set nonblocking mode on file
descriptors.