Skip to content
Standard libraryZig 0.17.1Official documentation
Sourcestd/c/netbsd.zig

Source line 1

std.c.netbsd.___lwp_park60

function

Source line 18

pub extern "c" fn ___lwp_park60( clock_id: clockid_t, flags: packed struct(u32) { ABSTIME: bool = false, unused: u31 = 0, }, ts: ?*timespec, unpark: lwpid_t, hint: ?*const anyopaque, unpark_hint: ?*const anyopaque, ) c_int

Parameters

clock_id: clockid_t
flags: packed struct(u32) {
    ABSTIME: bool = false,
    unused: u31 = 0,
}
ts: ?*timespec
unpark: lwpid_t
hint: ?*const anyopaque
unpark_hint: ?*const anyopaque

std.c.netbsd._ksiginfo

container

Source line 41

Fields

signo: std.c.SIG
code: i32
errno: i32
reason: extern union {
    rt: extern struct {
        pid: pid_t,
        uid: uid_t,
        value: sigval_t,
    },
    child: extern struct {
        pid: pid_t,
        uid: uid_t,
        status: i32,
        utime: clock_t,
        stime: clock_t,
    },
    fault: extern struct {
        addr: *allowzero anyopaque,
        trap: i32,
        trap2: i32,
        trap3: i32,
    },
    poll: extern struct {
        band: i32,
        fd: i32,
    },
    syscall: extern struct {
        sysnum: i32,
        retval: [2]i32,
        @"error": i32,
        args: [8]u64,
    },
    ptrace_state: extern struct {
        pe_report_event: i32,
        option: extern union {
            pe_other_pid: pid_t,
            pe_lwp: lwpid_t,
        },
    },
} align(@sizeOf(usize))

std.c.netbsd._lwp_self

function

Source line 16

pub extern "c" fn _lwp_self() lwpid_t

std.c.netbsd._lwp_unpark

function

Source line 30

pub extern "c" fn _lwp_unpark(lwp: lwpid_t, hint: ?*const anyopaque) c_int

Parameters

lwp: lwpid_t
hint: ?*const anyopaque

std.c.netbsd._lwp_unpark_all

function

Source line 31

pub extern "c" fn _lwp_unpark_all(targets: [*]const lwpid_t, ntargets: usize, hint: ?*const anyopaque) c_int

Parameters

targets: [*]const lwpid_t
ntargets: usize
hint: ?*const anyopaque

std.c.netbsd.clock_t

alias

Source line 2

Alias of std.c.clock_t

std.c.netbsd.clockid_t

alias

Source line 3

Alias of std.c.clockid_t

std.c.netbsd.E

container

Source line 86

Fields

SUCCESS = 0

No error occurred.

PERM = 1
NOENT = 2
SRCH = 3
INTR = 4
IO = 5
NXIO = 6
@"2BIG" = 7
NOEXEC = 8
BADF = 9
CHILD = 10
DEADLK = 11
NOMEM = 12
ACCES = 13
FAULT = 14
NOTBLK = 15
BUSY = 16
EXIST = 17
XDEV = 18
NODEV = 19
NOTDIR = 20
ISDIR = 21
INVAL = 22
NFILE = 23
MFILE = 24
NOTTY = 25
TXTBSY = 26
FBIG = 27
NOSPC = 28
SPIPE = 29
ROFS = 30
MLINK = 31
PIPE = 32
DOM = 33
RANGE = 34
AGAIN = 35
INPROGRESS = 36
ALREADY = 37
NOTSOCK = 38
DESTADDRREQ = 39
MSGSIZE = 40
PROTOTYPE = 41
NOPROTOOPT = 42
PROTONOSUPPORT = 43
SOCKTNOSUPPORT = 44
OPNOTSUPP = 45
PFNOSUPPORT = 46
AFNOSUPPORT = 47
ADDRINUSE = 48
ADDRNOTAVAIL = 49
NETDOWN = 50
NETUNREACH = 51
NETRESET = 52
CONNABORTED = 53
CONNRESET = 54
NOBUFS = 55
ISCONN = 56
NOTCONN = 57
SHUTDOWN = 58
TOOMANYREFS = 59
TIMEDOUT = 60
CONNREFUSED = 61
LOOP = 62
NAMETOOLONG = 63
HOSTDOWN = 64
HOSTUNREACH = 65
NOTEMPTY = 66
PROCLIM = 67
USERS = 68
DQUOT = 69
STALE = 70
REMOTE = 71
BADRPC = 72
RPCMISMATCH = 73
PROGUNAVAIL = 74
PROGMISMATCH = 75
PROCUNAVAIL = 76
NOLCK = 77
NOSYS = 78
FTYPE = 79
AUTH = 80
NEEDAUTH = 81
IDRM = 82
NOMSG = 83
OVERFLOW = 84
ILSEQ = 85
NOTSUP = 86
CANCELED = 87
BADMSG = 88
NODATA = 89
NOSR = 90
NOSTR = 91
TIME = 92
NOATTR = 93
MULTIHOP = 94
NOLINK = 95
PROTO = 96
_

