net::unix+x86_64 +linux

net::unix provides access to Unix sockets for networking.

A protocol provider for net::dial:: is provided by this module, but you must import net::unix at least once in order for it to be visible to net::dial.

Index

Types

type addr = str;
type backlog = u32;
type connect_option = net::sockflag;
type listen_option = (backlog | net::sockflag);

Errors

type invalid = !void;

Functions

fn accept(sock: net::socket, flags: net::sockflag) (net::socket | net::error);
fn addfiles(buf: *net::msghdr, files: io::file...) void;
fn allocfiles(buf: *net::msghdr, nfile: size) void;
fn connect(addr: addr, options: connect_option...) (net::socket | net::error);
fn listen(addr: addr, options: listen_option...) (net::socket | net::error);
fn recvfiles(buf: *net::msghdr, nfile: size) []io::file;
fn socketpair(flags: net::sockflag = 0) ((net::socket, net::socket) | net::error);

Types

type addr[link]

type addr = str;

A UNIX socket address.

type backlog[link]

type backlog = u32;

Configures the backlog size for a listener. If not specified, a sensible default (10) is used.

type connect_option[link]

type connect_option = net::sockflag;

Options for connect.

type listen_option[link]

type listen_option = (backlog | net::sockflag);

Options for listen.

Errors

type invalid[link]

type invalid = !void;

Invalid UNIX socket path.

Functions

fn accept[link]

fn accept(sock: net::socket, flags: net::sockflag) (net::socket | net::error);

Accepts the next connection from a socket. Blocks until a new connection is available. This is a convenience wrapper around net::accept.

fn addfiles[link]

fn addfiles(buf: *net::msghdr, files: io::file...) void;

Adds a list of file descriptors to the ancillary data for a sendmsg operation.

fn allocfiles[link]

fn allocfiles(buf: *net::msghdr, nfile: size) void;

Prepares an ancillary data buffer to receive files during a recvmsg operation.

fn connect[link]

fn connect(addr: addr, options: connect_option...) (net::socket | net::error);

Opens a UNIX socket connection to the path. Blocks until the connection is established.

fn listen[link]

fn listen(addr: addr, options: listen_option...) (net::socket | net::error);

Binds a UNIX socket to the given path.

fn recvfiles[link]

fn recvfiles(buf: *net::msghdr, nfile: size) []io::file;

Receives files from an ancillary data buffer which was previously prepared with allocfiles.

fn socketpair[link]

fn socketpair(flags: net::sockflag = 0) ((net::socket, net::socket) | net::error);

A thin wrapper around socketpair(2) that presumes rt::AF_UNIX for the domain and returns an unnamed pair of sockets of type rt::SOCK_STREAM.