Skip to content
Standard libraryZig 0.17.0Official documentation
Sourcestd/c/freebsd.zig

Source line 1

std.c.freebsd._umtx_op

function

Source line 81

pub extern "c" fn _umtx_op(obj: usize, op: c_int, val: c_ulong, uaddr: usize, uaddr2: usize) c_int

Parameters

obj: usize
op: c_int
val: c_ulong
uaddr: usize
uaddr2: usize

std.c.freebsd._umtx_time

container

Source line 75

Fields

timeout: timespec
flags: u32
clockid: clockid_t

std.c.freebsd.assert

alias

Source line 3

Alias of std.debug.assert

std.c.freebsd.blkcnt_t

alias

Source line 6

Alias of std.c.blkcnt_t

std.c.freebsd.blksize_t

alias

Source line 7

Alias of std.c.blksize_t

std.c.freebsd.builtin

constant

Source line 1

std.c.freebsd.caddr_t

alias

Source line 8

Alias of std.c.caddr_t

std.c.freebsd.cap_rights

container

Source line 144

Fields

rights: [CAP_RIGHTS_VERSION + 2]u64

std.c.freebsd.CAP_RIGHTS_VERSION

constant

Source line 142

std.c.freebsd.clockid_t

alias

Source line 23

Alias of std.c.clockid_t

std.c.freebsd.copy_file_range

function

Source line 32

pub extern "c" fn copy_file_range(fd_in: fd_t, off_in: ?*off_t, fd_out: fd_t, off_out: ?*off_t, len: usize, flags: u32) isize

Parameters

fd_in: fd_t
off_in: ?*off_t
fd_out: fd_t
off_out: ?*off_t
len: usize
flags: u32

std.c.freebsd.dev_t

alias

Source line 9

Alias of std.c.dev_t

std.c.freebsd.E

container

Source line 268

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

Resource temporarily unavailable This code is also used for WOULDBLOCK: operation would block.

INPROGRESS = 36
ALREADY = 37
NOTSOCK = 38
DESTADDRREQ = 39
MSGSIZE = 40
PROTOTYPE = 41
NOPROTOOPT = 42
PROTONOSUPPORT = 43
SOCKTNOSUPPORT = 44
OPNOTSUPP = 45

Operation not supported This code is also used for NOTSUP.

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
CANCELED = 85
ILSEQ = 86
NOATTR = 87
DOOFUS = 88
BADMSG = 89
MULTIHOP = 90
NOLINK = 91
PROTO = 92
NOTCAPABLE = 93
CAPMODE = 94
NOTRECOVERABLE = 95
OWNERDEAD = 96
INTEGRITY = 97
_

std.c.freebsd.fd_t

alias

Source line 10

Alias of std.c.fd_t

std.c.freebsd.fflags_t

type

Source line 83

std.c.freebsd.fsblkcnt_t

type

Source line 139

std.c.freebsd.fsfilcnt_t

type

Source line 140

std.c.freebsd.gid_t

alias

Source line 11

Alias of std.c.gid_t

std.c.freebsd.ino_t

alias

Source line 12

Alias of std.c.ino_t

std.c.freebsd.iovec_const

alias

Source line 13

Alias of std.posix.iovec_const

std.c.freebsd.IP

namespace

Source line 399

std.c.freebsd.IP.ADD_MEMBERSHIP

constant

Source line 412

std.c.freebsd.IP.ADD_SOURCE_MEMBERSHIP

constant

Source line 451

std.c.freebsd.IP.BINDANY

constant

Source line 423

std.c.freebsd.IP.BLOCK_SOURCE

constant

Source line 453

std.c.freebsd.IP.DEFAULT_MULTICAST_LOOP

constant

Source line 464

std.c.freebsd.IP.DEFAULT_MULTICAST_TTL

constant

Source line 463

std.c.freebsd.IP.DONTFRAG

constant

Source line 449

std.c.freebsd.IP.DROP_MEMBERSHIP

constant

Source line 413

std.c.freebsd.IP.DROP_SOURCE_MEMBERSHIP

constant

Source line 452

std.c.freebsd.IP.DUMMYNET_CONFIGURE

constant

Source line 443

std.c.freebsd.IP.DUMMYNET_DEL

constant

Source line 444

std.c.freebsd.IP.DUMMYNET_FLUSH

constant

Source line 445

std.c.freebsd.IP.DUMMYNET_GET

constant

Source line 446

std.c.freebsd.IP.DUMMYNET3

constant

Source line 432

std.c.freebsd.IP.FLOWID

constant

Source line 457

std.c.freebsd.IP.FLOWTYPE

constant

Source line 458

std.c.freebsd.IP.FW_ADD

constant

Source line 433

std.c.freebsd.IP.FW_DEL

constant

Source line 434

std.c.freebsd.IP.FW_FLUSH

constant

Source line 435

std.c.freebsd.IP.FW_GET

constant

Source line 437

std.c.freebsd.IP.FW_NAT_CFG

constant

Source line 439

std.c.freebsd.IP.FW_NAT_DEL

constant

Source line 440

std.c.freebsd.IP.FW_NAT_GET_CONFIG

constant

Source line 441

std.c.freebsd.IP.FW_NAT_GET_LOG

constant

Source line 442

std.c.freebsd.IP.FW_RESETLOG

constant

Source line 438

std.c.freebsd.IP.FW_TABLE_ADD

constant

Source line 426

std.c.freebsd.IP.FW_TABLE_DEL

constant

Source line 427

std.c.freebsd.IP.FW_TABLE_FLUSH

constant

Source line 428

std.c.freebsd.IP.FW_TABLE_GETSIZE

constant

Source line 429

std.c.freebsd.IP.FW_TABLE_LIST

