core/sys/freebsd

sys_freebsd

Types

54

Address_Family

Address_Family :: enum sa_family_t { UNSPEC = 0, LOCAL = 1, UNIX = LOCAL, INET = 2, IMPLINK = 3, PUP = 4, CHAOS = 5, NETBIOS = 6, ISO = 7, OSI = ISO, ECMA = 8, DATAKIT = 9, CCITT = 10, SNA = 11, DECnet = 12, DLI = 13, LAT = 14, HYLINK = 15, APPLETALK = 16, ROUTE = 17, LINK = 18, PSEUDO_XTP = 19, COIP = 20, CNT = 21, PSEUDO_RTIP = 22, IPX = 23, SIP = 24, PSEUDO_PIP = 25, ISDN = 26, E164 = ISDN, PSEUDO_KEY = 27, INET6 = 28, NATM = 29, ATM = 30, NETGRAPH = 32, SLOW = 33, SCLUSTER = 34, ARP = 35, BLUETOOTH = 36, IEEE80211 = 37, NETLINK = 38, INET_SDP = 40, INET6_SDP = 42, HYPERV = 43, DIVERT = 44, MAX = 44, VENDOR00 = 39, VENDOR01 = 41, VENDOR03 = 45, VENDOR04 = 47, VENDOR05 = 49, VENDOR06 = 51, VENDOR07 = 53, VENDOR08 = 55, VENDOR09 = 57, VENDOR10 = 59, VENDOR11 = 61, VENDOR12 = 63, VENDOR13 = 65, VENDOR14 = 67, VENDOR15 = 69, VENDOR16 = 71, VENDOR17 = 73, VENDOR18 = 75, VENDOR19 = 77, VENDOR20 = 79, VENDOR21 = 81, VENDOR22 = 83, VENDOR23 = 85, VENDOR24 = 87, VENDOR25 = 89, VENDOR26 = 91, VENDOR27 = 93, VENDOR28 = 95, VENDOR29 = 97, VENDOR30 = 99, VENDOR31 = 101, VENDOR32 = 103, VENDOR33 = 105, VENDOR34 = 107, VENDOR35 = 109, VENDOR36 = 111, VENDOR37 = 113, VENDOR38 = 115, VENDOR39 = 117, VENDOR40 = 119, VENDOR41 = 121, VENDOR42 = 123, VENDOR43 = 125, VENDOR44 = 127, VENDOR45 = 129, VENDOR46 = 131, VENDOR47 = 133, }Source

define AF_*

Errno

Errno :: enum c.int { NONE = 0, EPERM = 1, ENOENT = 2, ESRCH = 3, EINTR = 4, EIO = 5, ENXIO = 6, E2BIG = 7, ENOEXEC = 8, EBADF = 9, ECHILD = 10, EDEADLK = 11, ENOMEM = 12, EACCES = 13, EFAULT = 14, ENOTBLK = 15, EBUSY = 16, EEXIST = 17, EXDEV = 18, ENODEV = 19, ENOTDIR = 20, EISDIR = 21, EINVAL = 22, ENFILE = 23, EMFILE = 24, ENOTTY = 25, ETXTBSY = 26, EFBIG = 27, ENOSPC = 28, ESPIPE = 29, EROFS = 30, EMLINK = 31, EPIPE = 32, EDOM = 33, ERANGE = 34, EAGAIN = 35, EWOULDBLOCK = EAGAIN, EINPROGRESS = 36, EALREADY = 37, ENOTSOCK = 38, EDESTADDRREQ = 39, EMSGSIZE = 40, EPROTOTYPE = 41, ENOPROTOOPT = 42, EPROTONOSUPPORT = 43, ESOCKTNOSUPPORT = 44, EOPNOTSUPP = 45, ENOTSUP = EOPNOTSUPP, EPFNOSUPPORT = 46, EAFNOSUPPORT = 47, EADDRINUSE = 48, EADDRNOTAVAIL = 49, ENETDOWN = 50, ENETUNREACH = 51, ENETRESET = 52, ECONNABORTED = 53, ECONNRESET = 54, ENOBUFS = 55, EISCONN = 56, ENOTCONN = 57, ESHUTDOWN = 58, ETOOMANYREFS = 59, ETIMEDOUT = 60, ECONNREFUSED = 61, ELOOP = 62, ENAMETOOLONG = 63, EHOSTDOWN = 64, EHOSTUNREACH = 65, ENOTEMPTY = 66, EPROCLIM = 67, EUSERS = 68, EDQUOT = 69, ESTALE = 70, EREMOTE = 71, EBADRPC = 72, ERPCMISMATCH = 73, EPROGUNAVAIL = 74, EPROGMISMATCH = 75, EPROCUNAVAIL = 76, ENOLCK = 77, ENOSYS = 78, EFTYPE = 79, EAUTH = 80, ENEEDAUTH = 81, EIDRM = 82, ENOMSG = 83, EOVERFLOW = 84, ECANCELED = 85, EILSEQ = 86, ENOATTR = 87, EDOOFUS = 88, EBADMSG = 89, EMULTIHOP = 90, ENOLINK = 91, EPROTO = 92, ENOTCAPABLE = 93, ECAPMODE = 94, ENOTRECOVERABLE = 95, EOWNERDEAD = 96, EINTEGRITY = 97, }Source

include <sys/errno.h>

Fd

Fd :: c.intSource

These definitions have been extracted from a system running FreeBSD 14.0-RELEASE. Most comments come from system header files.

Where applicable, original C struct and define names are indicated in line comments above Odin declarations.

This data is separated into blocks by original header file. If you happen to add or change something in this file, mind the organizational structure.

File_Control_Command

