Diff with previous iteration: - rebaed on latest master - applied feedback from Zhao (removed HAVE_SETMODE block, use a typedef struct, check that the fd is seekable, moved doc/APIChanges changes to the right commit)