constant

Source line 430

std.c.freebsd.IP.FW_ZERO

constant

Source line 436

std.c.freebsd.IP.FW3

constant

Source line 431

std.c.freebsd.IP.HDRINCL

constant

Source line 401

std.c.freebsd.IP.IPSEC_POLICY

constant

Source line 421

std.c.freebsd.IP.MAX_GROUP_SRC_FILTER

constant

Source line 466

std.c.freebsd.IP.MAX_MEMBERSHIPS

constant

Source line 465

std.c.freebsd.IP.MAX_SOCK_MUTE_FILTER

constant

Source line 468

std.c.freebsd.IP.MAX_SOCK_SRC_FILTER

constant

Source line 467

std.c.freebsd.IP.MINTTL

constant

Source line 448

std.c.freebsd.IP.MSFILTER

constant

Source line 455

std.c.freebsd.IP.MULTICAST_IF

constant

Source line 409

std.c.freebsd.IP.MULTICAST_LOOP

constant

Source line 411

std.c.freebsd.IP.MULTICAST_TTL

constant

Source line 410

std.c.freebsd.IP.MULTICAST_VIF

constant

Source line 414

std.c.freebsd.IP.ONESBCAST

constant

Source line 422

std.c.freebsd.IP.OPTIONS

constant

Source line 400

std.c.freebsd.IP.ORIGDSTADDR

constant

Source line 424

std.c.freebsd.IP.PORTRANGE

constant

Source line 419

std.c.freebsd.IP.PORTRANGE_DEFAULT

constant

Source line 469

std.c.freebsd.IP.PORTRANGE_HIGH

constant

Source line 470

std.c.freebsd.IP.PORTRANGE_LOW

constant

Source line 471

std.c.freebsd.IP.RECVDSTADDR

constant

Source line 406

std.c.freebsd.IP.RECVFLOWID

constant

Source line 460

std.c.freebsd.IP.RECVIF

constant

Source line 420

std.c.freebsd.IP.RECVOPTS

constant

Source line 404

std.c.freebsd.IP.RECVORIGDSTADDR

alias

Source line 425

Alias of std.c.freebsd.IP.ORIGDSTADDR

std.c.freebsd.IP.RECVRETOPTS

constant

Source line 405

std.c.freebsd.IP.RECVRSSBUCKETID

constant

Source line 461

std.c.freebsd.IP.RECVTOS

constant

Source line 450

std.c.freebsd.IP.RECVTTL

constant

Source line 447

std.c.freebsd.IP.RETOPTS

constant

Source line 408

std.c.freebsd.IP.RSSBUCKETID

constant

Source line 459

std.c.freebsd.IP.RSVP_OFF

constant

Source line 416

std.c.freebsd.IP.RSVP_ON

constant

Source line 415

std.c.freebsd.IP.RSVP_VIF_OFF

constant

Source line 418

std.c.freebsd.IP.RSVP_VIF_ON

constant

Source line 417

std.c.freebsd.IP.SENDSRCADDR

alias

Source line 407

Alias of std.c.freebsd.IP.RECVDSTADDR

std.c.freebsd.IP.TOS

constant

Source line 402

std.c.freebsd.IP.TTL

constant

Source line 403

std.c.freebsd.IP.UNBLOCK_SOURCE

constant

Source line 454

std.c.freebsd.IP.VLAN_PCP

constant

Source line 456

std.c.freebsd.IPTOS

namespace

Source line 547

std.c.freebsd.IPTOS.DSCP_AF11

constant

Source line 563

std.c.freebsd.IPTOS.DSCP_AF12

constant

Source line 564

std.c.freebsd.IPTOS.DSCP_AF13

constant

Source line 565

std.c.freebsd.IPTOS.DSCP_AF21

constant

Source line 567

std.c.freebsd.IPTOS.DSCP_AF22

constant

Source line 568

std.c.freebsd.IPTOS.DSCP_AF23

constant

Source line 569

std.c.freebsd.IPTOS.DSCP_AF31

constant

Source line 571

std.c.freebsd.IPTOS.DSCP_AF32

constant

Source line 572

std.c.freebsd.IPTOS.DSCP_AF33

constant

Source line 573

std.c.freebsd.IPTOS.DSCP_AF41

constant

Source line 575

std.c.freebsd.IPTOS.DSCP_AF42

constant

Source line 576

std.c.freebsd.IPTOS.DSCP_AF43

constant

Source line 577

std.c.freebsd.IPTOS.DSCP_CS0

constant

Source line 561

std.c.freebsd.IPTOS.DSCP_CS1

constant

Source line 562

std.c.freebsd.IPTOS.DSCP_CS2

constant

Source line 566

std.c.freebsd.IPTOS.DSCP_CS3

constant

Source line 570

std.c.freebsd.IPTOS.DSCP_CS4

constant

Source line 574

std.c.freebsd.IPTOS.DSCP_CS5

constant

Source line 578

std.c.freebsd.IPTOS.DSCP_CS6

constant

Source line 581

std.c.freebsd.IPTOS.DSCP_CS7

constant

Source line 582

std.c.freebsd.IPTOS.DSCP_EF

constant

Source line 580

std.c.freebsd.IPTOS.DSCP_OFFSET

constant

Source line 560

std.c.freebsd.IPTOS.DSCP_VA

constant

Source line 579

std.c.freebsd.IPTOS.ECN_CE

constant

Source line 586

std.c.freebsd.IPTOS.ECN_ECT0

constant

Source line 585

std.c.freebsd.IPTOS.ECN_ECT1

constant

Source line 584

std.c.freebsd.IPTOS.ECN_MASK

constant

Source line 587