std.c.netbsd.IP

namespace

Source line 226

std.c.netbsd.IP.ADD_MEMBERSHIP

constant

Source line 238

std.c.netbsd.IP.BINDANY

constant

Source line 249

std.c.netbsd.IP.DEFAULT_MULTICAST_LOOP

constant

Source line 252

std.c.netbsd.IP.DEFAULT_MULTICAST_TTL

constant

Source line 251

std.c.netbsd.IP.DROP_MEMBERSHIP

constant

Source line 239

std.c.netbsd.IP.ERRORMTU

constant

Source line 243

std.c.netbsd.IP.HDRINCL

constant

Source line 228

std.c.netbsd.IP.IPSEC_POLICY

constant

Source line 244

std.c.netbsd.IP.MAX_MEMBERSHIPS

constant

Source line 253

std.c.netbsd.IP.MINTTL

constant

Source line 246

std.c.netbsd.IP.MULTICAST_IF

constant

Source line 235

std.c.netbsd.IP.MULTICAST_LOOP

constant

Source line 237

std.c.netbsd.IP.MULTICAST_TTL

constant

Source line 236

std.c.netbsd.IP.OPTIONS

constant

Source line 227

std.c.netbsd.IP.PKTINFO

constant

Source line 247

std.c.netbsd.IP.PORTALGO

constant

Source line 240

std.c.netbsd.IP.PORTRANGE

constant

Source line 241

std.c.netbsd.IP.PORTRANGE_DEFAULT

constant

Source line 254

std.c.netbsd.IP.PORTRANGE_HIGH

constant

Source line 255

std.c.netbsd.IP.PORTRANGE_LOW

constant

Source line 256

std.c.netbsd.IP.RECVDSTADDR

constant

Source line 233

std.c.netbsd.IP.RECVIF

constant

Source line 242

std.c.netbsd.IP.RECVOPTS

constant

Source line 231

std.c.netbsd.IP.RECVPKTINFO

constant

Source line 248

std.c.netbsd.IP.RECVRETOPTS

constant

Source line 232

std.c.netbsd.IP.RECVTTL

constant

Source line 245

std.c.netbsd.IP.RETOPTS

constant

Source line 234

std.c.netbsd.IP.SENDSRCADDR

alias

Source line 250

Alias of std.c.netbsd.IP.RECVDSTADDR

std.c.netbsd.IP.TOS

constant

Source line 229

std.c.netbsd.IP.TTL

constant

Source line 230

std.c.netbsd.IPTOS

namespace

Source line 313

std.c.netbsd.IPTOS.CE

constant

Source line 365

std.c.netbsd.IPTOS.CLASS

function

Source line 345

pub fn CLASS(t: anytype) @TypeOf(t)

std.c.netbsd.IPTOS.CLASS_CS0

constant

Source line 335

std.c.netbsd.IPTOS.CLASS_CS1

constant

Source line 336

std.c.netbsd.IPTOS.CLASS_CS2

constant

Source line 337

std.c.netbsd.IPTOS.CLASS_CS3

constant

Source line 338

std.c.netbsd.IPTOS.CLASS_CS4

constant

Source line 339

std.c.netbsd.IPTOS.CLASS_CS5

constant

Source line 340

std.c.netbsd.IPTOS.CLASS_CS6

constant

Source line 341

std.c.netbsd.IPTOS.CLASS_CS7

constant

Source line 342

std.c.netbsd.IPTOS.CLASS_DEFAULT

alias

Source line 343

Alias of std.c.netbsd.IPTOS.CLASS_CS0

std.c.netbsd.IPTOS.CLASS_MASK

constant

Source line 344

