DoxigAlpha

initUnix

Function parameters

Parameters

#
path:[]const u8

Type definitions in this namespace

Types

#

Functions in this namespace

Functions

#
tcpConnectToHost
All memory allocated with `allocator` will be freed before this function returns.
getAddressList
Call `AddressList.deinit` on the result.

Error sets in this namespace

Error Sets

#

= switch (native_os) { .windows => builtin.os.version_range.windows.isAtLeast(.win10_rs4) orelse false, .wasi => false, else => true, }

Values

#
has_unix_sockets
= switch (native_os) { .windows => builtin.os.version_range.windows.isAtLeast(.win10_rs4) orelse false, .wasi => false, else => true, }

Source

Implementation

#
pub fn initUnix(path: []const u8) !Address {
    var sock_addr = posix.sockaddr.un{
        .family = posix.AF.UNIX,
        .path = undefined,
    };

    // Add 1 to ensure a terminating 0 is present in the path array for maximum portability.
    if (path.len + 1 > sock_addr.path.len) return error.NameTooLong;

    @memset(&sock_addr.path, 0);
    @memcpy(sock_addr.path[0..path.len], path);

    return .{ .un = sock_addr };
}