std.c.freebsd.IPTOS.ECN_NOTECT

constant

Source line 583

std.c.freebsd.IPTOS.LOWDELAY

constant

Source line 548

std.c.freebsd.IPTOS.MINCOST

alias

Source line 551

Alias of std.c.freebsd.IPTOS.DSCP_CS0

std.c.freebsd.IPTOS.PREC_CRITIC_ECP

alias

Source line 557

Alias of std.c.freebsd.IPTOS.DSCP_CS5

std.c.freebsd.IPTOS.PREC_FLASH

alias

Source line 555

Alias of std.c.freebsd.IPTOS.DSCP_CS3

std.c.freebsd.IPTOS.PREC_FLASHOVERRIDE

alias

Source line 556

Alias of std.c.freebsd.IPTOS.DSCP_CS4

std.c.freebsd.IPTOS.PREC_IMMEDIATE

alias

Source line 554

Alias of std.c.freebsd.IPTOS.DSCP_CS2

std.c.freebsd.IPTOS.PREC_INTERNETCONTROL

alias

Source line 558

Alias of std.c.freebsd.IPTOS.DSCP_CS6

std.c.freebsd.IPTOS.PREC_NETCONTROL

alias

Source line 559

Alias of std.c.freebsd.IPTOS.DSCP_CS7

std.c.freebsd.IPTOS.PREC_PRIORITY

alias

Source line 553

Alias of std.c.freebsd.IPTOS.DSCP_CS1

std.c.freebsd.IPTOS.PREC_ROUTINE

alias

Source line 552

Alias of std.c.freebsd.IPTOS.DSCP_CS0

std.c.freebsd.IPTOS.RELIABILITY

constant

Source line 550

std.c.freebsd.IPTOS.THROUGHPUT

constant

Source line 549

std.c.freebsd.IPV6

namespace

Source line 475

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

constant

Source line 487

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

constant

Source line 484

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

constant

Source line 486

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

constant

Source line 485

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

constant

Source line 483

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

constant

Source line 489

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

constant

Source line 488

std.c.freebsd.IPV6.AUTOFLOWLABEL

constant

Source line 518

std.c.freebsd.IPV6.BINDANY

constant

Source line 522

std.c.freebsd.IPV6.BINDV6ONLY

alias

Source line 492

Alias of std.c.freebsd.IPV6.V6ONLY

std.c.freebsd.IPV6.CHECKSUM

constant

Source line 490

std.c.freebsd.IPV6.DEFAULT_MULTICAST_HOPS

constant

Source line 536

std.c.freebsd.IPV6.DEFAULT_MULTICAST_LOOP

constant

Source line 537

std.c.freebsd.IPV6.DONTFRAG

constant

Source line 520

std.c.freebsd.IPV6.DSTOPTS

constant

Source line 514

std.c.freebsd.IPV6.FLOWID

constant

Source line 523

std.c.freebsd.IPV6.FLOWTYPE

constant

Source line 524

std.c.freebsd.IPV6.FW_ADD

constant

Source line 494

std.c.freebsd.IPV6.FW_DEL

constant

Source line 495

std.c.freebsd.IPV6.FW_FLUSH

constant

Source line 496

std.c.freebsd.IPV6.FW_GET

constant

Source line 498

std.c.freebsd.IPV6.FW_ZERO

constant

Source line 497

std.c.freebsd.IPV6.HOPLIMIT

constant

Source line 511

std.c.freebsd.IPV6.HOPOPTS

constant

Source line 513

std.c.freebsd.IPV6.IPSEC_POLICY

constant

Source line 493

std.c.freebsd.IPV6.JOIN_GROUP

constant

Source line 480

std.c.freebsd.IPV6.LEAVE_GROUP

constant

Source line 481

std.c.freebsd.IPV6.MAX_GROUP_SRC_FILTER

constant

Source line 539

std.c.freebsd.IPV6.MAX_MEMBERSHIPS

constant

Source line 538

std.c.freebsd.IPV6.MAX_SOCK_SRC_FILTER

constant

Source line 540

std.c.freebsd.IPV6.MSFILTER

constant

Source line 530

std.c.freebsd.IPV6.MULTICAST_HOPS

constant

Source line 478

std.c.freebsd.IPV6.MULTICAST_IF

constant

Source line 477

std.c.freebsd.IPV6.MULTICAST_LOOP

constant

Source line 479

std.c.freebsd.IPV6.NEXTHOP

constant

Source line 512

std.c.freebsd.IPV6.ORIGDSTADDR

constant

Source line 528

std.c.freebsd.IPV6.PATHMTU

constant

Source line 508

std.c.freebsd.IPV6.PKTINFO

constant

Source line 510

std.c.freebsd.IPV6.PKTOPTIONS

constant

Source line 516

std.c.freebsd.IPV6.PORTRANGE

constant

Source line 482

std.c.freebsd.IPV6.PORTRANGE_DEFAULT

constant

Source line 541

std.c.freebsd.IPV6.PORTRANGE_HIGH

constant

Source line 542

std.c.freebsd.IPV6.PORTRANGE_LOW

constant

Source line 543

std.c.freebsd.IPV6.PREFER_TEMPADDR

constant

Source line 521

std.c.freebsd.IPV6.REACHCONF

constant

Source line 509

std.c.freebsd.IPV6.RECVDSTOPTS

constant

Source line 504

std.c.freebsd.IPV6.RECVFLOWID

constant

Source line 526

std.c.freebsd.IPV6.RECVHOPLIMIT

constant

Source line 501

std.c.freebsd.IPV6.RECVHOPOPTS

constant

Source line 503

std.c.freebsd.IPV6.RECVORIGDSTADDR

alias

Source line 529