std.c.netbsd.IPTOS.DSCP

function

Source line 349

pub fn DSCP(t: anytype) @TypeOf(t)

std.c.netbsd.IPTOS.DSCP_AF11

constant

Source line 316

std.c.netbsd.IPTOS.DSCP_AF12

constant

Source line 317

std.c.netbsd.IPTOS.DSCP_AF13

constant

Source line 318

std.c.netbsd.IPTOS.DSCP_AF21

constant

Source line 320

std.c.netbsd.IPTOS.DSCP_AF22

constant

Source line 321

std.c.netbsd.IPTOS.DSCP_AF23

constant

Source line 322

std.c.netbsd.IPTOS.DSCP_AF31

constant

Source line 324

std.c.netbsd.IPTOS.DSCP_AF32

constant

Source line 325

std.c.netbsd.IPTOS.DSCP_AF33

constant

Source line 326

std.c.netbsd.IPTOS.DSCP_AF41

constant

Source line 328

std.c.netbsd.IPTOS.DSCP_AF42

constant

Source line 329

std.c.netbsd.IPTOS.DSCP_AF43

constant

Source line 330

std.c.netbsd.IPTOS.DSCP_CS0

constant

Source line 314

std.c.netbsd.IPTOS.DSCP_CS1

constant

Source line 315

std.c.netbsd.IPTOS.DSCP_CS2

constant

Source line 319

std.c.netbsd.IPTOS.DSCP_CS3

constant

Source line 323

std.c.netbsd.IPTOS.DSCP_CS4

constant

Source line 327

std.c.netbsd.IPTOS.DSCP_CS5

constant

Source line 331

std.c.netbsd.IPTOS.DSCP_CS6

constant

Source line 333

std.c.netbsd.IPTOS.DSCP_CS7

constant

Source line 334

std.c.netbsd.IPTOS.DSCP_EF

constant

Source line 332

std.c.netbsd.IPTOS.DSCP_MASK

constant

Source line 348

std.c.netbsd.IPTOS.ECN

function

Source line 357

pub fn ECN(t: anytype) @TypeOf(t)

std.c.netbsd.IPTOS.ECN_CE

constant

Source line 355

std.c.netbsd.IPTOS.ECN_ECT0

constant

Source line 354

std.c.netbsd.IPTOS.ECN_ECT1

constant

Source line 353

std.c.netbsd.IPTOS.ECN_MASK

constant

Source line 356

std.c.netbsd.IPTOS.ECN_NOT_ECT

constant

Source line 360

std.c.netbsd.IPTOS.ECN_NOTECT

constant

Source line 352

std.c.netbsd.IPTOS.ECT

constant

Source line 366

std.c.netbsd.IPTOS.LOWDELAY

constant

Source line 361

std.c.netbsd.IPTOS.MINCOST

constant

Source line 364

std.c.netbsd.IPTOS.PREC_CRITIC_ECP

constant

Source line 369

std.c.netbsd.IPTOS.PREC_FLASH

constant

Source line 371

std.c.netbsd.IPTOS.PREC_FLASHOVERRIDE

constant

Source line 370

std.c.netbsd.IPTOS.PREC_IMMEDIATE

constant

Source line 372

std.c.netbsd.IPTOS.PREC_INTERNETCONTROL

constant

Source line 368

std.c.netbsd.IPTOS.PREC_NETCONTROL

constant

Source line 367

std.c.netbsd.IPTOS.PREC_PRIORITY

constant

Source line 373

std.c.netbsd.IPTOS.PREC_ROUTINE

constant

Source line 374

std.c.netbsd.IPTOS.RELIABILITY

constant

Source line 363

std.c.netbsd.IPTOS.THROUGHPUT

constant

Source line 362

std.c.netbsd.IPV6

namespace

Source line 260

std.c.netbsd.IPV6.@"2292DSTOPTS"

constant

Source line 273

std.c.netbsd.IPV6.@"2292HOPLIMIT"

constant

Source line 270

std.c.netbsd.IPV6.@"2292HOPOPTS"

constant

Source line 272

std.c.netbsd.IPV6.@"2292NEXTHOP"

constant

Source line 271

std.c.netbsd.IPV6.@"2292PKTINFO"

constant

Source line 269

std.c.netbsd.IPV6.@"2292PKTOPTIONS"

constant

Source line 275

std.c.netbsd.IPV6.@"2292RTHDR"

