class IO

def close_on_exec!

def close_on_exec!
	if defined?(Fcntl::F_SETFD)
		fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC)
	end
end

def recv_io

Raises SystemCallError if something went wrong.

This only works if this IO channel is a Unix socket.
Receive an IO object (i.e. a file descriptor) from this IO channel.
def recv_io
	return IO.new(PhusionPassenger::NativeSupport.recv_fd(self.fileno))
end

def send_io(io)

Raises SystemCallError if something went wrong.

This only works if this IO channel is a Unix socket.
Send an IO object (i.e. a file descriptor) over this IO channel.
def send_io(io)
	PhusionPassenger::NativeSupport.send_fd(self.fileno, io.fileno)
end