basic tie_fd() utility