Alias of std.c.freebsd.IPV6.ORIGDSTADDR

std.c.freebsd.IPV6.RECVPATHMTU

constant

Source line 507

std.c.freebsd.IPV6.RECVPKTINFO

constant

Source line 500

std.c.freebsd.IPV6.RECVRSSBUCKETID

constant

Source line 527

std.c.freebsd.IPV6.RECVRTHDR

constant

Source line 502

std.c.freebsd.IPV6.RECVRTHDRDSTOPTS

constant

Source line 505

std.c.freebsd.IPV6.RECVTCLASS

constant

Source line 517

std.c.freebsd.IPV6.RSSBUCKETID

constant

Source line 525

std.c.freebsd.IPV6.RTHDR

constant

Source line 515

std.c.freebsd.IPV6.RTHDR_LOOSE

constant

Source line 533

std.c.freebsd.IPV6.RTHDR_STRICT

constant

Source line 534

std.c.freebsd.IPV6.RTHDR_TYPE_0

constant

Source line 535

std.c.freebsd.IPV6.RTHDRDSTOPTS

constant

Source line 499

std.c.freebsd.IPV6.TCLASS

constant

Source line 519

std.c.freebsd.IPV6.UNICAST_HOPS

constant

Source line 476

std.c.freebsd.IPV6.USE_MIN_MTU

constant

Source line 506

std.c.freebsd.IPV6.V6ONLY

constant

Source line 491

std.c.freebsd.IPV6.VLAN_PCP

constant

Source line 531

std.c.freebsd.kinfo_file

container

Source line 148

Fields

structsize: c_int

Size of this record. A zero value is for the sentinel record at the end of an array.

type: c_int

Descriptor type.

fd: fd_t

Array index.

ref_count: c_int

Reference count.

flags: c_int

Flags.

_pad0: c_int
offset: i64

Seek location.

un: extern union {
    socket: extern struct {
        /// Sendq size.
        sendq: u32,
        /// Socket domain.
        domain: c_int,
        /// Socket type.
        type: c_int,
        /// Socket protocol.
        protocol: c_int,
        /// Socket address.
        address: sockaddr.storage,
        /// Peer address.
        peer: sockaddr.storage,
        /// Address of so_pcb.
        pcb: u64,
        /// Address of inp_ppcb.
        inpcb: u64,
        /// Address of unp_conn.
        unpconn: u64,
        /// Send buffer state.
        snd_sb_state: u16,
        /// Receive buffer state.
        rcv_sb_state: u16,
        /// Recvq size.
        recvq: u32,
    },
    file: extern struct {
        /// Vnode type.
        type: i32,
        // Reserved for future use
        _spare1: [3]i32,
        _spare2: [30]u64,
        /// Vnode filesystem id.
        fsid: u64,
        /// File device.
        rdev: u64,
        /// Global file id.
        fileid: u64,
        /// File size.
        size: u64,
        /// fsid compat for FreeBSD 11.
        fsid_freebsd11: u32,
        /// rdev compat for FreeBSD 11.
        rdev_freebsd11: u32,
        /// File mode.
        mode: u16,
        // 64bit padding.
        _pad0: u16,
        _pad1: u32,
    },
    sem: extern struct {
        _spare0: [4]u32,
        _spare1: [32]u64,
        /// Semaphore value.
        value: u32,
        /// Semaphore mode.
        mode: u16,
    },
    pipe: extern struct {
        _spare1: [4]u32,
        _spare2: [32]u64,
        addr: u64,
        peer: u64,
        buffer_cnt: u32,
        // 64bit padding.
        kf_pipe_pad0: [3]u32,
    },
    proc: extern struct {
        _spare1: [4]u32,
        _spare2: [32]u64,
        pid: pid_t,
    },
    eventfd: extern struct {
        value: u64,
        flags: u32,
    },
}
status: u16

Status flags.

_pad1: u16
_spare: c_int
cap_rights: cap_rights

Capability rights.

_cap_spare: u64

Reserved for future cap_rights

path: [PATH_MAX]u8

Path to file, if any.

std.c.freebsd.KINFO_FILE_SIZE

constant

Source line 261

std.c.freebsd.kinfo_getfile

function

Source line 31

pub extern "c" fn kinfo_getfile(pid: pid_t, cntp: *c_int) ?[*]kinfo_file

Parameters

pid: pid_t
cntp: *c_int

std.c.freebsd.MFD

namespace

Source line 263

std.c.freebsd.MFD.ALLOW_SEALING

constant

Source line 265

std.c.freebsd.MFD.CLOEXEC

constant

Source line 264

std.c.freebsd.mode_t

alias

Source line 14

Alias of std.c.mode_t

std.c.freebsd.nlink_t

alias

Source line 15

Alias of std.c.nlink_t

std.c.freebsd.off_t

alias

Source line 16

Alias of std.c.off_t

std.c.freebsd.PATH_MAX

alias

Source line 5

Alias of std.c.PATH_MAX

std.c.freebsd.pid_t

alias

Source line 17

Alias of std.c.pid_t

std.c.freebsd.ptrace

function

Source line 29

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

Parameters

request: c_int
pid: pid_t
addr: caddr_t
data: c_int

std.c.freebsd.sendfile

function

Source line 34

pub extern "c" fn sendfile( in_fd: fd_t, out_fd: fd_t, offset: off_t, nbytes: usize, sf_hdtr: ?*sf_hdtr, sbytes: ?*off_t, flags: u32, ) c_int

Parameters

in_fd: fd_t
out_fd: fd_t
offset: off_t
nbytes: usize
sf_hdtr: ?*sf_hdtr
sbytes: ?*off_t
flags: u32

std.c.freebsd.sf_hdtr

alias

Source line 22

