best to set FD_CLOEXEC
refactor function names