Class: IO

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

Instance Method Summary collapse

Instance Method Details

#close_on_exec!Object



592
593
594
595
596
# File 'lib/phusion_passenger/utils.rb', line 592

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.



587
588
589
# File 'lib/phusion_passenger/utils.rb', line 587

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.



579
580
581
# File 'lib/phusion_passenger/utils.rb', line 579

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