Class: IO

Inherits:
Object show all
Defined in:
lib/phusion_passenger/utils.rb

Instance Method Summary collapse

Instance Method Details

#close_on_exec!Object



546
547
548
549
550
# File 'lib/phusion_passenger/utils.rb', line 546

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

#recv_io(klass = IO) ⇒ Object

Receive an IO object (i.e. a file descriptor) from this IO channel. This only works if this IO channel is a Unix socket.

Raises SystemCallError if something went wrong.



541
542
543
# File 'lib/phusion_passenger/utils.rb', line 541

def recv_io(klass = IO)
	return klass.for_fd(PhusionPassenger::NativeSupport.recv_fd(self.fileno))
end

#send_io(io) ⇒ Object

Send an IO object (i.e. a file descriptor) over this IO channel. This only works if this IO channel is a Unix socket.

Raises SystemCallError if something went wrong.



533
534
535
# File 'lib/phusion_passenger/utils.rb', line 533

def send_io(io)
	PhusionPassenger::NativeSupport.send_fd(self.fileno, io.fileno)
end