constant

Source line 274

std.c.netbsd.IPV6.BINDANY

constant

Source line 301

std.c.netbsd.IPV6.CHECKSUM

constant

Source line 276

std.c.netbsd.IPV6.DEFAULT_MULTICAST_HOPS

constant

Source line 305

std.c.netbsd.IPV6.DEFAULT_MULTICAST_LOOP

constant

Source line 306

std.c.netbsd.IPV6.DONTFRAG

constant

Source line 299

std.c.netbsd.IPV6.DSTOPTS

constant

Source line 294

std.c.netbsd.IPV6.FAITH

constant

Source line 279

std.c.netbsd.IPV6.HOPLIMIT

constant

Source line 291

std.c.netbsd.IPV6.HOPOPTS

constant

Source line 293

std.c.netbsd.IPV6.IPSEC_POLICY

constant

Source line 278

std.c.netbsd.IPV6.JOIN_GROUP

constant

Source line 265

std.c.netbsd.IPV6.LEAVE_GROUP

constant

Source line 266

std.c.netbsd.IPV6.MULTICAST_HOPS

constant

Source line 263

std.c.netbsd.IPV6.MULTICAST_IF

constant

Source line 262

std.c.netbsd.IPV6.MULTICAST_LOOP

constant

Source line 264

std.c.netbsd.IPV6.NEXTHOP

constant

Source line 292

std.c.netbsd.IPV6.OTCLASS

constant

Source line 297

std.c.netbsd.IPV6.PATHMTU

constant

Source line 289

std.c.netbsd.IPV6.PKTINFO

constant

Source line 290

std.c.netbsd.IPV6.PORTALGO

constant

Source line 268

std.c.netbsd.IPV6.PORTRANGE

constant

Source line 267

std.c.netbsd.IPV6.PORTRANGE_DEFAULT

constant

Source line 307

std.c.netbsd.IPV6.PORTRANGE_HIGH

constant

Source line 308

std.c.netbsd.IPV6.PORTRANGE_LOW

constant

Source line 309

std.c.netbsd.IPV6.PREFER_TEMPADDR

constant

Source line 300

std.c.netbsd.IPV6.RECVDSTOPTS

constant

Source line 285

std.c.netbsd.IPV6.RECVHOPLIMIT

constant

Source line 282

std.c.netbsd.IPV6.RECVHOPOPTS

constant

Source line 284

std.c.netbsd.IPV6.RECVPATHMTU

constant

Source line 288

std.c.netbsd.IPV6.RECVPKTINFO

constant

Source line 281

std.c.netbsd.IPV6.RECVRTHDR

constant

Source line 283

std.c.netbsd.IPV6.RECVRTHDRDSTOPTS

constant

Source line 286

std.c.netbsd.IPV6.RECVTCLASS

constant

Source line 296

std.c.netbsd.IPV6.RTHDR

constant

Source line 295

std.c.netbsd.IPV6.RTHDR_LOOSE

constant

Source line 302

std.c.netbsd.IPV6.RTHDR_STRICT

constant

Source line 303

std.c.netbsd.IPV6.RTHDR_TYPE_0

constant

Source line 304

std.c.netbsd.IPV6.RTHDRDSTOPTS

constant

Source line 280

std.c.netbsd.IPV6.TCLASS

constant

Source line 298

std.c.netbsd.IPV6.UNICAST_HOPS

constant

Source line 261

std.c.netbsd.IPV6.USE_MIN_MTU

constant

Source line 287

std.c.netbsd.IPV6.V6ONLY

constant

Source line 277

std.c.netbsd.lwpid_t

type

Source line 12

std.c.netbsd.pid_t

alias

Source line 4

Alias of std.c.pid_t

std.c.netbsd.pthread_setname_np

function

Source line 14

pub extern "c" fn pthread_setname_np(thread: pthread_t, name: [*:0]const u8, arg: ?*anyopaque) c_int

Parameters

thread: pthread_t
name: [*:0]const u8
arg: ?*anyopaque

std.c.netbsd.pthread_t

alias

Source line 5

Alias of std.c.pthread_t

std.c.netbsd.ptrace

function

Source line 10

pub extern "c" fn ptrace(request: c_int, pid: pid_t, addr: ?*anyopaque, data: c_int) c_int

Parameters

request: c_int
pid: pid_t
addr: ?*anyopaque
data: c_int

