pass fd of socket to native routines instead of fd function itself