Class | IO
In: | lib/phusion_passenger/utils.rb
Parent: | Object

### Methods

close_on_exec! close_on_exec! writev writev2 writev3

### Public Instance methods

close_on_exec!()

[Source]

         # File lib/phusion_passenger/utils.rb, line 998
    998:                 def close_on_exec!
    999:                 end

close_on_exec!()

[Source]

         # File lib/phusion_passenger/utils.rb, line 994
    994:                 def close_on_exec!
    995:                         fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC)
    996:                 end

writev(components)

Writes all of the strings in the `components` array into the given file descriptor using the +writev()+ system call. Unlike IO#write, this method does not require one to concatenate all those strings into a single buffer in order to send the data in a single system call. Thus, #writev is a great way to perform zero-copy I/O.

Unlike the raw writev() system call, this method ensures that all given data is written before returning, by performing multiple writev() calls and whatever else is necessary.

      io.writev(["hello ", "world", "\n"])

[Source]

         # File lib/phusion_passenger/utils.rb, line 970
    970:                 def writev(components)
    971:                         return PhusionPassenger::NativeSupport.writev(fileno, components)
    972:                 end

writev2(components, components2)

Like #writev, but accepts two arrays. The data is written in the given order.

      io.writev2(["hello ", "world", "\n"], ["another ", "message\n"])

[Source]

         # File lib/phusion_passenger/utils.rb, line 977
    977:                 def writev2(components, components2)
    978:                         return PhusionPassenger::NativeSupport.writev2(fileno,
    979:                                 components, components2)
    980:                 end

writev3(components, components2, components3)

Like #writev, but accepts three arrays. The data is written in the given order.

      io.writev3(["hello ", "world", "\n"],
        ["another ", "message\n"],
        ["yet ", "another ", "one", "\n"])

[Source]

         # File lib/phusion_passenger/utils.rb, line 987
    987:                 def writev3(components, components2, components3)
    988:                         return PhusionPassenger::NativeSupport.writev3(fileno,
    989:                                 components, components2, components3)
    990:                 end

[Validate]