std.c.netbsd.sigval_t

alias

Source line 6

Alias of std.c.sigval_t

std.c.netbsd.std

alias

Source line 1

Alias of std

std.c.netbsd.TCIFLUSH

constant

Source line 33

std.c.netbsd.TCIOFF

constant

Source line 38

std.c.netbsd.TCIOFLUSH

constant

Source line 35

std.c.netbsd.TCION

constant

Source line 39

std.c.netbsd.TCOFLUSH

constant

Source line 34

std.c.netbsd.TCOOFF

constant

Source line 36

std.c.netbsd.TCOON

constant

Source line 37

std.c.netbsd.TCP

namespace

Source line 378

std.c.netbsd.TCP.CONGCTL

constant

Source line 387

std.c.netbsd.TCP.INFO

constant

Source line 385

std.c.netbsd.TCP.KEEPCNT

constant

Source line 383

std.c.netbsd.TCP.KEEPIDLE

constant

Source line 381

std.c.netbsd.TCP.KEEPINIT

constant

Source line 384

std.c.netbsd.TCP.KEEPINTVL

constant

Source line 382

std.c.netbsd.TCP.MAXSEG

constant

Source line 380

std.c.netbsd.TCP.MD5SIG

constant

Source line 386

std.c.netbsd.TCP.NODELAY

constant

Source line 379

std.c.netbsd.timespec

alias

Source line 8

Alias of std.c.timespec

std.c.netbsd.uid_t

alias

Source line 7

Alias of std.c.uid_t

Source code

std/c/netbsd.zig

const std = @import("../std.zig");
const clock_t = std.c.clock_t;
const clockid_t = std.c.clockid_t;
const pid_t = std.c.pid_t;
const pthread_t = std.c.pthread_t;
const sigval_t = std.c.sigval_t;
const uid_t = std.c.uid_t;
const timespec = std.c.timespec;

pub extern "c" fn ptrace(request: c_int, pid: pid_t, addr: ?*anyopaque, data: c_int) c_int;

pub const lwpid_t = i32;

pub extern "c" fn pthread_setname_np(thread: pthread_t, name: [*:0]const u8, arg: ?*anyopaque) c_int;

pub extern "c" fn _lwp_self() lwpid_t;

pub extern "c" fn ___lwp_park60(
    clock_id: clockid_t,
    flags: packed struct(u32) {
        ABSTIME: bool = false,
        unused: u31 = 0,
    },
    ts: ?*timespec,
    unpark: lwpid_t,
    hint: ?*const anyopaque,
    unpark_hint: ?*const anyopaque,
) c_int;

pub extern "c" fn _lwp_unpark(lwp: lwpid_t, hint: ?*const anyopaque) c_int;
pub extern "c" fn _lwp_unpark_all(targets: [*]const lwpid_t, ntargets: usize, hint: ?*const anyopaque) c_int;

pub const TCIFLUSH = 1;
pub const TCOFLUSH = 2;
pub const TCIOFLUSH = 3;
pub const TCOOFF = 1;
pub const TCOON = 2;
pub const TCIOFF = 3;
pub const TCION = 4;

pub const _ksiginfo = extern struct {
    signo: std.c.SIG,
    code: i32,
    errno: i32,
    // 64bit architectures insert 4bytes of padding here, this is done by
    // correctly aligning the reason field
    reason: extern union {
        rt: extern struct {
            pid: pid_t,
            uid: uid_t,
            value: sigval_t,
        },
        child: extern struct {
            pid: pid_t,
            uid: uid_t,
            status: i32,
            utime: clock_t,
            stime: clock_t,
        },
        fault: extern struct {
            addr: *allowzero anyopaque,
            trap: i32,
            trap2: i32,
            trap3: i32,
        },
        poll: extern struct {
            band: i32,
            fd: i32,
        },
        syscall: extern struct {
            sysnum: i32,
            retval: [2]i32,
            @"error": i32,
            args: [8]u64,
        },
        ptrace_state: extern struct {
            pe_report_event: i32,
            option: extern union {
                pe_other_pid: pid_t,
                pe_lwp: lwpid_t,
            },
        },
    } align(@sizeOf(usize)),
};