Alias of std.c.sf_hdtr

std.c.freebsd.sockaddr

alias

Source line 18

Alias of std.c.sockaddr

std.c.freebsd.Stat

container

Source line 85

Fields

dev: dev_t

The inode's device.

ino: ino_t

The inode's number.

nlink: nlink_t

Number of hard links.

mode: mode_t

Inode protection mode.

__pad0: i16
uid: uid_t

User ID of the file's owner.

gid: gid_t

Group ID of the file's group.

__pad1: i32
rdev: dev_t

Device type.

atim: timespec

Time of last access.

mtim: timespec

Time of last data modification.

ctim: timespec

Time of last file status change.

birthtim: timespec

Time of file creation.

size: off_t

File size, in bytes.

blocks: blkcnt_t

Blocks allocated for file.

blksize: blksize_t

Optimal blocksize for I/O.

flags: fflags_t

User defined flags for file.

gen: u64

File generation number.

__spare: [10]u64

std.c.freebsd.Stat.atime

function

Source line 122

pub fn atime(self: @This()) timespec

Parameters

self: @This()

std.c.freebsd.Stat.birthtime

function

Source line 134

pub fn birthtime(self: @This()) timespec

Parameters

self: @This()

std.c.freebsd.Stat.ctime

function

Source line 130

pub fn ctime(self: @This()) timespec

Parameters

self: @This()

std.c.freebsd.Stat.mtime

function

Source line 126

pub fn mtime(self: @This()) timespec

Parameters

self: @This()

std.c.freebsd.std

alias

Source line 2

Alias of std

std.c.freebsd.TCP

namespace

Source line 591

std.c.freebsd.TCP.CCALGOOPT

constant

Source line 615

std.c.freebsd.TCP.CONGESTION

constant

Source line 614

std.c.freebsd.TCP.DELACK

constant

Source line 619

std.c.freebsd.TCP.FASTOPEN

constant

Source line 630

std.c.freebsd.TCP.FIN_IS_RST

constant

Source line 620

std.c.freebsd.TCP.IDLE_REDUCE

constant

Source line 617

std.c.freebsd.TCP.INFO

constant

Source line 597

std.c.freebsd.TCP.IWND_NB

constant

Source line 608

std.c.freebsd.TCP.IWND_NSEG

constant

Source line 609

std.c.freebsd.TCP.KEEPCNT

constant

Source line 629

std.c.freebsd.TCP.KEEPIDLE

constant

Source line 627

std.c.freebsd.TCP.KEEPINIT

constant

Source line 626

std.c.freebsd.TCP.KEEPINTVL

constant

Source line 628

std.c.freebsd.TCP.LOG

constant

Source line 599

std.c.freebsd.TCP.LOG_LIMIT

constant

Source line 621

std.c.freebsd.TCP.LOG_TAG

constant

Source line 612

std.c.freebsd.TCP.LOGBUF

constant

Source line 600

std.c.freebsd.TCP.LOGDUMP

constant

Source line 602

std.c.freebsd.TCP.LOGDUMPID

constant

Source line 603

std.c.freebsd.TCP.LOGID

constant

Source line 601

std.c.freebsd.TCP.LOGID_CNT

constant

Source line 611

std.c.freebsd.TCP.MAXSEG

constant

Source line 593

std.c.freebsd.TCP.MAXUNACKTIME

constant

Source line 616

std.c.freebsd.TCP.MD5SIG

constant

Source line 596

std.c.freebsd.TCP.NODELAY

constant

Source line 592

std.c.freebsd.TCP.NOOPT

constant

Source line 595

std.c.freebsd.TCP.NOPUSH

constant

Source line 594

std.c.freebsd.TCP.PERF_INFO

constant

Source line 625

std.c.freebsd.TCP.PROC_ACCOUNTING

constant

Source line 623

std.c.freebsd.TCP.REMOTE_UDP_ENCAPS_PORT

constant

Source line 618

std.c.freebsd.TCP.RXTLS_ENABLE

constant

Source line 606

std.c.freebsd.TCP.RXTLS_MODE

constant

Source line 607

std.c.freebsd.TCP.SHARED_CWND_ALLOWED

constant

Source line 622

std.c.freebsd.TCP.STATS

constant

Source line 598

std.c.freebsd.TCP.TXTLS_ENABLE

constant

Source line 604

std.c.freebsd.TCP.TXTLS_MODE

constant

Source line 605

std.c.freebsd.TCP.USE_CMP_ACKS

constant

Source line 624

std.c.freebsd.TCP.USE_DDP

constant

Source line 610

std.c.freebsd.TCP.USER_LOG

constant

Source line 613

std.c.freebsd.time_t

alias

Source line 19

Alias of std.c.time_t

std.c.freebsd.timespec

alias

Source line 20

Alias of std.c.timespec

std.c.freebsd.uid_t

alias

Source line 21

Alias of std.c.uid_t

std.c.freebsd.UMTX_ABSTIME

constant

Source line 74

std.c.freebsd.UMTX_OP

container

Source line 44

Fields

LOCK = 0
UNLOCK = 1
WAIT = 2
WAKE = 3
MUTEX_TRYLOCK = 4
MUTEX_LOCK = 5
MUTEX_UNLOCK = 6
SET_CEILING = 7
CV_WAIT = 8
CV_SIGNAL = 9
CV_BROADCAST = 10
WAIT_UINT = 11
RW_RDLOCK = 12
RW_WRLOCK = 13
RW_UNLOCK = 14
WAIT_UINT_PRIVATE = 15
WAKE_PRIVATE = 16
MUTEX_WAIT = 17
MUTEX_WAKE = 18
SEM_WAIT = 19
SEM_WAKE = 20
NWAKE_PRIVATE = 31
MUTEX_WAKE2 = 22
SEM2_WAIT = 23
SEM2_WAKE = 24
SHM = 25
ROBUST_LISTS = 26
Source code