File_Control_Command :: enum c.int { DUPFD = 0, // duplicate file descriptor GETFD = 1, // get file descriptor flags SETFD = 2, // set file descriptor flags GETFL = 3, // get file status flags SETFL = 4, // set file status flags GETOWN = 5, // get SIGIO/SIGURG proc/pgrp SETOWN = 6, // set SIGIO/SIGURG proc/pgrp OGETLK = 7, // get record locking information OSETLK = 8, // set record locking information OSETLKW = 9, // F_SETLK; wait if blocked DUP2FD = 10, // duplicate file descriptor to arg GETLK = 11, // get record locking information SETLK = 12, // set record locking information SETLKW = 13, // F_SETLK; wait if blocked SETLK_REMOTE = 14, // debugging support for remote locks READAHEAD = 15, // read ahead RDAHEAD = 16, // Darwin compatible read ahead DUPFD_CLOEXEC = 17, // Like F_DUPFD, but FD_CLOEXEC is set DUP2FD_CLOEXEC = 18, // Like F_DUP2FD, but FD_CLOEXEC is set ADD_SEALS = 19, GET_SEALS = 20, ISUNIONSTACK = 21, // Kludge for libc, don't use it. KINFO = 22, // Return kinfo_file for this fd }Source

include <sys/fcntl.h>

Constants used for fcntl(2) command values

define F_*

File_Seal_Index

File_Seal_Index :: enum c.int { SEAL = 0, // 0x0001, /* Prevent adding sealings */ SHRINK = 1, // 0x0002, /* May not shrink */ GROW = 2, // 0x0004, /* May not grow */ WRITE = 3, // 0x0008, /* May not write */ }Source

Seals (F_ADD_SEALS, F_GET_SEALS).

define F_SEAL_*

File_Status_Flag

File_Status_Flag :: enum c.int { // open-only flags RDONLY = 0, // open for reading only WRONLY = 1, // open for writing only RDWR = 2, // open for reading and writing ACCMODE = 3, // mask for above modes NONBLOCK = 4, // no delay APPEND = 8, // set append mode SHLOCK = 16, // open with shared file lock EXLOCK = 32, // open with exclusive file lock ASYNC = 64, // signal pgrp when data ready FSYNC = 128, // synchronous writes SYNC = 128, // POSIX synonym for O_FSYNC NOFOLLOW = 256, // don't follow symlinks CREAT = 512, // create if nonexistent TRUNC = 1024, // truncate to zero length EXCL = 2048, // error if already exists // Defined by POSIX 1003.1; BSD default, but must be distinct from O_RDONLY. NOCTTY = 32768, // don't assign controlling terminal // Attempt to bypass buffer cache DIRECT = 65536, DIRECTORY = 131072, // Fail if not directory EXEC = 262144, // Open for execute only SEARCH = EXEC, // Defined by POSIX 1003.1-2008; BSD default, but reserve for future use. TTY_INIT = 524288, // Restore default termios attributes CLOEXEC = 1048576, VERIFY = 2097152, // open only after verification PATH = 4194304, // fd is only a path RESOLVE_BENEATH = 8388608, // Do not allow name resolution to walk out of cwd DSYNC = 16777216, // POSIX data sync EMPTY_PATH = 33554432, }Source

File status flags: these are used by open(2), fcntl(2).

  • They are also used (indirectly) in the kernel file structure f_flags,
  • which is a superset of the open/fcntl flags. Open flags and f_flags
  • are inter-convertible using OFLAGS(fflags) and FFLAGS(oflags).
  • Open/fcntl flags begin with O_; kernel-internal flags begin with F.

File_Status_Index

File_Status_Index :: enum c.int { // No RDONLY (0x00), as that is implied and also impossible to express in a bit_set. // The comments below come from the documentation for `fcntl`. WRONLY = 0, RDWR = 1, // Non-blocking I/O; if no data is available to a read(2) // system call, or if a write(2) operation would block, the // read or write call returns -1 with the error EAGAIN. NONBLOCK = 2, // Force each write to append at the end of file; corresponds // to the O_APPEND flag of open(2). APPEND = 3, SHLOCK = 4, EXLOCK = 5, // Enable the SIGIO signal to be sent to the process group when // I/O is possible, e.g., upon availability of data to be read. ASYNC = 6, // Enable synchronous writes. Corresponds to the O_SYNC flag // of open(2). O_FSYNC is an historical synonym for O_SYNC. SYNC = 7, FSYNC = 7, NOFOLLOW = 8, CREAT = 9, TRUNC = 10, EXCL = 11, NOCTTY = 15, // Minimize or eliminate the cache effects of reading and // writing. The system will attempt to avoid caching the data // you read or write. If it cannot avoid caching the data, it // will minimize the impact the data has on the cache. Use of // this flag can drastically reduce performance if not used // with care. DIRECT = 16, DIRECTORY = 17, EXEC = 18, TTY_INIT = 19, CLOEXEC = 20, VERIFY = 21, PATH = 22, RESOLVE_BENEATH = 23, // Enable synchronous data writes. Corresponds to the O_DSYNC // flag of open(2). DSYNC = 24, EMPTY_PATH = 25, }Source

IP4_Address

IP4_Address :: struct #raw_union { // NOTE(Feoramund): I have modified this struct from its C definition by // introducing the byte variant to make it easier to work with. addr8: [4]u8, addr32: in_addr_t, }Source

Internet address (a structure for historical reasons). struct in_addr

Interface_Address_Message_Header_Len

Interface_Address_Message_Header_Len :: struct { msglen: c.ushort, version: c.uchar, type: c.uchar, addrs: Route_Address_Flags, flags: c.int, index: c.ushort, _spare1: c.ushort, len: c.ushort, data_off: c.ushort, metric: c.int, data: Interface_Data, }Source

The 'l' version shall be used by new interfaces, like NET_RT_IFLISTL. It is

  • extensible after ifam_metric or within ifam_data. Both the ifa_msghdrl and
  • if_data now have a member field detailing the struct length in addition to
  • the routing message length. Macros are provided to find the start of
  • ifm_data and the start of the socket address strucutres immediately following
  • struct ifa_msghdrl given a pointer to struct ifa_msghdrl.

struct ifa_msghdrl

Interface_Data

Interface_Data :: struct { // generic interface information type: u8, physical: u8, addrlen: u8, hdrlen: u8, link_state: Link_State, vhid: u8, datalen: u16, mtu: u32, metric: u32, baudrate: u64, // volatile statistics ipackets: u64, ierrors: u64, opackets: u64, oerrors: u64, collisions: u64, ibytes: u64, obytes: u64, imcasts: u64, omcasts: u64, iqdrops: u64, oqdrops: u64, noproto: u64, hwassist: u64, // Unions are here to make sizes MI. _epoch: struct #raw_union { // uptime at attach or stat reset tt: time_t, ph: u64, }, _lastchange: struct #raw_union { // time of last administrative change tv: timeval, ph: struct { ph1: u64, ph2: u64, }, }, }Source

Structure describing information about an interface

  • which may be of interest to management entities.

struct if_data

Interface_Message_Header_Len

Interface_Message_Header_Len :: struct { msglen: c.ushort, version: c.uchar, type: c.uchar, addrs: Route_Address_Flags, flags: c.int, index: c.ushort, _spare1: c.ushort, len: c.ushort, data_off: c.ushort, _spare2: c.int, data: Interface_Data, }Source

The 'l' version shall be used by new interfaces, like NET_RT_IFLISTL. It is

  • extensible after ifm_data_off or within ifm_data. Both the if_msghdr and
  • if_data now have a member field detailing the struct length in addition to
  • the routing message length. Macros are provided to find the start of
  • ifm_data and the start of the socket address strucutres immediately following
  • struct if_msghdrl given a pointer to struct if_msghdrl.

struct if_msghdrl

Interface_Type

Interface_Type :: enum c.uchar { OTHER = 1, // none of the following ARPA_1822 = 2, // old-style arpanet imp HDH1822 = 3, // HDH arpanet imp X25DDN = 4, // x25 to imp X25 = 5, // PDN X25 interface (RFC877) ETHER = 6, // Ethernet CSMA/CD ISO88023 = 7, // CMSA/CD ISO88024 = 8, // Token Bus ISO88025 = 9, // Token Ring ISO88026 = 10, // MAN STARLAN = 11, P10 = 12, // Proteon 10MBit ring P80 = 13, // Proteon 80MBit ring HY = 14, // Hyperchannel FDDI = 15, LAPB = 16, SDLC = 17, T1 = 18, CEPT = 19, // E1 - european T1 ISDNBASIC = 20, ISDNPRIMARY = 21, PTPSERIAL = 22, // Proprietary PTP serial PPP = 23, // RFC 1331 LOOP = 24, // loopback EON = 25, // ISO over IP XETHER = 26, // obsolete 3MB experimental ethernet NSIP = 27, // XNS over IP SLIP = 28, // IP over generic TTY ULTRA = 29, // Ultra Technologies DS3 = 30, // Generic T3 SIP = 31, // SMDS FRELAY = 32, // Frame Relay DTE only RS232 = 33, PARA = 34, // parallel-port ARCNET = 35, ARCNETPLUS = 36, ATM = 37, // ATM cells MIOX25 = 38, SONET = 39, // SONET or SDH X25PLE = 40, ISO88022LLC = 41, LOCALTALK = 42, SMDSDXI = 43, FRELAYDCE = 44, // Frame Relay DCE V35 = 45, HSSI = 46, HIPPI = 47, MODEM = 48, // Generic Modem AAL5 = 49, // AAL5 over ATM SONETPATH = 50, SONETVT = 51, SMDSICIP = 52, // SMDS InterCarrier Interface PROPVIRTUAL = 53, // Proprietary Virtual/internal PROPMUX = 54, // Proprietary Multiplexing IEEE80212 = 55, // 100BaseVG FIBRECHANNEL = 56, // Fibre Channel HIPPIINTERFACE = 57, // HIPPI interfaces FRAMERELAYINTERCONNECT = 58, // Obsolete, use 0x20 either 0x2c AFLANE8023 = 59, // ATM Emulated LAN for 802.3 AFLANE8025 = 60, // ATM Emulated LAN for 802.5 CCTEMUL = 61, // ATM Emulated circuit FASTETHER = 62, // Fast Ethernet (100BaseT) ISDN = 63, // ISDN and X.25 V11 = 64, // CCITT V.11/X.21 V36 = 65, // CCITT V.36 G703AT64K = 66, // CCITT G703 at 64Kbps G703AT2MB = 67, // Obsolete see DS1-MIB QLLC = 68, // SNA QLLC FASTETHERFX = 69, // Fast Ethernet (100BaseFX) CHANNEL = 70, // channel IEEE80211 = 71, // radio spread spectrum (unused) IBM370PARCHAN = 72, // IBM System 360/370 OEMI Channel ESCON = 73, // IBM Enterprise Systems Connection DLSW = 74, // Data Link Switching ISDNS = 75, // ISDN S/T interface ISDNU = 76, // ISDN U interface LAPD = 77, // Link Access Protocol D IPSWITCH = 78, // IP Switching Objects RSRB = 79, // Remote Source Route Bridging ATMLOGICAL = 80, // ATM Logical Port DS0 = 81, // Digital Signal Level 0 DS0BUNDLE = 82, // group of ds0s on the same ds1 BSC = 83, // Bisynchronous Protocol ASYNC = 84, // Asynchronous Protocol CNR = 85, // Combat Net Radio ISO88025DTR = 86, // ISO 802.5r DTR EPLRS = 87, // Ext Pos Loc Report Sys ARAP = 88, // Appletalk Remote Access Protocol PROPCNLS = 89, // Proprietary Connectionless Protocol HOSTPAD = 90, // CCITT-ITU X.29 PAD Protocol TERMPAD = 91, // CCITT-ITU X.3 PAD Facility FRAMERELAYMPI = 92, // Multiproto Interconnect over FR X213 = 93, // CCITT-ITU X213 ADSL = 94, // Asymmetric Digital Subscriber Loop RADSL = 95, // Rate-Adapt. Digital Subscriber Loop SDSL = 96, // Symmetric Digital Subscriber Loop VDSL = 97, // Very H-Speed Digital Subscrib. Loop ISO88025CRFPINT = 98, // ISO 802.5 CRFP MYRINET = 99, // Myricom Myrinet VOICEEM = 100, // voice recEive and transMit VOICEFXO = 101, // voice Foreign Exchange Office VOICEFXS = 102, // voice Foreign Exchange Station VOICEENCAP = 103, // voice encapsulation VOICEOVERIP = 104, // voice over IP encapsulation ATMDXI = 105, // ATM DXI ATMFUNI = 106, // ATM FUNI ATMIMA = 107, // ATM IMA PPPMULTILINKBUNDLE = 108, // PPP Multilink Bundle IPOVERCDLC = 109, // IBM ipOverCdlc IPOVERCLAW = 110, // IBM Common Link Access to Workstn STACKTOSTACK = 111, // IBM stackToStack VIRTUALIPADDRESS = 112, // IBM VIPA MPC = 113, // IBM multi-protocol channel support IPOVERATM = 114, // IBM ipOverAtm ISO88025FIBER = 115, // ISO 802.5j Fiber Token Ring TDLC = 116, // IBM twinaxial data link control GIGABITETHERNET = 117, // Gigabit Ethernet HDLC = 118, // HDLC LAPF = 119, // LAP F V37 = 120, // V.37 X25MLP = 121, // Multi-Link Protocol X25HUNTGROUP = 122, // X25 Hunt Group TRANSPHDLC = 123, // Transp HDLC INTERLEAVE = 124, // Interleave channel FAST = 125, // Fast channel IP = 126, // IP (for APPN HPR in IP networks) DOCSCABLEMACLAYER = 127, // CATV Mac Layer DOCSCABLEDOWNSTREAM = 128, // CATV Downstream interface DOCSCABLEUPSTREAM = 129, // CATV Upstream interface A12MPPSWITCH = 130, // Avalon Parallel Processor TUNNEL = 131, // Encapsulation interface COFFEE = 132, // coffee pot CES = 133, // Circiut Emulation Service ATMSUBINTERFACE = 134, // (x) ATM Sub Interface L2VLAN = 135, // Layer 2 Virtual LAN using 802.1Q L3IPVLAN = 136, // Layer 3 Virtual LAN - IP Protocol L3IPXVLAN = 137, // Layer 3 Virtual LAN - IPX Prot. DIGITALPOWERLINE = 138, // IP over Power Lines MEDIAMAILOVERIP = 139, // (xxx) Multimedia Mail over IP DTM = 140, // Dynamic synchronous Transfer Mode DCN = 141, // Data Communications Network IPFORWARD = 142, // IP Forwarding Interface MSDSL = 143, // Multi-rate Symmetric DSL IEEE1394 = 144, // IEEE1394 High Performance SerialBus IFGSN = 145, // HIPPI-6400 DVBRCCMACLAYER = 146, // DVB-RCC MAC Layer DVBRCCDOWNSTREAM = 147, // DVB-RCC Downstream Channel DVBRCCUPSTREAM = 148, // DVB-RCC Upstream Channel ATMVIRTUAL = 149, // ATM Virtual Interface MPLSTUNNEL = 150, // MPLS Tunnel Virtual Interface SRP = 151, // Spatial Reuse Protocol VOICEOVERATM = 152, // Voice over ATM VOICEOVERFRAMERELAY = 153, // Voice Over Frame Relay IDSL = 154, // Digital Subscriber Loop over ISDN COMPOSITELINK = 155, // Avici Composite Link Interface SS7SIGLINK = 156, // SS7 Signaling Link PROPWIRELESSP2P = 157, // Prop. P2P wireless interface FRFORWARD = 158, // Frame forward Interface RFC1483 = 159, // Multiprotocol over ATM AAL5 USB = 160, // USB Interface IEEE8023ADLAG = 161, // IEEE 802.3ad Link Aggregate BGPPOLICYACCOUNTING = 162, // BGP Policy Accounting FRF16MFRBUNDLE = 163, // FRF.16 Multilink Frame Relay H323GATEKEEPER = 164, // H323 Gatekeeper H323PROXY = 165, // H323 Voice and Video Proxy MPLS = 166, // MPLS MFSIGLINK = 167, // Multi-frequency signaling link HDSL2 = 168, // High Bit-Rate DSL, 2nd gen. SHDSL = 169, // Multirate HDSL2 DS1FDL = 170, // Facility Data Link (4Kbps) on a DS1 POS = 171, // Packet over SONET/SDH Interface DVBASILN = 172, // DVB-ASI Input DVBASIOUT = 173, // DVB-ASI Output PLC = 174, // Power Line Communications NFAS = 175, // Non-Facility Associated Signaling TR008 = 176, // TROO8 GR303RDT = 177, // Remote Digital Terminal GR303IDT = 178, // Integrated Digital Terminal ISUP = 179, // ISUP PROPDOCSWIRELESSMACLAYER = 180, // prop/Wireless MAC Layer PROPDOCSWIRELESSDOWNSTREAM = 181, // prop/Wireless Downstream PROPDOCSWIRELESSUPSTREAM = 182, // prop/Wireless Upstream HIPERLAN2 = 183, // HIPERLAN Type 2 Radio Interface PROPBWAP2MP = 184, // PropBroadbandWirelessAccess P2MP SONETOVERHEADCHANNEL = 185, // SONET Overhead Channel DIGITALWRAPPEROVERHEADCHANNEL = 186, // Digital Wrapper Overhead AAL2 = 187, // ATM adaptation layer 2 RADIOMAC = 188, // MAC layer over radio links ATMRADIO = 189, // ATM over radio links IMT = 190, // Inter-Machine Trunks MVL = 191, // Multiple Virtual Lines DSL REACHDSL = 192, // Long Reach DSL FRDLCIENDPT = 193, // Frame Relay DLCI End Point ATMVCIENDPT = 194, // ATM VCI End Point OPTICALCHANNEL = 195, // Optical Channel OPTICALTRANSPORT = 196, // Optical Transport INFINIBAND = 199, // Infiniband INFINIBANDLAG = 200, // Infiniband Link Aggregate BRIDGE = 209, // Transparent bridge interface STF = 215, // 6to4 interface // Not based on IANA assignments. Conflicting with IANA assignments. // * We should make them negative probably. // * This requires changes to struct if_data. GIF = 240, // Generic tunnel interface PVC = 241, // Unused ENC = 244, // Encapsulating interface PFLOG = 246, // PF packet filter logging PFSYNC = 247, // PF packet filter synchronization WIREGUARD = 248, // WireGuard tunnel }Source

include <net/if_types.h>

enum ifType

MIB_Identifier

MIB_Identifier :: enum c.int { // Top-level identifiers CTL_SYSCTL = 0, // "magic" numbers CTL_KERN = 1, // "high kernel": proc, limits CTL_VM = 2, // virtual memory CTL_VFS = 3, // filesystem, mount type is next CTL_NET = 4, // network, see socket.h CTL_DEBUG = 5, // debugging parameters CTL_HW = 6, // generic cpu/io CTL_MACHDEP = 7, // machine dependent CTL_USER = 8, // user-level CTL_P1003_1B = 9, // POSIX 1003.1B // CTL_SYSCTL identifiers CTL_SYSCTL_DEBUG = 0, // printf all nodes CTL_SYSCTL_NAME = 1, // string name of OID CTL_SYSCTL_NEXT = 2, // next OID, honoring CTLFLAG_SKIP CTL_SYSCTL_NAME2OID = 3, // int array of name CTL_SYSCTL_OIDFMT = 4, // OID's kind and format CTL_SYSCTL_OIDDESCR = 5, // OID's description CTL_SYSCTL_OIDLABEL = 6, // aggregation label CTL_SYSCTL_NEXTNOSKIP = 7, // next OID, ignoring CTLFLAG_SKIP // CTL_KERN identifiers KERN_OSTYPE = 1, // string: system version KERN_OSRELEASE = 2, // string: system release KERN_OSREV = 3, // int: system revision KERN_VERSION = 4, // string: compile time info KERN_MAXVNODES = 5, // int: max vnodes KERN_MAXPROC = 6, // int: max processes KERN_MAXFILES = 7, // int: max open files KERN_ARGMAX = 8, // int: max arguments to exec KERN_SECURELVL = 9, // int: system security level KERN_HOSTNAME = 10, // string: hostname KERN_HOSTID = 11, // int: host identifier KERN_CLOCKRATE = 12, // struct: struct clockrate // was: #define KERN_VNODE13; disabled in 2003 and removed in 2023 KERN_PROC = 14, // struct: process entries KERN_FILE = 15, // struct: file entries KERN_PROF = 16, // node: kernel profiling info KERN_POSIX1 = 17, // int: POSIX.1 version KERN_NGROUPS = 18, // int: # of supplemental group ids KERN_JOB_CONTROL = 19, // int: is job control available KERN_SAVED_IDS = 20, // int: saved set-user/group-ID KERN_BOOTTIME = 21, // struct: time kernel was booted KERN_NISDOMAINNAME = 22, // string: YP domain name KERN_UPDATEINTERVAL = 23, // int: update process sleep time KERN_OSRELDATE = 24, // int: kernel release date KERN_NTP_PLL = 25, // node: NTP PLL control KERN_BOOTFILE = 26, // string: name of booted kernel KERN_MAXFILESPERPROC = 27, // int: max open files per proc KERN_MAXPROCPERUID = 28, // int: max processes per uid KERN_DUMPDEV = 29, // struct cdev *: device to dump on KERN_IPC = 30, // node: anything related to IPC KERN_DUMMY = 31, // unused KERN_PS_STRINGS = 32, // int: address of PS_STRINGS KERN_USRSTACK = 33, // int: address of USRSTACK KERN_LOGSIGEXIT = 34, // int: do we log sigexit procs? KERN_IOV_MAX = 35, // int: value of UIO_MAXIOV KERN_HOSTUUID = 36, // string: host UUID identifier KERN_ARND = 37, // int: from arc4rand() KERN_MAXPHYS = 38, // int: MAXPHYS value KERN_LOCKF = 39, // struct: lockf reports // KERN_PROC subtypes KERN_PROC_ALL = 0, // everything KERN_PROC_PID = 1, // by process id KERN_PROC_PGRP = 2, // by process group id KERN_PROC_SESSION = 3, // by session of pid KERN_PROC_TTY = 4, // by controlling tty KERN_PROC_UID = 5, // by effective uid KERN_PROC_RUID = 6, // by real uid KERN_PROC_ARGS = 7, // get/set arguments/proctitle KERN_PROC_PROC = 8, // only return procs KERN_PROC_SV_NAME = 9, // get syscall vector name KERN_PROC_RGID = 10, // by real group id KERN_PROC_GID = 11, // by effective group id KERN_PROC_PATHNAME = 12, // path to executable KERN_PROC_OVMMAP = 13, // Old VM map entries for process KERN_PROC_OFILEDESC = 14, // Old file descriptors for process KERN_PROC_KSTACK = 15, // Kernel stacks for process KERN_PROC_INC_THREAD = 16, // modifier for pid, pgrp, tty, uid, ruid, gid, rgid and proc. This effectively uses 16-31 KERN_PROC_VMMAP = 32, // VM map entries for process KERN_PROC_FILEDESC = 33, // File descriptors for process KERN_PROC_GROUPS = 34, // process groups KERN_PROC_ENV = 35, // get environment KERN_PROC_AUXV = 36, // get ELF auxiliary vector KERN_PROC_RLIMIT = 37, // process resource limits KERN_PROC_PS_STRINGS = 38, // get ps_strings location KERN_PROC_UMASK = 39, // process umask KERN_PROC_OSREL = 40, // osreldate for process binary KERN_PROC_SIGTRAMP = 41, // signal trampoline location KERN_PROC_CWD = 42, // process current working directory KERN_PROC_NFDS = 43, // number of open file descriptors KERN_PROC_SIGFASTBLK = 44, // address of fastsigblk magic word KERN_PROC_VM_LAYOUT = 45, // virtual address space layout info // KERN_IPC identifiers KIPC_MAXSOCKBUF = 1, // int: max size of a socket buffer KIPC_SOCKBUF_WASTE = 2, // int: wastage factor in sockbuf KIPC_SOMAXCONN = 3, // int: max length of connection q KIPC_MAX_LINKHDR = 4, // int: max length of link header KIPC_MAX_PROTOHDR = 5, // int: max length of network header KIPC_MAX_HDR = 6, // int: max total length of headers KIPC_MAX_DATALEN = 7, // int: max length of data? // Definitions for network related sysctl, CTL_NET. // * // * Second level is protocol family. // * Third level is protocol number. // * // * Further levels are defined by the individual families. // PF_ROUTE - Routing table // * // * Three additional levels are defined: // * Fourth: address family, 0 is wildcard // * Fifth: type of info, defined below // * Sixth: flag(s) to mask with for NET_RT_FLAGS NET_RT_DUMP = 1, // dump; may limit to a.f. NET_RT_FLAGS = 2, // by flags, e.g. RESOLVING NET_RT_IFLIST = 3, // survey interface list NET_RT_IFMALIST = 4, // return multicast address list NET_RT_IFLISTL = 5, // Survey interface list, using 'l'en versions of msghdr structs. NET_RT_NHOP = 6, // dump routing nexthops NET_RT_NHGRP = 7, // dump routing nexthop groups // CTL_HW identifiers HW_MACHINE = 1, // string: machine class HW_MODEL = 2, // string: specific machine model HW_NCPU = 3, // int: number of cpus HW_BYTEORDER = 4, // int: machine byte order HW_PHYSMEM = 5, // int: total memory HW_USERMEM = 6, // int: non-kernel memory HW_PAGESIZE = 7, // int: software page size HW_DISKNAMES = 8, // strings: disk drive names HW_DISKSTATS = 9, // struct: diskstats[] HW_FLOATINGPT = 10, // int: has HW floating point? HW_MACHINE_ARCH = 11, // string: machine architecture HW_REALMEM = 12, // int: 'real' memory // CTL_USER definitions USER_CS_PATH = 1, // string: _CS_PATH USER_BC_BASE_MAX = 2, // int: BC_BASE_MAX USER_BC_DIM_MAX = 3, // int: BC_DIM_MAX USER_BC_SCALE_MAX = 4, // int: BC_SCALE_MAX USER_BC_STRING_MAX = 5, // int: BC_STRING_MAX USER_COLL_WEIGHTS_MAX = 6, // int: COLL_WEIGHTS_MAX USER_EXPR_NEST_MAX = 7, // int: EXPR_NEST_MAX USER_LINE_MAX = 8, // int: LINE_MAX USER_RE_DUP_MAX = 9, // int: RE_DUP_MAX USER_POSIX2_VERSION = 10, // int: POSIX2_VERSION USER_POSIX2_C_BIND = 11, // int: POSIX2_C_BIND USER_POSIX2_C_DEV = 12, // int: POSIX2_C_DEV USER_POSIX2_CHAR_TERM = 13, // int: POSIX2_CHAR_TERM USER_POSIX2_FORT_DEV = 14, // int: POSIX2_FORT_DEV USER_POSIX2_FORT_RUN = 15, // int: POSIX2_FORT_RUN USER_POSIX2_LOCALEDEF = 16, // int: POSIX2_LOCALEDEF USER_POSIX2_SW_DEV = 17, // int: POSIX2_SW_DEV USER_POSIX2_UPE = 18, // int: POSIX2_UPE USER_STREAM_MAX = 19, // int: POSIX2_STREAM_MAX USER_TZNAME_MAX = 20, // int: POSIX2_TZNAME_MAX USER_LOCALBASE = 21, // string: _PATH_LOCALBASE CTL_P1003_1B_ASYNCHRONOUS_IO = 1, // boolean CTL_P1003_1B_MAPPED_FILES = 2, // boolean CTL_P1003_1B_MEMLOCK = 3, // boolean CTL_P1003_1B_MEMLOCK_RANGE = 4, // boolean CTL_P1003_1B_MEMORY_PROTECTION = 5, // boolean CTL_P1003_1B_MESSAGE_PASSING = 6, // boolean CTL_P1003_1B_PRIORITIZED_IO = 7, // boolean CTL_P1003_1B_PRIORITY_SCHEDULING = 8, // boolean CTL_P1003_1B_REALTIME_SIGNALS = 9, // boolean CTL_P1003_1B_SEMAPHORES = 10, // boolean CTL_P1003_1B_FSYNC = 11, // boolean CTL_P1003_1B_SHARED_MEMORY_OBJECTS = 12, // boolean CTL_P1003_1B_SYNCHRONIZED_IO = 13, // boolean CTL_P1003_1B_TIMERS = 14, // boolean CTL_P1003_1B_AIO_LISTIO_MAX = 15, // int CTL_P1003_1B_AIO_MAX = 16, // int CTL_P1003_1B_AIO_PRIO_DELTA_MAX = 17, // int CTL_P1003_1B_DELAYTIMER_MAX = 18, // int CTL_P1003_1B_MQ_OPEN_MAX = 19, // int CTL_P1003_1B_PAGESIZE = 20, // int CTL_P1003_1B_RTSIG_MAX = 21, // int CTL_P1003_1B_SEM_NSEMS_MAX = 22, // int CTL_P1003_1B_SEM_VALUE_MAX = 23, // int CTL_P1003_1B_SIGQUEUE_MAX = 24, // int CTL_P1003_1B_TIMER_MAX = 25, // int }Source

include <sys/sysctl.h>

MIB, or Management Information Base. Used in sysctl().

Message_Flag

Message_Flag :: enum c.int { OOB = 1, // process out-of-band data PEEK = 2, // peek at incoming message DONTROUTE = 4, // send without using routing tables EOR = 8, // data completes record TRUNC = 16, // data discarded before delivery CTRUNC = 32, // control data lost before delivery WAITALL = 64, // wait for full request or error DONTWAIT = 128, // this message should be nonblocking EOF = 256, // data completes connection // 0x00000200 unused // 0x00000400 unused // 0x00000800 unused // 0x00001000 unused NOTIFICATION = 8192, // SCTP notification NBIO = 16384, // FIONBIO mode, used by fifofs COMPAT = 32768, // used in sendit() SOCALLBCK = 65536, // for use by socket callbacks - soreceive (TCP) NOSIGNAL = 131072, // do not generate SIGPIPE on EOF CMSG_CLOEXEC = 262144, // make received fds close-on-exec WAITFORONE = 524288, // for recvmmsg() }Source

define MSG_*

Protocol

Protocol :: enum c.int { IP = 0, ICMP = 1, IGMP = 2, GGP = 3, IP_ENCAP = 4, ST2 = 5, TCP = 6, CBT = 7, EGP = 8, IGP = 9, BBN_RCC_MON = 10, NVP_II = 11, PUP = 12, ARGUS = 13, EMCON = 14, XNET = 15, CHAOS = 16, UDP = 17, MUX = 18, DCN_MEAS = 19, HMP = 20, PRM = 21, XNS_IDP = 22, TRUNK_1 = 23, TRUNK_2 = 24, LEAF_1 = 25, LEAF_2 = 26, RDP = 27, IRTP = 28, ISO_TP4 = 29, NETBLT = 30, MFE_NSP = 31, MERIT_INP = 32, DCCP = 33, THREE_PC = 34, IDPR = 35, XTP = 36, DDP = 37, IDPR_CMTP = 38, TP_PlusPlus = 39, IL = 40, IPV6 = 41, SDRP = 42, IPV6_ROUTE = 43, IPV6_FRAG = 44, IDRP = 45, RSVP = 46, GRE = 47, DSR = 48, BNA = 49, ESP = 50, AH = 51, I_NLSP = 52, SWIPE = 53, NARP = 54, MOBILE = 55, TLSP = 56, SKIP = 57, IPV6_ICMP = 58, IPV6_NONXT = 59, IPV6_OPTS = 60, CFTP = 62, SAT_EXPAK = 64, KRYPTOLAN = 65, RVD = 66, IPPC = 67, SAT_MON = 69, VISA = 70, IPCV = 71, CPNX = 72, CPHB = 73, WSN = 74, PVP = 75, BR_SAT_MON = 76, SUN_ND = 77, WB_MON = 78, WB_EXPAK = 79, ISO_IP = 80, VMTP = 81, SECURE_VMTP = 82, VINES = 83, TTP = 84, IPTM = 84, NSFNET_IGP = 85, DGP = 86, TCF = 87, EIGRP = 88, OSPFIGP = 89, Sprite_RPC = 90, LARP = 91, MTP = 92, AX_25 = 93, IPIP = 94, MICP = 95, SCC_SP = 96, ETHERIP = 97, ENCAP = 98, GMTP = 100, IFMP = 101, PNNI = 102, PIM = 103, ARIS = 104, SCPS = 105, QNX = 106, A_N = 107, IPComp = 108, SNP = 109, Compaq_Peer = 110, IPX_in_IP = 111, CARP = 112, PGM = 113, L2TP = 115, DDX = 116, IATP = 117, STP = 118, SRP = 119, UTI = 120, SMP = 121, SM = 122, PTP = 123, ISIS = 124, FIRE = 125, CRTP = 126, CRUDP = 127, SSCOPMCE = 128, IPLT = 129, SPS = 130, PIPE = 131, SCTP = 132, FC = 133, RSVP_E2E_IGNORE = 134, Mobility_Header = 135, UDPLite = 136, MPLS_IN_IP = 137, MANET = 138, HIP = 139, SHIM6 = 140, WESP = 141, ROHC = 142, PFSYNC = 240, DIVERT = 258, }Source

/etc/protocols

Protocol_Family

Protocol_Family :: enum sa_family_t { UNSPEC = cast(sa_family_t)Address_Family.UNSPEC, LOCAL = cast(sa_family_t)Address_Family.LOCAL, UNIX = LOCAL, INET = cast(sa_family_t)Address_Family.INET, IMPLINK = cast(sa_family_t)Address_Family.IMPLINK, PUP = cast(sa_family_t)Address_Family.PUP, CHAOS = cast(sa_family_t)Address_Family.CHAOS, NETBIOS = cast(sa_family_t)Address_Family.NETBIOS, ISO = cast(sa_family_t)Address_Family.ISO, OSI = cast(sa_family_t)Address_Family.ISO, ECMA = cast(sa_family_t)Address_Family.ECMA, DATAKIT = cast(sa_family_t)Address_Family.DATAKIT, CCITT = cast(sa_family_t)Address_Family.CCITT, SNA = cast(sa_family_t)Address_Family.SNA, DECnet = cast(sa_family_t)Address_Family.DECnet, DLI = cast(sa_family_t)Address_Family.DLI, LAT = cast(sa_family_t)Address_Family.LAT, HYLINK = cast(sa_family_t)Address_Family.HYLINK, APPLETALK = cast(sa_family_t)Address_Family.APPLETALK, ROUTE = cast(sa_family_t)Address_Family.ROUTE, LINK = cast(sa_family_t)Address_Family.LINK, XTP = cast(sa_family_t)Address_Family.PSEUDO_XTP, COIP = cast(sa_family_t)Address_Family.COIP, CNT = cast(sa_family_t)Address_Family.CNT, SIP = cast(sa_family_t)Address_Family.SIP, IPX = cast(sa_family_t)Address_Family.IPX, RTIP = cast(sa_family_t)Address_Family.PSEUDO_RTIP, PIP = cast(sa_family_t)Address_Family.PSEUDO_PIP, ISDN = cast(sa_family_t)Address_Family.ISDN, KEY = cast(sa_family_t)Address_Family.PSEUDO_KEY, INET6 = cast(sa_family_t)Address_Family.INET6, NATM = cast(sa_family_t)Address_Family.NATM, ATM = cast(sa_family_t)Address_Family.ATM, NETGRAPH = cast(sa_family_t)Address_Family.NETGRAPH, SLOW = cast(sa_family_t)Address_Family.SLOW, SCLUSTER = cast(sa_family_t)Address_Family.SCLUSTER, ARP = cast(sa_family_t)Address_Family.ARP, BLUETOOTH = cast(sa_family_t)Address_Family.BLUETOOTH, IEEE80211 = cast(sa_family_t)Address_Family.IEEE80211, NETLINK = cast(sa_family_t)Address_Family.NETLINK, INET_SDP = cast(sa_family_t)Address_Family.INET_SDP, INET6_SDP = cast(sa_family_t)Address_Family.INET6_SDP, DIVERT = cast(sa_family_t)Address_Family.DIVERT, MAX = cast(sa_family_t)Address_Family.MAX, }Source

define PF_*

Record_Lock_Flag

Record_Lock_Flag :: enum c.int { RDLCK = 1, // shared or read lock UNLCK = 2, // unlock WRLCK = 3, // exclusive or write lock UNLCKSYS = 4, // purge locks for a given system ID CANCEL = 5, // cancel an async lock request }Source

record locking flags (F_GETLK, F_SETLK, F_SETLKW)

define F_*

Recv_Flags

Recv_Flags :: enum c.int { NONE = 0, OOB = cast(c.int)Message_Flag.OOB, // process out-of-band data PEEK = cast(c.int)Message_Flag.PEEK, // peek at incoming message TRUNC = cast(c.int)Message_Flag.TRUNC, // return real packet or datagram length WAITALL = cast(c.int)Message_Flag.WAITALL, // wait for full request or error DONTWAIT = cast(c.int)Message_Flag.DONTWAIT, // do not block CMSG_CLOEXEC = cast(c.int)Message_Flag.CMSG_CLOEXEC, // set received fds close-on-exec WAITFORONE = cast(c.int)Message_Flag.WAITFORONE, // do not block after receiving the first message }Source

Specific subset of MSG_* defines that are only for recv*.

Route_Address_Flag

Route_Address_Flag :: enum c.int { DST = 1, // destination sockaddr present GATEWAY = 2, // gateway sockaddr present NETMASK = 4, // netmask sockaddr present GENMASK = 8, // cloning mask sockaddr present IFP = 16, // interface name sockaddr present IFA = 32, // interface addr sockaddr present AUTHOR = 64, // sockaddr for author of redirect BRD = 128, // for NEWADDR, broadcast or p-p dest addr }Source

Bitmask values for rtm_addrs.

define RTA_*

Route_Address_Index

Route_Address_Index :: enum c.int { DST = 0, // destination sockaddr present GATEWAY = 1, // gateway sockaddr present NETMASK = 2, // netmask sockaddr present GENMASK = 3, // cloning mask sockaddr present IFP = 4, // interface name sockaddr present IFA = 5, // interface addr sockaddr present AUTHOR = 6, // sockaddr for author of redirect BRD = 7, // for NEWADDR, broadcast or p-p dest addr MAX = 8, // size of array to allocate }Source

Index offsets for sockaddr array for alternate internal encoding.

define RTAX_*

Route_Message_Type

Route_Message_Type :: enum c.uchar { ADD = 1, // (1) Add Route DELETE = 2, // (1) Delete Route CHANGE = 3, // (1) Change Metrics or flags GET = 4, // (1) Report Metrics LOSING = 5, // (1) Kernel Suspects Partitioning REDIRECT = 6, // (1) Told to use different route MISS = 7, // (1) Lookup failed on this address LOCK = 8, // (1) fix specified metrics // = 0x9 // = 0xa RESOLVE = 11, // (1) req to resolve dst to LL addr NEWADDR = 12, // (2) address being added to iface DELADDR = 13, // (2) address being removed from iface IFINFO = 14, // (3) iface going up/down etc. NEWMADDR = 15, // (4) mcast group membership being added to if DELMADDR = 16, // (4) mcast group membership being deleted IFANNOUNCE = 17, // (5) iface arrival/departure IEEE80211 = 18, // (5) IEEE80211 wireless event }Source

Message types. *

  • The format for each message is annotated below using the following
  • identifiers:

*

  • (1) struct rt_msghdr
  • (2) struct ifa_msghdr
  • (3) struct if_msghdr
  • (4) struct ifma_msghdr
  • (5) struct if_announcemsghdr

*

define RTM_*

Send_Flags

Send_Flags :: enum c.int { NONE = 0, OOB = cast(c.int)Message_Flag.OOB, // process out-of-band data DONTROUTE = cast(c.int)Message_Flag.DONTROUTE, // bypass routing, use direct interface EOR = cast(c.int)Message_Flag.EOR, // data completes record DONTWAIT = cast(c.int)Message_Flag.DONTWAIT, // do not block EOF = cast(c.int)Message_Flag.EOF, // data completes transaction NOSIGNAL = cast(c.int)Message_Flag.NOSIGNAL, // do not generate SIGPIPE on EOF }Source

Specific subset of MSG_* defines that are only for send*.

Shutdown_Method

Shutdown_Method :: enum c.int { RD = 0, // shut down the reading side WR = 1, // shut down the writing side RDWR = 2, // shut down both sides }Source

howto arguments for shutdown(2), specified by Posix.1g.

define SHUT_*

Socket_Option

Socket_Option :: enum c.int { DEBUG = 1, // turn on debugging info recording ACCEPTCONN = 2, // socket has had listen() REUSEADDR = 4, // allow local address reuse KEEPALIVE = 8, // keep connections alive DONTROUTE = 16, // just use interface addresses BROADCAST = 32, // permit sending of broadcast msgs USELOOPBACK = 64, // bypass hardware when possible LINGER = 128, // linger on close if data present OOBINLINE = 256, // leave received OOB data in line REUSEPORT = 512, // allow local address & port reuse TIMESTAMP = 1024, // timestamp received dgram traffic NOSIGPIPE = 2048, // no SIGPIPE from EPIPE ACCEPTFILTER = 4096, // there is an accept filter BINTIME = 8192, // timestamp received dgram traffic NO_OFFLOAD = 16384, // socket cannot be offloaded NO_DDP = 32768, // disable direct data placement REUSEPORT_LB = 65536, // reuse with load balancing RERROR = 131072, // keep track of receive errors // Additional options, not kept in so_options. SNDBUF = 4097, // send buffer size RCVBUF = 4098, // receive buffer size SNDLOWAT = 4099, // send low-water mark RCVLOWAT = 4100, // receive low-water mark SNDTIMEO = 4101, // send timeout RCVTIMEO = 4102, // receive timeout ERROR = 4103, // get error status and clear TYPE = 4104, // get socket type LABEL = 4105, // socket's MAC label PEERLABEL = 4112, // socket's peer's MAC label LISTENQLIMIT = 4113, // socket's backlog limit LISTENQLEN = 4114, // socket's complete queue length LISTENINCQLEN = 4115, // socket's incomplete queue length SETFIB = 4116, // use this FIB to route USER_COOKIE = 4117, // user cookie (dummynet etc.) PROTOCOL = 4118, // get socket protocol (Linux name) PROTOTYPE = PROTOCOL, // alias for SO_PROTOCOL (SunOS name) TS_CLOCK = 4119, // clock type used for SO_TIMESTAMP MAX_PACING_RATE = 4120, // socket's max TX pacing rate (Linux name) DOMAIN = 4121, // get socket domain TS_REALTIME_MICRO = 0, // microsecond resolution, realtime TS_BINTIME = 1, // sub-nanosecond resolution, realtime TS_REALTIME = 2, // nanosecond resolution, realtime TS_MONOTONIC = 3, // nanosecond resolution, monotonic TS_DEFAULT = TS_REALTIME_MICRO, TS_CLOCK_MAX = TS_MONOTONIC, }Source

Option flags per-socket.

define SO_*

Socket_Type

Socket_Type :: enum c.int { STREAM = 1, // stream socket DGRAM = 2, // datagram socket RAW = 3, // raw-protocol interface RDM = 4, // reliably-delivered message SEQPACKET = 5, // sequenced packet stream // Creation flags, OR'ed into socket() and socketpair() type argument. CLOEXEC = 268435456, NONBLOCK = 536870912, }Source

include <sys/socket.h>

Types

define SOCK_*

Userland_Mutex_Operation

Userland_Mutex_Operation :: enum c.int { LOCK = 0, // COMPAT10 UNLOCK = 1, // COMPAT10 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 = 21, MUTEX_WAKE2 = 22, SEM2_WAIT = 23, SEM2_WAKE = 24, SHM = 25, ROBUST_LISTS = 26, GET_MIN_TIMEOUT = 27, SET_MIN_TIMEOUT = 28, }Source

include <sys/umtx.h>

op code for _umtx_op

define UMTX_OP_*

Constants

30

SYS_read

SYS_read :: uintptr = 3Source

FreeBSD 15 syscall numbers See: https://alfonsosiciliano.gitlab.io/posts/2023-08-28-freebsd-15-system-calls.html

Procedures

40

_umtx_op

_umtx_op :: proc(obj: rawptr, op: Userland_Mutex_Operation, val: c.ulong, uaddr: rawptr, uaddr2: rawptr) -> (Errno)Source

Interface for implementation of userspace threading synchronization primitives.

The _umtx_op() system call is non-standard and is used by the 1:1 Threading Library (libthr, -lthr) to implement IEEE Std 1003.1-2001 (“POSIX.1”) pthread(3) functionality.

bind

bind :: proc(s: Fd, sockaddr: ^T, addrlen: socklen_t) -> (Errno)Source

Assign a local protocol address to a socket.

The bind() system call appeared in 4.2BSD.

close

close :: proc(fd: Fd) -> (Errno)Source

Delete a descriptor.

The open() function appeared in Version 1 AT&T UNIX.

fcntl

fcntl :: proc(fd: Fd, cmd: File_Control_Command, arg: c.int) -> (Errno, int)Source

File control.

The fcntl() system call appeared in 4.2BSD. The F_DUP2FD constant first appeared in FreeBSD 7.1.

NOTE: If you know at compile-time what command you're calling, use one of the fcntl_* procedures instead to preserve type safety.

fsync

fsync :: proc(fd: Fd) -> (Errno)Source

Synchronize changes to a file.

The fsync() system call appeared in 4.2BSD.

getpid

getpid :: proc() -> (pid_t)Source

Get parent or calling process identification.

The getpid() function appeared in Version 7 AT&T UNIX.

open

open :: proc(path: string, flags: File_Status_Flags, mode: int) -> (Errno, Fd)Source

Open or create a file for reading, writing or executing.

The open() function appeared in Version 1 AT&T UNIX. The openat() function was introduced in FreeBSD 8.0.

pread

pread :: proc(fd: Fd, buf: []u8, offset: off_t) -> (Errno, int)Source

Read input without modifying the file pointer.

The pread() function appeared in AT&T System V Release 4 UNIX.

pwrite

pwrite :: proc(fd: Fd, buf: []u8, offset: off_t) -> (Errno, int)Source

Write output without modifying the file pointer.

The pwrite() function appeared in AT&T System V Release 4 UNIX.

BUGS

The pwrite() system call appends the file without changing the file offset if O_APPEND is set, contrary to IEEE Std 1003.1-2008 (“POSIX.1”) where pwrite() writes into offset regardless of whether O_APPEND is set.

read

read :: proc(fd: Fd, buf: []u8) -> (Errno, int)Source

Odin syscall wrappers

Read input.

The read() function appeared in Version 1 AT&T UNIX.

recv

recv :: proc(s: Fd, buf: []u8, flags: Recv_Flags) -> (Errno, int)Source

Receive message(s) from a socket.

The recv() function appeared in 4.2BSD. The recvmmsg() function appeared in FreeBSD 11.0.

send

send :: proc(s: Fd, msg: []u8, flags: Send_Flags) -> (Errno, int)Source

Send message(s) from a socket.

The send() function appeared in 4.2BSD. The sendmmsg() function appeared in FreeBSD 11.0.

sendto

sendto :: proc(s: Fd, msg: []u8, flags: Send_Flags, to: ^T) -> (Errno, int)Source

Send message(s) from a socket.

The send() function appeared in 4.2BSD. The sendmmsg() function appeared in FreeBSD 11.0.

Procedure Groups

2

Reference search

Find anything

Documentation preferences

Settings

System theme variants

Used only while Theme is set to System.