1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556(* This file is part of Luv, released under the MIT license. See LICENSE.md for
details, or visit https://github.com/aantron/luv/blob/master/LICENSE.md. *)moduleC=Luv__CmoduleError=Luv.ErrormoduleOs_fd=structmoduleFd=structincludeLuv.Os_fd.Fdexternalfrom_unix_helper:Unix.file_descr->nativeint->unit="luv_unix_fd_to_os_fd"letfrom_unixunix_fd=letos_fd=Ctypes.makeC.Types.Os_fd.tinletstorage=Ctypes.(raw_address_of_ptr(to_voidp(addros_fd)))infrom_unix_helperunix_fdstorage;ifC.Functions.Os_fd.is_invalid_handle_valueos_fdthenResult.Error`EBADFelseResult.Okos_fdexternalto_unix_helper:nativeint->Unix.file_descr="luv_os_fd_to_unix_fd"letto_unixos_fd=to_unix_helper(Ctypes.(raw_address_of_ptr(to_voidp(addros_fd))))endmoduleSocket=structincludeLuv.Os_fd.Socketexternalfrom_unix_helper:Unix.file_descr->nativeint->unit="luv_unix_fd_to_os_socket"letfrom_unixunix_fd=letos_socket=Ctypes.makeC.Types.Os_socket.tinletstorage=Ctypes.(raw_address_of_ptr(to_voidp(addros_socket)))infrom_unix_helperunix_fdstorage;ifC.Functions.Os_fd.is_invalid_socket_valueos_socketthenResult.Error`EBADFelseResult.Okos_socketexternalto_unix_helper:nativeint->Unix.file_descr="luv_os_socket_to_unix_fd"letto_unixos_socket=to_unix_helper(Ctypes.(raw_address_of_ptr(to_voidp(addros_socket))))endend