std/c/freebsd.zig

const builtin = @import("builtin");
const std = @import("../std.zig");
const assert = std.debug.assert;

const PATH_MAX = std.c.PATH_MAX;
const blkcnt_t = std.c.blkcnt_t;
const blksize_t = std.c.blksize_t;
const caddr_t = std.c.caddr_t;
const dev_t = std.c.dev_t;
const fd_t = std.c.fd_t;
const gid_t = std.c.gid_t;
const ino_t = std.c.ino_t;
const iovec_const = std.posix.iovec_const;
const mode_t = std.c.mode_t;
const nlink_t = std.c.nlink_t;
const off_t = std.c.off_t;
const pid_t = std.c.pid_t;
const sockaddr = std.c.sockaddr;
const time_t = std.c.time_t;
const timespec = std.c.timespec;
const uid_t = std.c.uid_t;
const sf_hdtr = std.c.sf_hdtr;
const clockid_t = std.c.clockid_t;

comptime {
    assert(builtin.os.tag == .freebsd); // Prevent access of std.c symbols on wrong OS.
}

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

pub extern "c" fn kinfo_getfile(pid: pid_t, cntp: *c_int) ?[*]kinfo_file;
pub extern "c" fn copy_file_range(fd_in: fd_t, off_in: ?*off_t, fd_out: fd_t, off_out: ?*off_t, len: usize, flags: u32) isize;

pub extern "c" fn sendfile(
    in_fd: fd_t,
    out_fd: fd_t,
    offset: off_t,
    nbytes: usize,
    sf_hdtr: ?*sf_hdtr,
    sbytes: ?*off_t,
    flags: u32,
) c_int;

pub const UMTX_OP = enum(c_int) {
    LOCK = 0,
    UNLOCK = 1,
    WAIT = 2,
    WAKE = 3,
    MUTEX_TRYLOCK = 4,
    MUTEX_LOCK = 5,
    MUTEX_UNLOCK = 6,
    SET_CEILING = 7,
    CV_WAIT = 8,
    CV_SIGNAL = 9,
    CV_BROADCAST = 10,
    WAIT_UINT = 11,
    RW_RDLOCK = 12,
    RW_WRLOCK = 13,
    RW_UNLOCK = 14,
    WAIT_UINT_PRIVATE = 15,
    WAKE_PRIVATE = 16,
    MUTEX_WAIT = 17,
    MUTEX_WAKE = 18, // deprecated
    SEM_WAIT = 19, // deprecated
    SEM_WAKE = 20, // deprecated
    NWAKE_PRIVATE = 31,
    MUTEX_WAKE2 = 22,
    SEM2_WAIT = 23,
    SEM2_WAKE = 24,
    SHM = 25,
    ROBUST_LISTS = 26,
};

pub const UMTX_ABSTIME = 0x01;
pub const _umtx_time = extern struct {
    timeout: timespec,
    flags: u32,
    clockid: clockid_t,
};

pub extern "c" fn _umtx_op(obj: usize, op: c_int, val: c_ulong, uaddr: usize, uaddr2: usize) c_int;

pub const fflags_t = u32;

pub const Stat = extern struct {
    /// The inode's device.
    dev: dev_t,
    /// The inode's number.
    ino: ino_t,
    /// Number of hard links.
    nlink: nlink_t,
    /// Inode protection mode.
    mode: mode_t,
    __pad0: i16,
    /// User ID of the file's owner.
    uid: uid_t,
    /// Group ID of the file's group.
    gid: gid_t,
    __pad1: i32,
    /// Device type.
    rdev: dev_t,
    /// Time of last access.
    atim: timespec,
    /// Time of last data modification.
    mtim: timespec,
    /// Time of last file status change.
    ctim: timespec,
    /// Time of file creation.
    birthtim: timespec,
    /// File size, in bytes.
    size: off_t,
    /// Blocks allocated for file.
    blocks: blkcnt_t,
    /// Optimal blocksize for I/O.
    blksize: blksize_t,
    /// User defined flags for file.
    flags: fflags_t,
    /// File generation number.
    gen: u64,
    __spare: [10]u64,

    pub fn atime(self: @This()) timespec {
        return self.atim;
    }

    pub fn mtime(self: @This()) timespec {
        return self.mtim;
    }

    pub fn ctime(self: @This()) timespec {
        return self.ctim;
    }

    pub fn birthtime(self: @This()) timespec {
        return self.birthtim;
    }
};

pub const fsblkcnt_t = u64;
pub const fsfilcnt_t = u64;

pub const CAP_RIGHTS_VERSION = 0;

pub const cap_rights = extern struct {
    rights: [CAP_RIGHTS_VERSION + 2]u64,
};