pub const E = enum(u16) {
    /// No error occurred.
    SUCCESS = 0,
    PERM = 1, // Operation not permitted
    NOENT = 2, // No such file or directory
    SRCH = 3, // No such process
    INTR = 4, // Interrupted system call
    IO = 5, // Input/output error
    NXIO = 6, // Device not configured
    @"2BIG" = 7, // Argument list too long
    NOEXEC = 8, // Exec format error
    BADF = 9, // Bad file descriptor
    CHILD = 10, // No child processes
    DEADLK = 11, // Resource deadlock avoided
    // 11 was AGAIN
    NOMEM = 12, // Cannot allocate memory
    ACCES = 13, // Permission denied
    FAULT = 14, // Bad address
    NOTBLK = 15, // Block device required
    BUSY = 16, // Device busy
    EXIST = 17, // File exists
    XDEV = 18, // Cross-device link
    NODEV = 19, // Operation not supported by device
    NOTDIR = 20, // Not a directory
    ISDIR = 21, // Is a directory
    INVAL = 22, // Invalid argument
    NFILE = 23, // Too many open files in system
    MFILE = 24, // Too many open files
    NOTTY = 25, // Inappropriate ioctl for device
    TXTBSY = 26, // Text file busy
    FBIG = 27, // File too large
    NOSPC = 28, // No space left on device
    SPIPE = 29, // Illegal seek
    ROFS = 30, // Read-only file system
    MLINK = 31, // Too many links
    PIPE = 32, // Broken pipe

    // math software
    DOM = 33, // Numerical argument out of domain
    RANGE = 34, // Result too large or too small

    // non-blocking and interrupt i/o
    // also: WOULDBLOCK: operation would block
    AGAIN = 35, // Resource temporarily unavailable
    INPROGRESS = 36, // Operation now in progress
    ALREADY = 37, // Operation already in progress

    // ipc/network software -- argument errors
    NOTSOCK = 38, // Socket operation on non-socket
    DESTADDRREQ = 39, // Destination address required
    MSGSIZE = 40, // Message too long
    PROTOTYPE = 41, // Protocol wrong type for socket
    NOPROTOOPT = 42, // Protocol option not available
    PROTONOSUPPORT = 43, // Protocol not supported
    SOCKTNOSUPPORT = 44, // Socket type not supported
    OPNOTSUPP = 45, // Operation not supported
    PFNOSUPPORT = 46, // Protocol family not supported
    AFNOSUPPORT = 47, // Address family not supported by protocol family
    ADDRINUSE = 48, // Address already in use
    ADDRNOTAVAIL = 49, // Can't assign requested address

    // ipc/network software -- operational errors
    NETDOWN = 50, // Network is down
    NETUNREACH = 51, // Network is unreachable
    NETRESET = 52, // Network dropped connection on reset
    CONNABORTED = 53, // Software caused connection abort
    CONNRESET = 54, // Connection reset by peer
    NOBUFS = 55, // No buffer space available
    ISCONN = 56, // Socket is already connected
    NOTCONN = 57, // Socket is not connected
    SHUTDOWN = 58, // Can't send after socket shutdown
    TOOMANYREFS = 59, // Too many references: can't splice
    TIMEDOUT = 60, // Operation timed out
    CONNREFUSED = 61, // Connection refused

    LOOP = 62, // Too many levels of symbolic links
    NAMETOOLONG = 63, // File name too long

    // should be rearranged
    HOSTDOWN = 64, // Host is down
    HOSTUNREACH = 65, // No route to host
    NOTEMPTY = 66, // Directory not empty

    // quotas & mush
    PROCLIM = 67, // Too many processes
    USERS = 68, // Too many users
    DQUOT = 69, // Disc quota exceeded

    // Network File System
    STALE = 70, // Stale NFS file handle
    REMOTE = 71, // Too many levels of remote in path
    BADRPC = 72, // RPC struct is bad
    RPCMISMATCH = 73, // RPC version wrong
    PROGUNAVAIL = 74, // RPC prog. not avail
    PROGMISMATCH = 75, // Program version wrong
    PROCUNAVAIL = 76, // Bad procedure for program

    NOLCK = 77, // No locks available
    NOSYS = 78, // Function not implemented

    FTYPE = 79, // Inappropriate file type or format
    AUTH = 80, // Authentication error
    NEEDAUTH = 81, // Need authenticator

    // SystemV IPC
    IDRM = 82, // Identifier removed
    NOMSG = 83, // No message of desired type
    OVERFLOW = 84, // Value too large to be stored in data type

    // Wide/multibyte-character handling, ISO/IEC 9899/AMD1:1995
    ILSEQ = 85, // Illegal byte sequence

    // From IEEE Std 1003.1-2001
    // Base, Realtime, Threads or Thread Priority Scheduling option errors
    NOTSUP = 86, // Not supported

    // Realtime option errors
    CANCELED = 87, // Operation canceled

    // Realtime, XSI STREAMS option errors
    BADMSG = 88, // Bad or Corrupt message

    // XSI STREAMS option errors
    NODATA = 89, // No message available
    NOSR = 90, // No STREAM resources
    NOSTR = 91, // Not a STREAM
    TIME = 92, // STREAM ioctl timeout

    // File system extended attribute errors
    NOATTR = 93, // Attribute not found

    // Realtime, XSI STREAMS option errors
    MULTIHOP = 94, // Multihop attempted
    NOLINK = 95, // Link has been severed
    PROTO = 96, // Protocol error

    _,
};

