Class Index [+]

Quicksearch

PhusionPassenger::NativeSupport

Constants

UNIX_PATH_MAX

The maximum length of a Unix socket path, including terminating null.

Public Class Methods

accept(fileno) click to toggle source

Accept a new client from the given socket.

  • fileno (integer): The file descriptor of the server socket.

  • Returns: The accepted client’s file descriptor.

  • Raises SystemCallError if something went wrong.

static VALUE
f_accept(VALUE self, VALUE fileno) 
close_all_file_descriptors(exceptions) click to toggle source

Close all file descriptors, except those given in the exceptions array. For example, the following would close all file descriptors except standard input (0) and standard output (1).

 close_all_file_descriptors([0, 1])
static VALUE
close_all_file_descriptors(VALUE self, VALUE exceptions) 
create_unix_socket(filename, backlog) click to toggle source

Create a SOCK_STREAM server Unix socket. Unlike Ruby’s UNIXServer class, this function is also able to create Unix sockets on the abstract namespace by prepending the filename with a null byte.

  • filename (string): The filename of the Unix socket to create.

  • backlog (integer): The backlog to use for listening on the socket.

  • Returns: The file descriptor of the created Unix socket, as an integer.

  • Raises SystemCallError if something went wrong.

static VALUE
create_unix_socket(VALUE self, VALUE filename, VALUE backlog) 
disable_stdio_buffering click to toggle source

Disables any kind of buffering on the C stdout and stderr variables, so that +fprintf()+ on stdout and stderr have immediate effect.

static VALUE
disable_stdio_buffering() 
recv_fd(socket_fd) click to toggle source

Receive a file descriptor from the given Unix socket. Returns the received file descriptor as an integer. Raises SystemCallError if something went wrong.

You do not have call this method directly. A convenience wrapper is provided by IO#recv_io.

static VALUE
recv_fd(VALUE self, VALUE socket_fd) 
send_fd(socket_fd, fd_to_send) click to toggle source

Send a file descriptor over the given Unix socket. You do not have to call this function directly. A convenience wrapper is provided by IO#send_io.

  • socket_fd (integer): The file descriptor of the socket.

  • fd_to_send (integer): The file descriptor to send.

  • Raises SystemCallError if something went wrong.

static VALUE
send_fd(VALUE self, VALUE socket_fd, VALUE fd_to_send) 
switch_user(p1, p2, p3) click to toggle source

Ruby’s implementations of initgroups, setgid and setuid are broken various ways, sigh... Ruby’s setgid and setuid can’t handle negative UIDs and initgroups is just broken. Work around it by using our own implementation.

static VALUE
switch_user(VALUE self, VALUE username, VALUE uid, VALUE gid) 

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.