pub const kinfo_file = extern struct {
    /// Size of this record.
    /// A zero value is for the sentinel record at the end of an array.
    structsize: c_int,
    /// Descriptor type.
    type: c_int,
    /// Array index.
    fd: fd_t,
    /// Reference count.
    ref_count: c_int,
    /// Flags.
    flags: c_int,
    // 64bit padding.
    _pad0: c_int,
    /// Seek location.
    offset: i64,
    un: extern union {
        socket: extern struct {
            /// Sendq size.
            sendq: u32,
            /// Socket domain.
            domain: c_int,
            /// Socket type.
            type: c_int,
            /// Socket protocol.
            protocol: c_int,
            /// Socket address.
            address: sockaddr.storage,
            /// Peer address.
            peer: sockaddr.storage,
            /// Address of so_pcb.
            pcb: u64,
            /// Address of inp_ppcb.
            inpcb: u64,
            /// Address of unp_conn.
            unpconn: u64,
            /// Send buffer state.
            snd_sb_state: u16,
            /// Receive buffer state.
            rcv_sb_state: u16,
            /// Recvq size.
            recvq: u32,
        },
        file: extern struct {
            /// Vnode type.
            type: i32,
            // Reserved for future use
            _spare1: [3]i32,
            _spare2: [30]u64,
            /// Vnode filesystem id.
            fsid: u64,
            /// File device.
            rdev: u64,
            /// Global file id.
            fileid: u64,
            /// File size.
            size: u64,
            /// fsid compat for FreeBSD 11.
            fsid_freebsd11: u32,
            /// rdev compat for FreeBSD 11.
            rdev_freebsd11: u32,
            /// File mode.
            mode: u16,
            // 64bit padding.
            _pad0: u16,
            _pad1: u32,
        },
        sem: extern struct {
            _spare0: [4]u32,
            _spare1: [32]u64,
            /// Semaphore value.
            value: u32,
            /// Semaphore mode.
            mode: u16,
        },
        pipe: extern struct {
            _spare1: [4]u32,
            _spare2: [32]u64,
            addr: u64,
            peer: u64,
            buffer_cnt: u32,
            // 64bit padding.
            kf_pipe_pad0: [3]u32,
        },
        proc: extern struct {
            _spare1: [4]u32,
            _spare2: [32]u64,
            pid: pid_t,
        },
        eventfd: extern struct {
            value: u64,
            flags: u32,
        },
    },
    /// Status flags.
    status: u16,
    // 32-bit alignment padding.
    _pad1: u16,
    // Reserved for future use.
    _spare: c_int,
    /// Capability rights.
    cap_rights: cap_rights,
    /// Reserved for future cap_rights
    _cap_spare: u64,
    /// Path to file, if any.
    path: [PATH_MAX]u8,

    comptime {
        assert(@sizeOf(@This()) == KINFO_FILE_SIZE);
        assert(@alignOf(@This()) == @sizeOf(u64));
    }
};

pub const KINFO_FILE_SIZE = 1392;

pub const MFD = struct {
    pub const CLOEXEC = 0x0001;
    pub const ALLOW_SEALING = 0x0002;
};

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 filesystem
    MLINK = 31, // Too many links
    PIPE = 32, // Broken pipe

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

    // non-blocking and interrupt i/o

    /// Resource temporarily unavailable
    /// This code is also used for `WOULDBLOCK`: operation would block.
    AGAIN = 35,
    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 not available
    PROTONOSUPPORT = 43, // Protocol not supported
    SOCKTNOSUPPORT = 44, // Socket type not supported
    /// Operation not supported
    /// This code is also used for `NOTSUP`.
    OPNOTSUPP = 45,
    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
    IDRM = 82, // Identifier removed
    NOMSG = 83, // No message of desired type
    OVERFLOW = 84, // Value too large to be stored in data type
    CANCELED = 85, // Operation canceled
    ILSEQ = 86, // Illegal byte sequence
    NOATTR = 87, // Attribute not found

    DOOFUS = 88, // Programming error

    BADMSG = 89, // Bad message
    MULTIHOP = 90, // Multihop attempted
    NOLINK = 91, // Link has been severed
    PROTO = 92, // Protocol error

    NOTCAPABLE = 93, // Capabilities insufficient
    CAPMODE = 94, // Not permitted in capability mode
    NOTRECOVERABLE = 95, // State not recoverable
    OWNERDEAD = 96, // Previous owner died
    INTEGRITY = 97, // Integrity check failed
    _,
};

// https://github.com/freebsd/freebsd-src/blob/9bfbc6826f72eb385bf52f4cde8080bccf7e3ebd/sys/netinet/in.h#L436
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 SENDSRCADDR = RECVDSTADDR;
    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 MULTICAST_VIF = 14;
    pub const RSVP_ON = 15;
    pub const RSVP_OFF = 16;
    pub const RSVP_VIF_ON = 17;
    pub const RSVP_VIF_OFF = 18;
    pub const PORTRANGE = 19;
    pub const RECVIF = 20;
    pub const IPSEC_POLICY = 21;
    pub const ONESBCAST = 23;
    pub const BINDANY = 24;
    pub const ORIGDSTADDR = 27;
    pub const RECVORIGDSTADDR = ORIGDSTADDR;
    pub const FW_TABLE_ADD = 40;
    pub const FW_TABLE_DEL = 41;
    pub const FW_TABLE_FLUSH = 42;
    pub const FW_TABLE_GETSIZE = 43;
    pub const FW_TABLE_LIST = 44;
    pub const FW3 = 48;
    pub const DUMMYNET3 = 49;
    pub const FW_ADD = 50;
    pub const FW_DEL = 51;
    pub const FW_FLUSH = 52;
    pub const FW_ZERO = 53;
    pub const FW_GET = 54;
    pub const FW_RESETLOG = 55;
    pub const FW_NAT_CFG = 56;
    pub const FW_NAT_DEL = 57;
    pub const FW_NAT_GET_CONFIG = 58;
    pub const FW_NAT_GET_LOG = 59;
    pub const DUMMYNET_CONFIGURE = 60;
    pub const DUMMYNET_DEL = 61;
    pub const DUMMYNET_FLUSH = 62;
    pub const DUMMYNET_GET = 64;
    pub const RECVTTL = 65;
    pub const MINTTL = 66;
    pub const DONTFRAG = 67;
    pub const RECVTOS = 68;
    pub const ADD_SOURCE_MEMBERSHIP = 70;
    pub const DROP_SOURCE_MEMBERSHIP = 71;
    pub const BLOCK_SOURCE = 72;
    pub const UNBLOCK_SOURCE = 73;
    pub const MSFILTER = 74;
    pub const VLAN_PCP = 75;
    pub const FLOWID = 90;
    pub const FLOWTYPE = 91;
    pub const RSSBUCKETID = 92;
    pub const RECVFLOWID = 93;
    pub const RECVRSSBUCKETID = 94;
    // Same namespace, but these are arguments rather than option names
    pub const DEFAULT_MULTICAST_TTL = 1;
    pub const DEFAULT_MULTICAST_LOOP = 1;
    pub const MAX_MEMBERSHIPS = 4095;
    pub const MAX_GROUP_SRC_FILTER = 512;
    pub const MAX_SOCK_SRC_FILTER = 128;
    pub const MAX_SOCK_MUTE_FILTER = 128;
    pub const PORTRANGE_DEFAULT = 0;
    pub const PORTRANGE_HIGH = 1;
    pub const PORTRANGE_LOW = 2;
};