// https://github.com/NetBSD/src/blob/80bf25a5691072d4755e84567ccbdf0729370dea/sys/netinet/in.h#L276
pub const IP = struct {
    pub const OPTIONS = 1;
    pub const HDRINCL = 2;
    pub const TOS = 3;
    pub const TTL = 4;
    pub const RECVOPTS = 5;
    pub const RECVRETOPTS = 6;
    pub const RECVDSTADDR = 7;
    pub const RETOPTS = 8;
    pub const MULTICAST_IF = 9;
    pub const MULTICAST_TTL = 10;
    pub const MULTICAST_LOOP = 11;
    pub const ADD_MEMBERSHIP = 12;
    pub const DROP_MEMBERSHIP = 13;
    pub const PORTALGO = 18;
    pub const PORTRANGE = 19;
    pub const RECVIF = 20;
    pub const ERRORMTU = 21;
    pub const IPSEC_POLICY = 22;
    pub const RECVTTL = 23;
    pub const MINTTL = 24;
    pub const PKTINFO = 25;
    pub const RECVPKTINFO = 26;
    pub const BINDANY = 27;
    pub const SENDSRCADDR = RECVDSTADDR;
    pub const DEFAULT_MULTICAST_TTL = 1;
    pub const DEFAULT_MULTICAST_LOOP = 1;
    pub const MAX_MEMBERSHIPS = 20;
    pub const PORTRANGE_DEFAULT = 0;
    pub const PORTRANGE_HIGH = 1;
    pub const PORTRANGE_LOW = 2;
};

// https://github.com/NetBSD/src/blob/80bf25a5691072d4755e84567ccbdf0729370dea/sys/netinet6/in6.h#L370
pub const IPV6 = struct {
    pub const UNICAST_HOPS = 4;
    pub const MULTICAST_IF = 9;
    pub const MULTICAST_HOPS = 10;
    pub const MULTICAST_LOOP = 11;
    pub const JOIN_GROUP = 12;
    pub const LEAVE_GROUP = 13;
    pub const PORTRANGE = 14;
    pub const PORTALGO = 17;
    pub const @"2292PKTINFO" = 19;
    pub const @"2292HOPLIMIT" = 20;
    pub const @"2292NEXTHOP" = 21;
    pub const @"2292HOPOPTS" = 22;
    pub const @"2292DSTOPTS" = 23;
    pub const @"2292RTHDR" = 24;
    pub const @"2292PKTOPTIONS" = 25;
    pub const CHECKSUM = 26;
    pub const V6ONLY = 27;
    pub const IPSEC_POLICY = 28;
    pub const FAITH = 29;
    pub const RTHDRDSTOPTS = 35;
    pub const RECVPKTINFO = 36;
    pub const RECVHOPLIMIT = 37;
    pub const RECVRTHDR = 38;
    pub const RECVHOPOPTS = 39;
    pub const RECVDSTOPTS = 40;
    pub const RECVRTHDRDSTOPTS = 41;
    pub const USE_MIN_MTU = 42;
    pub const RECVPATHMTU = 43;
    pub const PATHMTU = 44;
    pub const PKTINFO = 46;
    pub const HOPLIMIT = 47;
    pub const NEXTHOP = 48;
    pub const HOPOPTS = 49;
    pub const DSTOPTS = 50;
    pub const RTHDR = 51;
    pub const RECVTCLASS = 57;
    pub const OTCLASS = 58;
    pub const TCLASS = 61;
    pub const DONTFRAG = 62;
    pub const PREFER_TEMPADDR = 63;
    pub const BINDANY = 64;
    pub const RTHDR_LOOSE = 0;
    pub const RTHDR_STRICT = 1;
    pub const RTHDR_TYPE_0 = 0;
    pub const DEFAULT_MULTICAST_HOPS = 1;
    pub const DEFAULT_MULTICAST_LOOP = 1;
    pub const PORTRANGE_DEFAULT = 0;
    pub const PORTRANGE_HIGH = 1;
    pub const PORTRANGE_LOW = 2;
};

