module FFI::IO

def self.for_fd(fd, mode = "r")

Returns:
  • (::IO) -

Parameters:
  • mode (String) -- mode string
  • fd (Integer) -- file decriptor
def self.for_fd(fd, mode = "r")
  ::IO.for_fd(fd, mode)
end

def self.native_read(io, buf, len)

Returns:
  • (Integer) - length really read, in bytes

Parameters:
  • len (nil, Integer) -- maximul number of bytes to read from +io+. If +nil+,
  • buf (AbstractMemory) -- destination for data read from +io+
  • io (#read) -- io to read from
def self.native_read(io, buf, len)
  tmp = io.read(len)
  return -1 unless tmp
  buf.put_bytes(0, tmp)
  tmp.length
end