// https://github.com/freebsd/freebsd-src/blob/9bfbc6826f72eb385bf52f4cde8080bccf7e3ebd/sys/netinet6/in6.h#L402
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 @"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 BINDV6ONLY = V6ONLY;
    pub const IPSEC_POLICY = 28;
    pub const FW_ADD = 30;
    pub const FW_DEL = 31;
    pub const FW_FLUSH = 32;
    pub const FW_ZERO = 33;
    pub const FW_GET = 34;
    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 REACHCONF = 45;
    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 PKTOPTIONS = 52;
    pub const RECVTCLASS = 57;
    pub const AUTOFLOWLABEL = 59;
    pub const TCLASS = 61;
    pub const DONTFRAG = 62;
    pub const PREFER_TEMPADDR = 63;
    pub const BINDANY = 64;
    pub const FLOWID = 67;
    pub const FLOWTYPE = 68;
    pub const RSSBUCKETID = 69;
    pub const RECVFLOWID = 70;
    pub const RECVRSSBUCKETID = 71;
    pub const ORIGDSTADDR = 72;
    pub const RECVORIGDSTADDR = ORIGDSTADDR;
    pub const MSFILTER = 74;
    pub const VLAN_PCP = 75;
    // Same namespace, but these are arguments rather than option names
    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 MAX_MEMBERSHIPS = 4095;
    pub const MAX_GROUP_SRC_FILTER = 512;
    pub const MAX_SOCK_SRC_FILTER = 128;
    pub const PORTRANGE_DEFAULT = 0;
    pub const PORTRANGE_HIGH = 1;
    pub const PORTRANGE_LOW = 2;
};

// https://github.com/freebsd/freebsd-src/blob/9bfbc6826f72eb385bf52f4cde8080bccf7e3ebd/sys/netinet/ip.h#L77
pub const IPTOS = struct {
    pub const LOWDELAY = 0x10;
    pub const THROUGHPUT = 0x08;
    pub const RELIABILITY = 0x04;
    pub const MINCOST = DSCP_CS0;
    pub const PREC_ROUTINE = DSCP_CS0;
    pub const PREC_PRIORITY = DSCP_CS1;
    pub const PREC_IMMEDIATE = DSCP_CS2;
    pub const PREC_FLASH = DSCP_CS3;
    pub const PREC_FLASHOVERRIDE = DSCP_CS4;
    pub const PREC_CRITIC_ECP = DSCP_CS5;
    pub const PREC_INTERNETCONTROL = DSCP_CS6;
    pub const PREC_NETCONTROL = DSCP_CS7;
    pub const DSCP_OFFSET = 2;
    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_VA = 0xb0;
    pub const DSCP_EF = 0xb8;
    pub const DSCP_CS6 = 0xc0;
    pub const DSCP_CS7 = 0xe0;
    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;
};

// https://cgit.freebsd.org/src/tree/sys/netinet/tcp.h?id=52c0d52b91e34f9190c9ba8fab7b6bc463bc4cbb#n183
pub const TCP = struct {
    pub const NODELAY = 1;
    pub const MAXSEG = 2;
    pub const NOPUSH = 4;
    pub const NOOPT = 8;
    pub const MD5SIG = 16;
    pub const INFO = 32;
    pub const STATS = 33;
    pub const LOG = 34;
    pub const LOGBUF = 35;
    pub const LOGID = 36;
    pub const LOGDUMP = 37;
    pub const LOGDUMPID = 38;
    pub const TXTLS_ENABLE = 39;
    pub const TXTLS_MODE = 40;
    pub const RXTLS_ENABLE = 41;
    pub const RXTLS_MODE = 42;
    pub const IWND_NB = 43;
    pub const IWND_NSEG = 44;
    pub const USE_DDP = 45;
    pub const LOGID_CNT = 46;
    pub const LOG_TAG = 47;
    pub const USER_LOG = 48;
    pub const CONGESTION = 64;
    pub const CCALGOOPT = 65;
    pub const MAXUNACKTIME = 68;
    pub const IDLE_REDUCE = 70;
    pub const REMOTE_UDP_ENCAPS_PORT = 71;
    pub const DELACK = 72;
    pub const FIN_IS_RST = 73;
    pub const LOG_LIMIT = 74;
    pub const SHARED_CWND_ALLOWED = 75;
    pub const PROC_ACCOUNTING = 76;
    pub const USE_CMP_ACKS = 77;
    pub const PERF_INFO = 78;
    pub const KEEPINIT = 128;
    pub const KEEPIDLE = 256;
    pub const KEEPINTVL = 512;
    pub const KEEPCNT = 1024;
    pub const FASTOPEN = 1025;
};