// https://github.com/NetBSD/src/blob/80bf25a5691072d4755e84567ccbdf0729370dea/sys/netinet/ip.h#L140
pub const IPTOS = struct {
    pub const DSCP_CS0 = 0x00;
    pub const DSCP_CS1 = 0x20;
    pub const DSCP_AF11 = 0x28;
    pub const DSCP_AF12 = 0x30;
    pub const DSCP_AF13 = 0x38;
    pub const DSCP_CS2 = 0x40;
    pub const DSCP_AF21 = 0x48;
    pub const DSCP_AF22 = 0x50;
    pub const DSCP_AF23 = 0x58;
    pub const DSCP_CS3 = 0x60;
    pub const DSCP_AF31 = 0x68;
    pub const DSCP_AF32 = 0x70;
    pub const DSCP_AF33 = 0x78;
    pub const DSCP_CS4 = 0x80;
    pub const DSCP_AF41 = 0x88;
    pub const DSCP_AF42 = 0x90;
    pub const DSCP_AF43 = 0x98;
    pub const DSCP_CS5 = 0xa0;
    pub const DSCP_EF = 0xb8;
    pub const DSCP_CS6 = 0xc0;
    pub const DSCP_CS7 = 0xe0;
    pub const CLASS_CS0 = 0x00;
    pub const CLASS_CS1 = 0x20;
    pub const CLASS_CS2 = 0x40;
    pub const CLASS_CS3 = 0x60;
    pub const CLASS_CS4 = 0x80;
    pub const CLASS_CS5 = 0xa0;
    pub const CLASS_CS6 = 0xc0;
    pub const CLASS_CS7 = 0xe0;
    pub const CLASS_DEFAULT = CLASS_CS0;
    pub const CLASS_MASK = 0xe0;
    pub fn CLASS(t: anytype) @TypeOf(t) {
        return t & CLASS_MASK;
    }
    pub const DSCP_MASK = 0xfc;
    pub fn DSCP(t: anytype) @TypeOf(t) {
        return t & DSCP_MASK;
    }
    pub const ECN_NOTECT = 0x00;
    pub const ECN_ECT1 = 0x01;
    pub const ECN_ECT0 = 0x02;
    pub const ECN_CE = 0x03;
    pub const ECN_MASK = 0x03;
    pub fn ECN(t: anytype) @TypeOf(t) {
        return t & ECN_MASK;
    }
    pub const ECN_NOT_ECT = 0x00;
    pub const LOWDELAY = 0x10;
    pub const THROUGHPUT = 0x08;
    pub const RELIABILITY = 0x04;
    pub const MINCOST = 0x02;
    pub const CE = 0x01;
    pub const ECT = 0x02;
    pub const PREC_NETCONTROL = 0xe0;
    pub const PREC_INTERNETCONTROL = 0xc0;
    pub const PREC_CRITIC_ECP = 0xa0;
    pub const PREC_FLASHOVERRIDE = 0x80;
    pub const PREC_FLASH = 0x60;
    pub const PREC_IMMEDIATE = 0x40;
    pub const PREC_PRIORITY = 0x20;
    pub const PREC_ROUTINE = 0x00;
};

// https://github.com/NetBSD/src/blob/2579a44b3da9597de159e42cb1b5db0d382bd511/sys/netinet/tcp.h#L126
pub const TCP = struct {
    pub const NODELAY = 1;
    pub const MAXSEG = 2;
    pub const KEEPIDLE = 3;
    pub const KEEPINTVL = 5;
    pub const KEEPCNT = 6;
    pub const KEEPINIT = 7;
    pub const INFO = 9;
    pub const MD5SIG = 0x10;
    pub const CONGCTL = 0x20;
};