std.os reorganization, avoiding usingnamespace
The main purpose of this branch is to explore avoiding the `usingnamespace` feature of the zig language, specifically with regards to `std.os` and related functionality. If this experiment is successful, it will provide a data point on whether or not it would be practical to entirely remove `usingnamespace` from the language. In this commit, `usingnamespace` has been completely eliminated from the Linux x86_64 compilation path, aside from io_uring. The behavior tests pass, however that's as far as this branch goes. It is very breaking, and a lot more work is needed before it could be considered mergeable. I wanted to put a pull requset up early so that zig programmers have time to provide feedback. This is progress towards closing #6600 since it clarifies where the actual "owner" of each declaration is, and reduces the number of different ways to import the same declarations. One of the main organizational strategies used here is to do namespacing with real namespaces (e.g. structs) rather than by having declarations share a common prefix (the C strategy). It's no coincidence that `usingnamespace` has similar semantics to `#include` and becomes much less necessary when using proper namespaces.
This commit is contained in:
@@ -1,460 +0,0 @@
|
||||
pub const E = enum(u16) {
|
||||
/// No error occurred.
|
||||
/// Same code used for `NSROK`.
|
||||
SUCCESS = 0,
|
||||
|
||||
/// Operation not permitted
|
||||
PERM = 1,
|
||||
|
||||
/// No such file or directory
|
||||
NOENT = 2,
|
||||
|
||||
/// No such process
|
||||
SRCH = 3,
|
||||
|
||||
/// Interrupted system call
|
||||
INTR = 4,
|
||||
|
||||
/// I/O error
|
||||
IO = 5,
|
||||
|
||||
/// No such device or address
|
||||
NXIO = 6,
|
||||
|
||||
/// Arg list too long
|
||||
@"2BIG" = 7,
|
||||
|
||||
/// Exec format error
|
||||
NOEXEC = 8,
|
||||
|
||||
/// Bad file number
|
||||
BADF = 9,
|
||||
|
||||
/// No child processes
|
||||
CHILD = 10,
|
||||
|
||||
/// Try again
|
||||
/// Also means: WOULDBLOCK: operation would block
|
||||
AGAIN = 11,
|
||||
|
||||
/// Out of memory
|
||||
NOMEM = 12,
|
||||
|
||||
/// Permission denied
|
||||
ACCES = 13,
|
||||
|
||||
/// Bad address
|
||||
FAULT = 14,
|
||||
|
||||
/// Block device required
|
||||
NOTBLK = 15,
|
||||
|
||||
/// Device or resource busy
|
||||
BUSY = 16,
|
||||
|
||||
/// File exists
|
||||
EXIST = 17,
|
||||
|
||||
/// Cross-device link
|
||||
XDEV = 18,
|
||||
|
||||
/// No such device
|
||||
NODEV = 19,
|
||||
|
||||
/// Not a directory
|
||||
NOTDIR = 20,
|
||||
|
||||
/// Is a directory
|
||||
ISDIR = 21,
|
||||
|
||||
/// Invalid argument
|
||||
INVAL = 22,
|
||||
|
||||
/// File table overflow
|
||||
NFILE = 23,
|
||||
|
||||
/// Too many open files
|
||||
MFILE = 24,
|
||||
|
||||
/// Not a typewriter
|
||||
NOTTY = 25,
|
||||
|
||||
/// Text file busy
|
||||
TXTBSY = 26,
|
||||
|
||||
/// File too large
|
||||
FBIG = 27,
|
||||
|
||||
/// No space left on device
|
||||
NOSPC = 28,
|
||||
|
||||
/// Illegal seek
|
||||
SPIPE = 29,
|
||||
|
||||
/// Read-only file system
|
||||
ROFS = 30,
|
||||
|
||||
/// Too many links
|
||||
MLINK = 31,
|
||||
|
||||
/// Broken pipe
|
||||
PIPE = 32,
|
||||
|
||||
/// Math argument out of domain of func
|
||||
DOM = 33,
|
||||
|
||||
/// Math result not representable
|
||||
RANGE = 34,
|
||||
|
||||
/// Resource deadlock would occur
|
||||
DEADLK = 35,
|
||||
|
||||
/// File name too long
|
||||
NAMETOOLONG = 36,
|
||||
|
||||
/// No record locks available
|
||||
NOLCK = 37,
|
||||
|
||||
/// Function not implemented
|
||||
NOSYS = 38,
|
||||
|
||||
/// Directory not empty
|
||||
NOTEMPTY = 39,
|
||||
|
||||
/// Too many symbolic links encountered
|
||||
LOOP = 40,
|
||||
|
||||
/// No message of desired type
|
||||
NOMSG = 42,
|
||||
|
||||
/// Identifier removed
|
||||
IDRM = 43,
|
||||
|
||||
/// Channel number out of range
|
||||
CHRNG = 44,
|
||||
|
||||
/// Level 2 not synchronized
|
||||
L2NSYNC = 45,
|
||||
|
||||
/// Level 3 halted
|
||||
L3HLT = 46,
|
||||
|
||||
/// Level 3 reset
|
||||
L3RST = 47,
|
||||
|
||||
/// Link number out of range
|
||||
LNRNG = 48,
|
||||
|
||||
/// Protocol driver not attached
|
||||
UNATCH = 49,
|
||||
|
||||
/// No CSI structure available
|
||||
NOCSI = 50,
|
||||
|
||||
/// Level 2 halted
|
||||
L2HLT = 51,
|
||||
|
||||
/// Invalid exchange
|
||||
BADE = 52,
|
||||
|
||||
/// Invalid request descriptor
|
||||
BADR = 53,
|
||||
|
||||
/// Exchange full
|
||||
XFULL = 54,
|
||||
|
||||
/// No anode
|
||||
NOANO = 55,
|
||||
|
||||
/// Invalid request code
|
||||
BADRQC = 56,
|
||||
|
||||
/// Invalid slot
|
||||
BADSLT = 57,
|
||||
|
||||
/// Bad font file format
|
||||
BFONT = 59,
|
||||
|
||||
/// Device not a stream
|
||||
NOSTR = 60,
|
||||
|
||||
/// No data available
|
||||
NODATA = 61,
|
||||
|
||||
/// Timer expired
|
||||
TIME = 62,
|
||||
|
||||
/// Out of streams resources
|
||||
NOSR = 63,
|
||||
|
||||
/// Machine is not on the network
|
||||
NONET = 64,
|
||||
|
||||
/// Package not installed
|
||||
NOPKG = 65,
|
||||
|
||||
/// Object is remote
|
||||
REMOTE = 66,
|
||||
|
||||
/// Link has been severed
|
||||
NOLINK = 67,
|
||||
|
||||
/// Advertise error
|
||||
ADV = 68,
|
||||
|
||||
/// Srmount error
|
||||
SRMNT = 69,
|
||||
|
||||
/// Communication error on send
|
||||
COMM = 70,
|
||||
|
||||
/// Protocol error
|
||||
PROTO = 71,
|
||||
|
||||
/// Multihop attempted
|
||||
MULTIHOP = 72,
|
||||
|
||||
/// RFS specific error
|
||||
DOTDOT = 73,
|
||||
|
||||
/// Not a data message
|
||||
BADMSG = 74,
|
||||
|
||||
/// Value too large for defined data type
|
||||
OVERFLOW = 75,
|
||||
|
||||
/// Name not unique on network
|
||||
NOTUNIQ = 76,
|
||||
|
||||
/// File descriptor in bad state
|
||||
BADFD = 77,
|
||||
|
||||
/// Remote address changed
|
||||
REMCHG = 78,
|
||||
|
||||
/// Can not access a needed shared library
|
||||
LIBACC = 79,
|
||||
|
||||
/// Accessing a corrupted shared library
|
||||
LIBBAD = 80,
|
||||
|
||||
/// .lib section in a.out corrupted
|
||||
LIBSCN = 81,
|
||||
|
||||
/// Attempting to link in too many shared libraries
|
||||
LIBMAX = 82,
|
||||
|
||||
/// Cannot exec a shared library directly
|
||||
LIBEXEC = 83,
|
||||
|
||||
/// Illegal byte sequence
|
||||
ILSEQ = 84,
|
||||
|
||||
/// Interrupted system call should be restarted
|
||||
RESTART = 85,
|
||||
|
||||
/// Streams pipe error
|
||||
STRPIPE = 86,
|
||||
|
||||
/// Too many users
|
||||
USERS = 87,
|
||||
|
||||
/// Socket operation on non-socket
|
||||
NOTSOCK = 88,
|
||||
|
||||
/// Destination address required
|
||||
DESTADDRREQ = 89,
|
||||
|
||||
/// Message too long
|
||||
MSGSIZE = 90,
|
||||
|
||||
/// Protocol wrong type for socket
|
||||
PROTOTYPE = 91,
|
||||
|
||||
/// Protocol not available
|
||||
NOPROTOOPT = 92,
|
||||
|
||||
/// Protocol not supported
|
||||
PROTONOSUPPORT = 93,
|
||||
|
||||
/// Socket type not supported
|
||||
SOCKTNOSUPPORT = 94,
|
||||
|
||||
/// Operation not supported on transport endpoint
|
||||
/// This code also means `NOTSUP`.
|
||||
OPNOTSUPP = 95,
|
||||
|
||||
/// Protocol family not supported
|
||||
PFNOSUPPORT = 96,
|
||||
|
||||
/// Address family not supported by protocol
|
||||
AFNOSUPPORT = 97,
|
||||
|
||||
/// Address already in use
|
||||
ADDRINUSE = 98,
|
||||
|
||||
/// Cannot assign requested address
|
||||
ADDRNOTAVAIL = 99,
|
||||
|
||||
/// Network is down
|
||||
NETDOWN = 100,
|
||||
|
||||
/// Network is unreachable
|
||||
NETUNREACH = 101,
|
||||
|
||||
/// Network dropped connection because of reset
|
||||
NETRESET = 102,
|
||||
|
||||
/// Software caused connection abort
|
||||
CONNABORTED = 103,
|
||||
|
||||
/// Connection reset by peer
|
||||
CONNRESET = 104,
|
||||
|
||||
/// No buffer space available
|
||||
NOBUFS = 105,
|
||||
|
||||
/// Transport endpoint is already connected
|
||||
ISCONN = 106,
|
||||
|
||||
/// Transport endpoint is not connected
|
||||
NOTCONN = 107,
|
||||
|
||||
/// Cannot send after transport endpoint shutdown
|
||||
SHUTDOWN = 108,
|
||||
|
||||
/// Too many references: cannot splice
|
||||
TOOMANYREFS = 109,
|
||||
|
||||
/// Connection timed out
|
||||
TIMEDOUT = 110,
|
||||
|
||||
/// Connection refused
|
||||
CONNREFUSED = 111,
|
||||
|
||||
/// Host is down
|
||||
HOSTDOWN = 112,
|
||||
|
||||
/// No route to host
|
||||
HOSTUNREACH = 113,
|
||||
|
||||
/// Operation already in progress
|
||||
ALREADY = 114,
|
||||
|
||||
/// Operation now in progress
|
||||
INPROGRESS = 115,
|
||||
|
||||
/// Stale NFS file handle
|
||||
STALE = 116,
|
||||
|
||||
/// Structure needs cleaning
|
||||
UCLEAN = 117,
|
||||
|
||||
/// Not a XENIX named type file
|
||||
NOTNAM = 118,
|
||||
|
||||
/// No XENIX semaphores available
|
||||
NAVAIL = 119,
|
||||
|
||||
/// Is a named type file
|
||||
ISNAM = 120,
|
||||
|
||||
/// Remote I/O error
|
||||
REMOTEIO = 121,
|
||||
|
||||
/// Quota exceeded
|
||||
DQUOT = 122,
|
||||
|
||||
/// No medium found
|
||||
NOMEDIUM = 123,
|
||||
|
||||
/// Wrong medium type
|
||||
MEDIUMTYPE = 124,
|
||||
|
||||
/// Operation canceled
|
||||
CANCELED = 125,
|
||||
|
||||
/// Required key not available
|
||||
NOKEY = 126,
|
||||
|
||||
/// Key has expired
|
||||
KEYEXPIRED = 127,
|
||||
|
||||
/// Key has been revoked
|
||||
KEYREVOKED = 128,
|
||||
|
||||
/// Key was rejected by service
|
||||
KEYREJECTED = 129,
|
||||
|
||||
// for robust mutexes
|
||||
|
||||
/// Owner died
|
||||
OWNERDEAD = 130,
|
||||
|
||||
/// State not recoverable
|
||||
NOTRECOVERABLE = 131,
|
||||
|
||||
/// Operation not possible due to RF-kill
|
||||
RFKILL = 132,
|
||||
|
||||
/// Memory page has hardware error
|
||||
HWPOISON = 133,
|
||||
|
||||
// nameserver query return codes
|
||||
|
||||
/// DNS server returned answer with no data
|
||||
NSRNODATA = 160,
|
||||
|
||||
/// DNS server claims query was misformatted
|
||||
NSRFORMERR = 161,
|
||||
|
||||
/// DNS server returned general failure
|
||||
NSRSERVFAIL = 162,
|
||||
|
||||
/// Domain name not found
|
||||
NSRNOTFOUND = 163,
|
||||
|
||||
/// DNS server does not implement requested operation
|
||||
NSRNOTIMP = 164,
|
||||
|
||||
/// DNS server refused query
|
||||
NSRREFUSED = 165,
|
||||
|
||||
/// Misformatted DNS query
|
||||
NSRBADQUERY = 166,
|
||||
|
||||
/// Misformatted domain name
|
||||
NSRBADNAME = 167,
|
||||
|
||||
/// Unsupported address family
|
||||
NSRBADFAMILY = 168,
|
||||
|
||||
/// Misformatted DNS reply
|
||||
NSRBADRESP = 169,
|
||||
|
||||
/// Could not contact DNS servers
|
||||
NSRCONNREFUSED = 170,
|
||||
|
||||
/// Timeout while contacting DNS servers
|
||||
NSRTIMEOUT = 171,
|
||||
|
||||
/// End of file
|
||||
NSROF = 172,
|
||||
|
||||
/// Error reading file
|
||||
NSRFILE = 173,
|
||||
|
||||
/// Out of memory
|
||||
NSRNOMEM = 174,
|
||||
|
||||
/// Application terminated lookup
|
||||
NSRDESTRUCTION = 175,
|
||||
|
||||
/// Domain name is too long
|
||||
NSRQUERYDOMAINTOOLONG = 176,
|
||||
|
||||
/// Domain name is too long
|
||||
NSRCNAMELOOP = 177,
|
||||
|
||||
_,
|
||||
};
|
||||
@@ -1,141 +0,0 @@
|
||||
//! These are MIPS ABI compatible.
|
||||
pub const E = enum(i32) {
|
||||
/// No error occurred.
|
||||
SUCCESS = 0,
|
||||
|
||||
PERM = 1,
|
||||
NOENT = 2,
|
||||
SRCH = 3,
|
||||
INTR = 4,
|
||||
IO = 5,
|
||||
NXIO = 6,
|
||||
@"2BIG" = 7,
|
||||
NOEXEC = 8,
|
||||
BADF = 9,
|
||||
CHILD = 10,
|
||||
/// Also used for WOULDBLOCK.
|
||||
AGAIN = 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,
|
||||
|
||||
NOMSG = 35,
|
||||
IDRM = 36,
|
||||
CHRNG = 37,
|
||||
L2NSYNC = 38,
|
||||
L3HLT = 39,
|
||||
L3RST = 40,
|
||||
LNRNG = 41,
|
||||
UNATCH = 42,
|
||||
NOCSI = 43,
|
||||
L2HLT = 44,
|
||||
DEADLK = 45,
|
||||
NOLCK = 46,
|
||||
BADE = 50,
|
||||
BADR = 51,
|
||||
XFULL = 52,
|
||||
NOANO = 53,
|
||||
BADRQC = 54,
|
||||
BADSLT = 55,
|
||||
DEADLOCK = 56,
|
||||
BFONT = 59,
|
||||
NOSTR = 60,
|
||||
NODATA = 61,
|
||||
TIME = 62,
|
||||
NOSR = 63,
|
||||
NONET = 64,
|
||||
NOPKG = 65,
|
||||
REMOTE = 66,
|
||||
NOLINK = 67,
|
||||
ADV = 68,
|
||||
SRMNT = 69,
|
||||
COMM = 70,
|
||||
PROTO = 71,
|
||||
DOTDOT = 73,
|
||||
MULTIHOP = 74,
|
||||
BADMSG = 77,
|
||||
NAMETOOLONG = 78,
|
||||
OVERFLOW = 79,
|
||||
NOTUNIQ = 80,
|
||||
BADFD = 81,
|
||||
REMCHG = 82,
|
||||
LIBACC = 83,
|
||||
LIBBAD = 84,
|
||||
LIBSCN = 85,
|
||||
LIBMAX = 86,
|
||||
LIBEXEC = 87,
|
||||
ILSEQ = 88,
|
||||
NOSYS = 89,
|
||||
LOOP = 90,
|
||||
RESTART = 91,
|
||||
STRPIPE = 92,
|
||||
NOTEMPTY = 93,
|
||||
USERS = 94,
|
||||
NOTSOCK = 95,
|
||||
DESTADDRREQ = 96,
|
||||
MSGSIZE = 97,
|
||||
PROTOTYPE = 98,
|
||||
NOPROTOOPT = 99,
|
||||
PROTONOSUPPORT = 120,
|
||||
SOCKTNOSUPPORT = 121,
|
||||
OPNOTSUPP = 122,
|
||||
PFNOSUPPORT = 123,
|
||||
AFNOSUPPORT = 124,
|
||||
ADDRINUSE = 125,
|
||||
ADDRNOTAVAIL = 126,
|
||||
NETDOWN = 127,
|
||||
NETUNREACH = 128,
|
||||
NETRESET = 129,
|
||||
CONNABORTED = 130,
|
||||
CONNRESET = 131,
|
||||
NOBUFS = 132,
|
||||
ISCONN = 133,
|
||||
NOTCONN = 134,
|
||||
UCLEAN = 135,
|
||||
NOTNAM = 137,
|
||||
NAVAIL = 138,
|
||||
ISNAM = 139,
|
||||
REMOTEIO = 140,
|
||||
SHUTDOWN = 143,
|
||||
TOOMANYREFS = 144,
|
||||
TIMEDOUT = 145,
|
||||
CONNREFUSED = 146,
|
||||
HOSTDOWN = 147,
|
||||
HOSTUNREACH = 148,
|
||||
ALREADY = 149,
|
||||
INPROGRESS = 150,
|
||||
STALE = 151,
|
||||
CANCELED = 158,
|
||||
NOMEDIUM = 159,
|
||||
MEDIUMTYPE = 160,
|
||||
NOKEY = 161,
|
||||
KEYEXPIRED = 162,
|
||||
KEYREVOKED = 163,
|
||||
KEYREJECTED = 164,
|
||||
OWNERDEAD = 165,
|
||||
NOTRECOVERABLE = 166,
|
||||
RFKILL = 167,
|
||||
HWPOISON = 168,
|
||||
DQUOT = 1133,
|
||||
_,
|
||||
};
|
||||
@@ -1,144 +0,0 @@
|
||||
//! These match the SunOS error numbering scheme.
|
||||
pub const E = enum(i32) {
|
||||
/// No error occurred.
|
||||
SUCCESS = 0,
|
||||
|
||||
PERM = 1,
|
||||
NOENT = 2,
|
||||
SRCH = 3,
|
||||
INTR = 4,
|
||||
IO = 5,
|
||||
NXIO = 6,
|
||||
@"2BIG" = 7,
|
||||
NOEXEC = 8,
|
||||
BADF = 9,
|
||||
CHILD = 10,
|
||||
/// Also used for WOULDBLOCK
|
||||
AGAIN = 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,
|
||||
|
||||
INPROGRESS = 36,
|
||||
ALREADY = 37,
|
||||
NOTSOCK = 38,
|
||||
DESTADDRREQ = 39,
|
||||
MSGSIZE = 40,
|
||||
PROTOTYPE = 41,
|
||||
NOPROTOOPT = 42,
|
||||
PROTONOSUPPORT = 43,
|
||||
SOCKTNOSUPPORT = 44,
|
||||
/// Also used for NOTSUP
|
||||
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,
|
||||
NOSTR = 72,
|
||||
TIME = 73,
|
||||
NOSR = 74,
|
||||
NOMSG = 75,
|
||||
BADMSG = 76,
|
||||
IDRM = 77,
|
||||
DEADLK = 78,
|
||||
NOLCK = 79,
|
||||
NONET = 80,
|
||||
RREMOTE = 81,
|
||||
NOLINK = 82,
|
||||
ADV = 83,
|
||||
SRMNT = 84,
|
||||
COMM = 85,
|
||||
PROTO = 86,
|
||||
MULTIHOP = 87,
|
||||
DOTDOT = 88,
|
||||
REMCHG = 89,
|
||||
NOSYS = 90,
|
||||
STRPIPE = 91,
|
||||
OVERFLOW = 92,
|
||||
BADFD = 93,
|
||||
CHRNG = 94,
|
||||
L2NSYNC = 95,
|
||||
L3HLT = 96,
|
||||
L3RST = 97,
|
||||
LNRNG = 98,
|
||||
UNATCH = 99,
|
||||
NOCSI = 100,
|
||||
L2HLT = 101,
|
||||
BADE = 102,
|
||||
BADR = 103,
|
||||
XFULL = 104,
|
||||
NOANO = 105,
|
||||
BADRQC = 106,
|
||||
BADSLT = 107,
|
||||
DEADLOCK = 108,
|
||||
BFONT = 109,
|
||||
LIBEXEC = 110,
|
||||
NODATA = 111,
|
||||
LIBBAD = 112,
|
||||
NOPKG = 113,
|
||||
LIBACC = 114,
|
||||
NOTUNIQ = 115,
|
||||
RESTART = 116,
|
||||
UCLEAN = 117,
|
||||
NOTNAM = 118,
|
||||
NAVAIL = 119,
|
||||
ISNAM = 120,
|
||||
REMOTEIO = 121,
|
||||
ILSEQ = 122,
|
||||
LIBMAX = 123,
|
||||
LIBSCN = 124,
|
||||
NOMEDIUM = 125,
|
||||
MEDIUMTYPE = 126,
|
||||
CANCELED = 127,
|
||||
NOKEY = 128,
|
||||
KEYEXPIRED = 129,
|
||||
KEYREVOKED = 130,
|
||||
KEYREJECTED = 131,
|
||||
OWNERDEAD = 132,
|
||||
NOTRECOVERABLE = 133,
|
||||
RFKILL = 134,
|
||||
HWPOISON = 135,
|
||||
_,
|
||||
};
|
||||
@@ -448,94 +448,145 @@ pub const SYS = enum(usize) {
|
||||
_,
|
||||
};
|
||||
|
||||
pub const O_CREAT = 0o100;
|
||||
pub const O_EXCL = 0o200;
|
||||
pub const O_NOCTTY = 0o400;
|
||||
pub const O_TRUNC = 0o1000;
|
||||
pub const O_APPEND = 0o2000;
|
||||
pub const O_NONBLOCK = 0o4000;
|
||||
pub const O_DSYNC = 0o10000;
|
||||
pub const O_SYNC = 0o4010000;
|
||||
pub const O_RSYNC = 0o4010000;
|
||||
pub const O_DIRECTORY = 0o200000;
|
||||
pub const O_NOFOLLOW = 0o400000;
|
||||
pub const O_CLOEXEC = 0o2000000;
|
||||
pub const O = struct {
|
||||
pub const RDONLY = 0o0;
|
||||
pub const WRONLY = 0o1;
|
||||
pub const RDWR = 0o2;
|
||||
|
||||
pub const O_ASYNC = 0o20000;
|
||||
pub const O_DIRECT = 0o40000;
|
||||
pub const O_LARGEFILE = 0o100000;
|
||||
pub const O_NOATIME = 0o1000000;
|
||||
pub const O_PATH = 0o10000000;
|
||||
pub const O_TMPFILE = 0o20200000;
|
||||
pub const O_NDELAY = O_NONBLOCK;
|
||||
pub const CREAT = 0o100;
|
||||
pub const EXCL = 0o200;
|
||||
pub const NOCTTY = 0o400;
|
||||
pub const TRUNC = 0o1000;
|
||||
pub const APPEND = 0o2000;
|
||||
pub const NONBLOCK = 0o4000;
|
||||
pub const DSYNC = 0o10000;
|
||||
pub const SYNC = 0o4010000;
|
||||
pub const RSYNC = 0o4010000;
|
||||
pub const DIRECTORY = 0o200000;
|
||||
pub const NOFOLLOW = 0o400000;
|
||||
pub const CLOEXEC = 0o2000000;
|
||||
|
||||
pub const F_DUPFD = 0;
|
||||
pub const F_GETFD = 1;
|
||||
pub const F_SETFD = 2;
|
||||
pub const F_GETFL = 3;
|
||||
pub const F_SETFL = 4;
|
||||
pub const ASYNC = 0o20000;
|
||||
pub const DIRECT = 0o40000;
|
||||
pub const LARGEFILE = 0o100000;
|
||||
pub const NOATIME = 0o1000000;
|
||||
pub const PATH = 0o10000000;
|
||||
pub const TMPFILE = 0o20200000;
|
||||
pub const NDELAY = NONBLOCK;
|
||||
};
|
||||
|
||||
pub const F_SETOWN = 8;
|
||||
pub const F_GETOWN = 9;
|
||||
pub const F_SETSIG = 10;
|
||||
pub const F_GETSIG = 11;
|
||||
pub const F = struct {
|
||||
pub const DUPFD = 0;
|
||||
pub const GETFD = 1;
|
||||
pub const SETFD = 2;
|
||||
pub const GETFL = 3;
|
||||
pub const SETFL = 4;
|
||||
pub const SETOWN = 8;
|
||||
pub const GETOWN = 9;
|
||||
pub const SETSIG = 10;
|
||||
pub const GETSIG = 11;
|
||||
pub const GETLK = 12;
|
||||
pub const SETLK = 13;
|
||||
pub const SETLKW = 14;
|
||||
pub const SETOWN_EX = 15;
|
||||
pub const GETOWN_EX = 16;
|
||||
pub const GETOWNER_UIDS = 17;
|
||||
|
||||
pub const F_GETLK = 12;
|
||||
pub const F_SETLK = 13;
|
||||
pub const F_SETLKW = 14;
|
||||
pub const RDLCK = 0;
|
||||
pub const WRLCK = 1;
|
||||
pub const UNLCK = 2;
|
||||
};
|
||||
|
||||
pub const F_RDLCK = 0;
|
||||
pub const F_WRLCK = 1;
|
||||
pub const F_UNLCK = 2;
|
||||
pub const LOCK = struct {
|
||||
pub const SH = 1;
|
||||
pub const EX = 2;
|
||||
pub const NB = 4;
|
||||
pub const UN = 8;
|
||||
};
|
||||
|
||||
pub const LOCK_SH = 1;
|
||||
pub const LOCK_EX = 2;
|
||||
pub const LOCK_UN = 8;
|
||||
pub const LOCK_NB = 4;
|
||||
pub const MAP = struct {
|
||||
/// Share changes
|
||||
pub const SHARED = 0x01;
|
||||
|
||||
pub const F_SETOWN_EX = 15;
|
||||
pub const F_GETOWN_EX = 16;
|
||||
/// Changes are private
|
||||
pub const PRIVATE = 0x02;
|
||||
|
||||
pub const F_GETOWNER_UIDS = 17;
|
||||
/// share + validate extension flags
|
||||
pub const SHARED_VALIDATE = 0x03;
|
||||
|
||||
pub const MAP_NORESERVE = 0x4000;
|
||||
pub const MAP_GROWSDOWN = 0x0100;
|
||||
pub const MAP_DENYWRITE = 0x0800;
|
||||
pub const MAP_EXECUTABLE = 0x1000;
|
||||
pub const MAP_LOCKED = 0x2000;
|
||||
pub const MAP_32BIT = 0x40;
|
||||
/// Mask for type of mapping
|
||||
pub const TYPE = 0x0f;
|
||||
|
||||
/// Interpret addr exactly
|
||||
pub const FIXED = 0x10;
|
||||
|
||||
/// don't use a file
|
||||
pub const ANONYMOUS = if (is_mips) 0x800 else 0x20;
|
||||
|
||||
/// populate (prefault) pagetables
|
||||
pub const POPULATE = if (is_mips) 0x10000 else 0x8000;
|
||||
|
||||
/// do not block on IO
|
||||
pub const NONBLOCK = if (is_mips) 0x20000 else 0x10000;
|
||||
|
||||
/// give out an address that is best suited for process/thread stacks
|
||||
pub const STACK = if (is_mips) 0x40000 else 0x20000;
|
||||
|
||||
/// create a huge page mapping
|
||||
pub const HUGETLB = if (is_mips) 0x80000 else 0x40000;
|
||||
|
||||
/// perform synchronous page faults for the mapping
|
||||
pub const SYNC = 0x80000;
|
||||
|
||||
/// FIXED which doesn't unmap underlying mapping
|
||||
pub const FIXED_NOREPLACE = 0x100000;
|
||||
|
||||
/// For anonymous mmap, memory could be uninitialized
|
||||
pub const UNINITIALIZED = 0x4000000;
|
||||
|
||||
pub const NORESERVE = 0x4000;
|
||||
pub const GROWSDOWN = 0x0100;
|
||||
pub const DENYWRITE = 0x0800;
|
||||
pub const EXECUTABLE = 0x1000;
|
||||
pub const LOCKED = 0x2000;
|
||||
pub const @"32BIT" = 0x40;
|
||||
};
|
||||
|
||||
pub const MMAP2_UNIT = 4096;
|
||||
|
||||
pub const VDSO_CGT_SYM = "__vdso_clock_gettime";
|
||||
pub const VDSO_CGT_VER = "LINUX_2.6";
|
||||
pub const VDSO = struct {
|
||||
pub const CGT_SYM = "__vdso_clock_gettime";
|
||||
pub const CGT_VER = "LINUX_2.6";
|
||||
};
|
||||
|
||||
pub const ARCH = struct {};
|
||||
|
||||
pub const Flock = extern struct {
|
||||
l_type: i16,
|
||||
l_whence: i16,
|
||||
l_start: off_t,
|
||||
l_len: off_t,
|
||||
l_pid: pid_t,
|
||||
type: i16,
|
||||
whence: i16,
|
||||
start: off_t,
|
||||
len: off_t,
|
||||
pid: pid_t,
|
||||
};
|
||||
|
||||
pub const msghdr = extern struct {
|
||||
msg_name: ?*sockaddr,
|
||||
msg_namelen: socklen_t,
|
||||
msg_iov: [*]iovec,
|
||||
msg_iovlen: i32,
|
||||
msg_control: ?*c_void,
|
||||
msg_controllen: socklen_t,
|
||||
msg_flags: i32,
|
||||
name: ?*sockaddr,
|
||||
namelen: socklen_t,
|
||||
iov: [*]iovec,
|
||||
iovlen: i32,
|
||||
control: ?*c_void,
|
||||
controllen: socklen_t,
|
||||
flags: i32,
|
||||
};
|
||||
|
||||
pub const msghdr_const = extern struct {
|
||||
msg_name: ?*const sockaddr,
|
||||
msg_namelen: socklen_t,
|
||||
msg_iov: [*]iovec_const,
|
||||
msg_iovlen: i32,
|
||||
msg_control: ?*c_void,
|
||||
msg_controllen: socklen_t,
|
||||
msg_flags: i32,
|
||||
name: ?*const sockaddr,
|
||||
namelen: socklen_t,
|
||||
iov: [*]iovec_const,
|
||||
iovlen: i32,
|
||||
control: ?*c_void,
|
||||
controllen: socklen_t,
|
||||
flags: i32,
|
||||
};
|
||||
|
||||
pub const blksize_t = i32;
|
||||
@@ -604,25 +655,27 @@ pub const mcontext_t = extern struct {
|
||||
cr2: usize,
|
||||
};
|
||||
|
||||
pub const REG_GS = 0;
|
||||
pub const REG_FS = 1;
|
||||
pub const REG_ES = 2;
|
||||
pub const REG_DS = 3;
|
||||
pub const REG_EDI = 4;
|
||||
pub const REG_ESI = 5;
|
||||
pub const REG_EBP = 6;
|
||||
pub const REG_ESP = 7;
|
||||
pub const REG_EBX = 8;
|
||||
pub const REG_EDX = 9;
|
||||
pub const REG_ECX = 10;
|
||||
pub const REG_EAX = 11;
|
||||
pub const REG_TRAPNO = 12;
|
||||
pub const REG_ERR = 13;
|
||||
pub const REG_EIP = 14;
|
||||
pub const REG_CS = 15;
|
||||
pub const REG_EFL = 16;
|
||||
pub const REG_UESP = 17;
|
||||
pub const REG_SS = 18;
|
||||
pub const REG = struct {
|
||||
pub const GS = 0;
|
||||
pub const FS = 1;
|
||||
pub const ES = 2;
|
||||
pub const DS = 3;
|
||||
pub const EDI = 4;
|
||||
pub const ESI = 5;
|
||||
pub const EBP = 6;
|
||||
pub const ESP = 7;
|
||||
pub const EBX = 8;
|
||||
pub const EDX = 9;
|
||||
pub const ECX = 10;
|
||||
pub const EAX = 11;
|
||||
pub const TRAPNO = 12;
|
||||
pub const ERR = 13;
|
||||
pub const EIP = 14;
|
||||
pub const CS = 15;
|
||||
pub const EFL = 16;
|
||||
pub const UESP = 17;
|
||||
pub const SS = 18;
|
||||
};
|
||||
|
||||
pub const ucontext_t = extern struct {
|
||||
flags: usize,
|
||||
@@ -647,24 +700,26 @@ pub const user_desc = packed struct {
|
||||
useable: u1,
|
||||
};
|
||||
|
||||
// socketcall() call numbers
|
||||
pub const SC_socket = 1;
|
||||
pub const SC_bind = 2;
|
||||
pub const SC_connect = 3;
|
||||
pub const SC_listen = 4;
|
||||
pub const SC_accept = 5;
|
||||
pub const SC_getsockname = 6;
|
||||
pub const SC_getpeername = 7;
|
||||
pub const SC_socketpair = 8;
|
||||
pub const SC_send = 9;
|
||||
pub const SC_recv = 10;
|
||||
pub const SC_sendto = 11;
|
||||
pub const SC_recvfrom = 12;
|
||||
pub const SC_shutdown = 13;
|
||||
pub const SC_setsockopt = 14;
|
||||
pub const SC_getsockopt = 15;
|
||||
pub const SC_sendmsg = 16;
|
||||
pub const SC_recvmsg = 17;
|
||||
pub const SC_accept4 = 18;
|
||||
pub const SC_recvmmsg = 19;
|
||||
pub const SC_sendmmsg = 20;
|
||||
/// socketcall() call numbers
|
||||
pub const SC = struct {
|
||||
pub const socket = 1;
|
||||
pub const bind = 2;
|
||||
pub const connect = 3;
|
||||
pub const listen = 4;
|
||||
pub const accept = 5;
|
||||
pub const getsockname = 6;
|
||||
pub const getpeername = 7;
|
||||
pub const socketpair = 8;
|
||||
pub const send = 9;
|
||||
pub const recv = 10;
|
||||
pub const sendto = 11;
|
||||
pub const recvfrom = 12;
|
||||
pub const shutdown = 13;
|
||||
pub const setsockopt = 14;
|
||||
pub const getsockopt = 15;
|
||||
pub const sendmsg = 16;
|
||||
pub const recvmsg = 17;
|
||||
pub const accept4 = 18;
|
||||
pub const recvmmsg = 19;
|
||||
pub const sendmmsg = 20;
|
||||
};
|
||||
|
||||
@@ -1,498 +0,0 @@
|
||||
usingnamespace @import("../linux.zig");
|
||||
|
||||
/// Routing/device hook
|
||||
pub const NETLINK_ROUTE = 0;
|
||||
|
||||
/// Unused number
|
||||
pub const NETLINK_UNUSED = 1;
|
||||
|
||||
/// Reserved for user mode socket protocols
|
||||
pub const NETLINK_USERSOCK = 2;
|
||||
|
||||
/// Unused number, formerly ip_queue
|
||||
pub const NETLINK_FIREWALL = 3;
|
||||
|
||||
/// socket monitoring
|
||||
pub const NETLINK_SOCK_DIAG = 4;
|
||||
|
||||
/// netfilter/iptables ULOG
|
||||
pub const NETLINK_NFLOG = 5;
|
||||
|
||||
/// ipsec
|
||||
pub const NETLINK_XFRM = 6;
|
||||
|
||||
/// SELinux event notifications
|
||||
pub const NETLINK_SELINUX = 7;
|
||||
|
||||
/// Open-iSCSI
|
||||
pub const NETLINK_ISCSI = 8;
|
||||
|
||||
/// auditing
|
||||
pub const NETLINK_AUDIT = 9;
|
||||
|
||||
pub const NETLINK_FIB_LOOKUP = 10;
|
||||
|
||||
pub const NETLINK_CONNECTOR = 11;
|
||||
|
||||
/// netfilter subsystem
|
||||
pub const NETLINK_NETFILTER = 12;
|
||||
|
||||
pub const NETLINK_IP6_FW = 13;
|
||||
|
||||
/// DECnet routing messages
|
||||
pub const NETLINK_DNRTMSG = 14;
|
||||
|
||||
/// Kernel messages to userspace
|
||||
pub const NETLINK_KOBJECT_UEVENT = 15;
|
||||
|
||||
pub const NETLINK_GENERIC = 16;
|
||||
|
||||
// leave room for NETLINK_DM (DM Events)
|
||||
|
||||
/// SCSI Transports
|
||||
pub const NETLINK_SCSITRANSPORT = 18;
|
||||
|
||||
pub const NETLINK_ECRYPTFS = 19;
|
||||
|
||||
pub const NETLINK_RDMA = 20;
|
||||
|
||||
/// Crypto layer
|
||||
pub const NETLINK_CRYPTO = 21;
|
||||
|
||||
/// SMC monitoring
|
||||
pub const NETLINK_SMC = 22;
|
||||
|
||||
// Flags values
|
||||
|
||||
/// It is request message.
|
||||
pub const NLM_F_REQUEST = 0x01;
|
||||
|
||||
/// Multipart message, terminated by NLMSG_DONE
|
||||
pub const NLM_F_MULTI = 0x02;
|
||||
|
||||
/// Reply with ack, with zero or error code
|
||||
pub const NLM_F_ACK = 0x04;
|
||||
|
||||
/// Echo this request
|
||||
pub const NLM_F_ECHO = 0x08;
|
||||
|
||||
/// Dump was inconsistent due to sequence change
|
||||
pub const NLM_F_DUMP_INTR = 0x10;
|
||||
|
||||
/// Dump was filtered as requested
|
||||
pub const NLM_F_DUMP_FILTERED = 0x20;
|
||||
|
||||
// Modifiers to GET request
|
||||
|
||||
/// specify tree root
|
||||
pub const NLM_F_ROOT = 0x100;
|
||||
|
||||
/// return all matching
|
||||
pub const NLM_F_MATCH = 0x200;
|
||||
|
||||
/// atomic GET
|
||||
pub const NLM_F_ATOMIC = 0x400;
|
||||
pub const NLM_F_DUMP = NLM_F_ROOT | NLM_F_MATCH;
|
||||
|
||||
// Modifiers to NEW request
|
||||
|
||||
/// Override existing
|
||||
pub const NLM_F_REPLACE = 0x100;
|
||||
|
||||
/// Do not touch, if it exists
|
||||
pub const NLM_F_EXCL = 0x200;
|
||||
|
||||
/// Create, if it does not exist
|
||||
pub const NLM_F_CREATE = 0x400;
|
||||
|
||||
/// Add to end of list
|
||||
pub const NLM_F_APPEND = 0x800;
|
||||
|
||||
// Modifiers to DELETE request
|
||||
|
||||
/// Do not delete recursively
|
||||
pub const NLM_F_NONREC = 0x100;
|
||||
|
||||
// Flags for ACK message
|
||||
|
||||
/// request was capped
|
||||
pub const NLM_F_CAPPED = 0x100;
|
||||
|
||||
/// extended ACK TVLs were included
|
||||
pub const NLM_F_ACK_TLVS = 0x200;
|
||||
|
||||
pub const NetlinkMessageType = enum(u16) {
|
||||
/// < 0x10: reserved control messages
|
||||
pub const MIN_TYPE = 0x10;
|
||||
|
||||
/// Nothing.
|
||||
NOOP = 0x1,
|
||||
|
||||
/// Error
|
||||
ERROR = 0x2,
|
||||
|
||||
/// End of a dump
|
||||
DONE = 0x3,
|
||||
|
||||
/// Data lost
|
||||
OVERRUN = 0x4,
|
||||
|
||||
// rtlink types
|
||||
|
||||
RTM_NEWLINK = 16,
|
||||
RTM_DELLINK,
|
||||
RTM_GETLINK,
|
||||
RTM_SETLINK,
|
||||
|
||||
RTM_NEWADDR = 20,
|
||||
RTM_DELADDR,
|
||||
RTM_GETADDR,
|
||||
|
||||
RTM_NEWROUTE = 24,
|
||||
RTM_DELROUTE,
|
||||
RTM_GETROUTE,
|
||||
|
||||
RTM_NEWNEIGH = 28,
|
||||
RTM_DELNEIGH,
|
||||
RTM_GETNEIGH,
|
||||
|
||||
RTM_NEWRULE = 32,
|
||||
RTM_DELRULE,
|
||||
RTM_GETRULE,
|
||||
|
||||
RTM_NEWQDISC = 36,
|
||||
RTM_DELQDISC,
|
||||
RTM_GETQDISC,
|
||||
|
||||
RTM_NEWTCLASS = 40,
|
||||
RTM_DELTCLASS,
|
||||
RTM_GETTCLASS,
|
||||
|
||||
RTM_NEWTFILTER = 44,
|
||||
RTM_DELTFILTER,
|
||||
RTM_GETTFILTER,
|
||||
|
||||
RTM_NEWACTION = 48,
|
||||
RTM_DELACTION,
|
||||
RTM_GETACTION,
|
||||
|
||||
RTM_NEWPREFIX = 52,
|
||||
|
||||
RTM_GETMULTICAST = 58,
|
||||
|
||||
RTM_GETANYCAST = 62,
|
||||
|
||||
RTM_NEWNEIGHTBL = 64,
|
||||
RTM_GETNEIGHTBL = 66,
|
||||
RTM_SETNEIGHTBL,
|
||||
|
||||
RTM_NEWNDUSEROPT = 68,
|
||||
|
||||
RTM_NEWADDRLABEL = 72,
|
||||
RTM_DELADDRLABEL,
|
||||
RTM_GETADDRLABEL,
|
||||
|
||||
RTM_GETDCB = 78,
|
||||
RTM_SETDCB,
|
||||
|
||||
RTM_NEWNETCONF = 80,
|
||||
RTM_DELNETCONF,
|
||||
RTM_GETNETCONF = 82,
|
||||
|
||||
RTM_NEWMDB = 84,
|
||||
RTM_DELMDB = 85,
|
||||
RTM_GETMDB = 86,
|
||||
|
||||
RTM_NEWNSID = 88,
|
||||
RTM_DELNSID = 89,
|
||||
RTM_GETNSID = 90,
|
||||
|
||||
RTM_NEWSTATS = 92,
|
||||
RTM_GETSTATS = 94,
|
||||
|
||||
RTM_NEWCACHEREPORT = 96,
|
||||
|
||||
RTM_NEWCHAIN = 100,
|
||||
RTM_DELCHAIN,
|
||||
RTM_GETCHAIN,
|
||||
|
||||
RTM_NEWNEXTHOP = 104,
|
||||
RTM_DELNEXTHOP,
|
||||
RTM_GETNEXTHOP,
|
||||
|
||||
_,
|
||||
};
|
||||
|
||||
/// Netlink socket address
|
||||
pub const sockaddr_nl = extern struct {
|
||||
family: sa_family_t = AF_NETLINK,
|
||||
__pad1: c_ushort = 0,
|
||||
|
||||
/// port ID
|
||||
pid: u32,
|
||||
|
||||
/// multicast groups mask
|
||||
groups: u32,
|
||||
};
|
||||
|
||||
/// Netlink message header
|
||||
/// Specified in RFC 3549 Section 2.3.2
|
||||
pub const nlmsghdr = extern struct {
|
||||
/// Length of message including header
|
||||
len: u32,
|
||||
|
||||
/// Message content
|
||||
@"type": NetlinkMessageType,
|
||||
|
||||
/// Additional flags
|
||||
flags: u16,
|
||||
|
||||
/// Sequence number
|
||||
seq: u32,
|
||||
|
||||
/// Sending process port ID
|
||||
pid: u32,
|
||||
};
|
||||
|
||||
pub const ifinfomsg = extern struct {
|
||||
family: u8,
|
||||
__pad1: u8 = 0,
|
||||
|
||||
/// ARPHRD_*
|
||||
@"type": c_ushort,
|
||||
|
||||
/// Link index
|
||||
index: c_int,
|
||||
|
||||
/// IFF_* flags
|
||||
flags: c_uint,
|
||||
|
||||
/// IFF_* change mask
|
||||
change: c_uint,
|
||||
};
|
||||
|
||||
pub const rtattr = extern struct {
|
||||
/// Length of option
|
||||
len: c_ushort,
|
||||
|
||||
/// Type of option
|
||||
@"type": IFLA,
|
||||
|
||||
pub const ALIGNTO = 4;
|
||||
};
|
||||
|
||||
pub const IFLA = enum(c_ushort) {
|
||||
UNSPEC,
|
||||
ADDRESS,
|
||||
BROADCAST,
|
||||
IFNAME,
|
||||
MTU,
|
||||
LINK,
|
||||
QDISC,
|
||||
STATS,
|
||||
COST,
|
||||
PRIORITY,
|
||||
MASTER,
|
||||
|
||||
/// Wireless Extension event
|
||||
WIRELESS,
|
||||
|
||||
/// Protocol specific information for a link
|
||||
PROTINFO,
|
||||
|
||||
TXQLEN,
|
||||
MAP,
|
||||
WEIGHT,
|
||||
OPERSTATE,
|
||||
LINKMODE,
|
||||
LINKINFO,
|
||||
NET_NS_PID,
|
||||
IFALIAS,
|
||||
|
||||
/// Number of VFs if device is SR-IOV PF
|
||||
NUM_VF,
|
||||
|
||||
VFINFO_LIST,
|
||||
STATS64,
|
||||
VF_PORTS,
|
||||
PORT_SELF,
|
||||
AF_SPEC,
|
||||
|
||||
/// Group the device belongs to
|
||||
GROUP,
|
||||
|
||||
NET_NS_FD,
|
||||
|
||||
/// Extended info mask, VFs, etc
|
||||
EXT_MASK,
|
||||
|
||||
/// Promiscuity count: > 0 means acts PROMISC
|
||||
PROMISCUITY,
|
||||
|
||||
NUM_TX_QUEUES,
|
||||
NUM_RX_QUEUES,
|
||||
CARRIER,
|
||||
PHYS_PORT_ID,
|
||||
CARRIER_CHANGES,
|
||||
PHYS_SWITCH_ID,
|
||||
LINK_NETNSID,
|
||||
PHYS_PORT_NAME,
|
||||
PROTO_DOWN,
|
||||
GSO_MAX_SEGS,
|
||||
GSO_MAX_SIZE,
|
||||
PAD,
|
||||
XDP,
|
||||
EVENT,
|
||||
|
||||
NEW_NETNSID,
|
||||
IF_NETNSID,
|
||||
|
||||
CARRIER_UP_COUNT,
|
||||
CARRIER_DOWN_COUNT,
|
||||
NEW_IFINDEX,
|
||||
MIN_MTU,
|
||||
MAX_MTU,
|
||||
|
||||
_,
|
||||
|
||||
pub const TARGET_NETNSID: IFLA = .IF_NETNSID;
|
||||
};
|
||||
|
||||
pub const rtnl_link_ifmap = extern struct {
|
||||
mem_start: u64,
|
||||
mem_end: u64,
|
||||
base_addr: u64,
|
||||
irq: u16,
|
||||
dma: u8,
|
||||
port: u8,
|
||||
};
|
||||
|
||||
pub const rtnl_link_stats = extern struct {
|
||||
/// total packets received
|
||||
rx_packets: u32,
|
||||
|
||||
/// total packets transmitted
|
||||
tx_packets: u32,
|
||||
|
||||
/// total bytes received
|
||||
rx_bytes: u32,
|
||||
|
||||
/// total bytes transmitted
|
||||
tx_bytes: u32,
|
||||
|
||||
/// bad packets received
|
||||
rx_errors: u32,
|
||||
|
||||
/// packet transmit problems
|
||||
tx_errors: u32,
|
||||
|
||||
/// no space in linux buffers
|
||||
rx_dropped: u32,
|
||||
|
||||
/// no space available in linux
|
||||
tx_dropped: u32,
|
||||
|
||||
/// multicast packets received
|
||||
multicast: u32,
|
||||
|
||||
collisions: u32,
|
||||
|
||||
// detailed rx_errors
|
||||
|
||||
rx_length_errors: u32,
|
||||
|
||||
/// receiver ring buff overflow
|
||||
rx_over_errors: u32,
|
||||
|
||||
/// recved pkt with crc error
|
||||
rx_crc_errors: u32,
|
||||
|
||||
/// recv'd frame alignment error
|
||||
rx_frame_errors: u32,
|
||||
|
||||
/// recv'r fifo overrun
|
||||
rx_fifo_errors: u32,
|
||||
|
||||
/// receiver missed packet
|
||||
rx_missed_errors: u32,
|
||||
|
||||
// detailed tx_errors
|
||||
tx_aborted_errors: u32,
|
||||
tx_carrier_errors: u32,
|
||||
tx_fifo_errors: u32,
|
||||
tx_heartbeat_errors: u32,
|
||||
tx_window_errors: u32,
|
||||
|
||||
// for cslip etc
|
||||
|
||||
rx_compressed: u32,
|
||||
tx_compressed: u32,
|
||||
|
||||
/// dropped, no handler found
|
||||
rx_nohandler: u32,
|
||||
};
|
||||
|
||||
pub const rtnl_link_stats64 = extern struct {
|
||||
/// total packets received
|
||||
rx_packets: u64,
|
||||
|
||||
/// total packets transmitted
|
||||
tx_packets: u64,
|
||||
|
||||
/// total bytes received
|
||||
rx_bytes: u64,
|
||||
|
||||
/// total bytes transmitted
|
||||
tx_bytes: u64,
|
||||
|
||||
/// bad packets received
|
||||
rx_errors: u64,
|
||||
|
||||
/// packet transmit problems
|
||||
tx_errors: u64,
|
||||
|
||||
/// no space in linux buffers
|
||||
rx_dropped: u64,
|
||||
|
||||
/// no space available in linux
|
||||
tx_dropped: u64,
|
||||
|
||||
/// multicast packets received
|
||||
multicast: u64,
|
||||
|
||||
collisions: u64,
|
||||
|
||||
// detailed rx_errors
|
||||
|
||||
rx_length_errors: u64,
|
||||
|
||||
/// receiver ring buff overflow
|
||||
rx_over_errors: u64,
|
||||
|
||||
/// recved pkt with crc error
|
||||
rx_crc_errors: u64,
|
||||
|
||||
/// recv'd frame alignment error
|
||||
rx_frame_errors: u64,
|
||||
|
||||
/// recv'r fifo overrun
|
||||
rx_fifo_errors: u64,
|
||||
|
||||
/// receiver missed packet
|
||||
rx_missed_errors: u64,
|
||||
|
||||
// detailed tx_errors
|
||||
tx_aborted_errors: u64,
|
||||
tx_carrier_errors: u64,
|
||||
tx_fifo_errors: u64,
|
||||
tx_heartbeat_errors: u64,
|
||||
tx_window_errors: u64,
|
||||
|
||||
// for cslip etc
|
||||
|
||||
rx_compressed: u64,
|
||||
tx_compressed: u64,
|
||||
|
||||
/// dropped, no handler found
|
||||
rx_nohandler: u64,
|
||||
};
|
||||
@@ -1,234 +0,0 @@
|
||||
pub const PR = enum(i32) {
|
||||
SET_PDEATHSIG = 1,
|
||||
GET_PDEATHSIG = 2,
|
||||
|
||||
GET_DUMPABLE = 3,
|
||||
SET_DUMPABLE = 4,
|
||||
|
||||
GET_UNALIGN = 5,
|
||||
SET_UNALIGN = 6,
|
||||
|
||||
GET_KEEPCAPS = 7,
|
||||
SET_KEEPCAPS = 8,
|
||||
|
||||
GET_FPEMU = 9,
|
||||
SET_FPEMU = 10,
|
||||
|
||||
GET_FPEXC = 11,
|
||||
SET_FPEXC = 12,
|
||||
|
||||
GET_TIMING = 13,
|
||||
SET_TIMING = 14,
|
||||
|
||||
SET_NAME = 15,
|
||||
GET_NAME = 16,
|
||||
|
||||
GET_ENDIAN = 19,
|
||||
SET_ENDIAN = 20,
|
||||
|
||||
GET_SECCOMP = 21,
|
||||
SET_SECCOMP = 22,
|
||||
|
||||
CAPBSET_READ = 23,
|
||||
CAPBSET_DROP = 24,
|
||||
|
||||
GET_TSC = 25,
|
||||
SET_TSC = 26,
|
||||
|
||||
GET_SECUREBITS = 27,
|
||||
SET_SECUREBITS = 28,
|
||||
|
||||
SET_TIMERSLACK = 29,
|
||||
GET_TIMERSLACK = 30,
|
||||
|
||||
TASK_PERF_EVENTS_DISABLE = 31,
|
||||
TASK_PERF_EVENTS_ENABLE = 32,
|
||||
|
||||
MCE_KILL = 33,
|
||||
|
||||
MCE_KILL_GET = 34,
|
||||
|
||||
SET_MM = 35,
|
||||
|
||||
SET_PTRACER = 0x59616d61,
|
||||
|
||||
SET_CHILD_SUBREAPER = 36,
|
||||
GET_CHILD_SUBREAPER = 37,
|
||||
|
||||
SET_NO_NEW_PRIVS = 38,
|
||||
GET_NO_NEW_PRIVS = 39,
|
||||
|
||||
GET_TID_ADDRESS = 40,
|
||||
|
||||
SET_THP_DISABLE = 41,
|
||||
GET_THP_DISABLE = 42,
|
||||
|
||||
MPX_ENABLE_MANAGEMENT = 43,
|
||||
MPX_DISABLE_MANAGEMENT = 44,
|
||||
|
||||
SET_FP_MODE = 45,
|
||||
GET_FP_MODE = 46,
|
||||
|
||||
CAP_AMBIENT = 47,
|
||||
|
||||
SVE_SET_VL = 50,
|
||||
SVE_GET_VL = 51,
|
||||
|
||||
GET_SPECULATION_CTRL = 52,
|
||||
SET_SPECULATION_CTRL = 53,
|
||||
|
||||
_,
|
||||
};
|
||||
|
||||
pub const PR_SET_PDEATHSIG = @enumToInt(PR.SET_PDEATHSIG);
|
||||
pub const PR_GET_PDEATHSIG = @enumToInt(PR.GET_PDEATHSIG);
|
||||
|
||||
pub const PR_GET_DUMPABLE = @enumToInt(PR.GET_DUMPABLE);
|
||||
pub const PR_SET_DUMPABLE = @enumToInt(PR.SET_DUMPABLE);
|
||||
|
||||
pub const PR_GET_UNALIGN = @enumToInt(PR.GET_UNALIGN);
|
||||
pub const PR_SET_UNALIGN = @enumToInt(PR.SET_UNALIGN);
|
||||
pub const PR_UNALIGN_NOPRINT = 1;
|
||||
pub const PR_UNALIGN_SIGBUS = 2;
|
||||
|
||||
pub const PR_GET_KEEPCAPS = @enumToInt(PR.GET_KEEPCAPS);
|
||||
pub const PR_SET_KEEPCAPS = @enumToInt(PR.SET_KEEPCAPS);
|
||||
|
||||
pub const PR_GET_FPEMU = @enumToInt(PR.GET_FPEMU);
|
||||
pub const PR_SET_FPEMU = @enumToInt(PR.SET_FPEMU);
|
||||
pub const PR_FPEMU_NOPRINT = 1;
|
||||
pub const PR_FPEMU_SIGFPE = 2;
|
||||
|
||||
pub const PR_GET_FPEXC = @enumToInt(PR.GET_FPEXC);
|
||||
pub const PR_SET_FPEXC = @enumToInt(PR.SET_FPEXC);
|
||||
pub const PR_FP_EXC_SW_ENABLE = 0x80;
|
||||
pub const PR_FP_EXC_DIV = 0x010000;
|
||||
pub const PR_FP_EXC_OVF = 0x020000;
|
||||
pub const PR_FP_EXC_UND = 0x040000;
|
||||
pub const PR_FP_EXC_RES = 0x080000;
|
||||
pub const PR_FP_EXC_INV = 0x100000;
|
||||
pub const PR_FP_EXC_DISABLED = 0;
|
||||
pub const PR_FP_EXC_NONRECOV = 1;
|
||||
pub const PR_FP_EXC_ASYNC = 2;
|
||||
pub const PR_FP_EXC_PRECISE = 3;
|
||||
|
||||
pub const PR_GET_TIMING = @enumToInt(PR.GET_TIMING);
|
||||
pub const PR_SET_TIMING = @enumToInt(PR.SET_TIMING);
|
||||
pub const PR_TIMING_STATISTICAL = 0;
|
||||
pub const PR_TIMING_TIMESTAMP = 1;
|
||||
|
||||
pub const PR_SET_NAME = @enumToInt(PR.SET_NAME);
|
||||
pub const PR_GET_NAME = @enumToInt(PR.GET_NAME);
|
||||
|
||||
pub const PR_GET_ENDIAN = @enumToInt(PR.GET_ENDIAN);
|
||||
pub const PR_SET_ENDIAN = @enumToInt(PR.SET_ENDIAN);
|
||||
pub const PR_ENDIAN_BIG = 0;
|
||||
pub const PR_ENDIAN_LITTLE = 1;
|
||||
pub const PR_ENDIAN_PPC_LITTLE = 2;
|
||||
|
||||
pub const PR_GET_SECCOMP = @enumToInt(PR.GET_SECCOMP);
|
||||
pub const PR_SET_SECCOMP = @enumToInt(PR.SET_SECCOMP);
|
||||
|
||||
pub const PR_CAPBSET_READ = @enumToInt(PR.CAPBSET_READ);
|
||||
pub const PR_CAPBSET_DROP = @enumToInt(PR.CAPBSET_DROP);
|
||||
|
||||
pub const PR_GET_TSC = @enumToInt(PR.GET_TSC);
|
||||
pub const PR_SET_TSC = @enumToInt(PR.SET_TSC);
|
||||
pub const PR_TSC_ENABLE = 1;
|
||||
pub const PR_TSC_SIGSEGV = 2;
|
||||
|
||||
pub const PR_GET_SECUREBITS = @enumToInt(PR.GET_SECUREBITS);
|
||||
pub const PR_SET_SECUREBITS = @enumToInt(PR.SET_SECUREBITS);
|
||||
|
||||
pub const PR_SET_TIMERSLACK = @enumToInt(PR.SET_TIMERSLACK);
|
||||
pub const PR_GET_TIMERSLACK = @enumToInt(PR.GET_TIMERSLACK);
|
||||
|
||||
pub const PR_TASK_PERF_EVENTS_DISABLE = @enumToInt(PR.TASK_PERF_EVENTS_DISABLE);
|
||||
pub const PR_TASK_PERF_EVENTS_ENABLE = @enumToInt(PR.TASK_PERF_EVENTS_ENABLE);
|
||||
|
||||
pub const PR_MCE_KILL = @enumToInt(PR.MCE_KILL);
|
||||
pub const PR_MCE_KILL_CLEAR = 0;
|
||||
pub const PR_MCE_KILL_SET = 1;
|
||||
|
||||
pub const PR_MCE_KILL_LATE = 0;
|
||||
pub const PR_MCE_KILL_EARLY = 1;
|
||||
pub const PR_MCE_KILL_DEFAULT = 2;
|
||||
|
||||
pub const PR_MCE_KILL_GET = @enumToInt(PR.MCE_KILL_GET);
|
||||
|
||||
pub const PR_SET_MM = @enumToInt(PR.SET_MM);
|
||||
pub const PR_SET_MM_START_CODE = 1;
|
||||
pub const PR_SET_MM_END_CODE = 2;
|
||||
pub const PR_SET_MM_START_DATA = 3;
|
||||
pub const PR_SET_MM_END_DATA = 4;
|
||||
pub const PR_SET_MM_START_STACK = 5;
|
||||
pub const PR_SET_MM_START_BRK = 6;
|
||||
pub const PR_SET_MM_BRK = 7;
|
||||
pub const PR_SET_MM_ARG_START = 8;
|
||||
pub const PR_SET_MM_ARG_END = 9;
|
||||
pub const PR_SET_MM_ENV_START = 10;
|
||||
pub const PR_SET_MM_ENV_END = 11;
|
||||
pub const PR_SET_MM_AUXV = 12;
|
||||
pub const PR_SET_MM_EXE_FILE = 13;
|
||||
pub const PR_SET_MM_MAP = 14;
|
||||
pub const PR_SET_MM_MAP_SIZE = 15;
|
||||
|
||||
pub const prctl_mm_map = extern struct {
|
||||
start_code: u64,
|
||||
end_code: u64,
|
||||
start_data: u64,
|
||||
end_data: u64,
|
||||
start_brk: u64,
|
||||
brk: u64,
|
||||
start_stack: u64,
|
||||
arg_start: u64,
|
||||
arg_end: u64,
|
||||
env_start: u64,
|
||||
env_end: u64,
|
||||
auxv: *u64,
|
||||
auxv_size: u32,
|
||||
exe_fd: u32,
|
||||
};
|
||||
|
||||
pub const PR_SET_PTRACER = @enumToInt(PR.SET_PTRACER);
|
||||
pub const PR_SET_PTRACER_ANY = std.math.maxInt(c_ulong);
|
||||
|
||||
pub const PR_SET_CHILD_SUBREAPER = @enumToInt(PR.SET_CHILD_SUBREAPER);
|
||||
pub const PR_GET_CHILD_SUBREAPER = @enumToInt(PR.GET_CHILD_SUBREAPER);
|
||||
|
||||
pub const PR_SET_NO_NEW_PRIVS = @enumToInt(PR.SET_NO_NEW_PRIVS);
|
||||
pub const PR_GET_NO_NEW_PRIVS = @enumToInt(PR.GET_NO_NEW_PRIVS);
|
||||
|
||||
pub const PR_GET_TID_ADDRESS = @enumToInt(PR.GET_TID_ADDRESS);
|
||||
|
||||
pub const PR_SET_THP_DISABLE = @enumToInt(PR.SET_THP_DISABLE);
|
||||
pub const PR_GET_THP_DISABLE = @enumToInt(PR.GET_THP_DISABLE);
|
||||
|
||||
pub const PR_MPX_ENABLE_MANAGEMENT = @enumToInt(PR.MPX_ENABLE_MANAGEMENT);
|
||||
pub const PR_MPX_DISABLE_MANAGEMENT = @enumToInt(PR.MPX_DISABLE_MANAGEMENT);
|
||||
|
||||
pub const PR_SET_FP_MODE = @enumToInt(PR.SET_FP_MODE);
|
||||
pub const PR_GET_FP_MODE = @enumToInt(PR.GET_FP_MODE);
|
||||
pub const PR_FP_MODE_FR = 1 << 0;
|
||||
pub const PR_FP_MODE_FRE = 1 << 1;
|
||||
|
||||
pub const PR_CAP_AMBIENT = @enumToInt(PR.CAP_AMBIENT);
|
||||
pub const PR_CAP_AMBIENT_IS_SET = 1;
|
||||
pub const PR_CAP_AMBIENT_RAISE = 2;
|
||||
pub const PR_CAP_AMBIENT_LOWER = 3;
|
||||
pub const PR_CAP_AMBIENT_CLEAR_ALL = 4;
|
||||
|
||||
pub const PR_SVE_SET_VL = @enumToInt(PR.SVE_SET_VL);
|
||||
pub const PR_SVE_SET_VL_ONEXEC = 1 << 18;
|
||||
pub const PR_SVE_GET_VL = @enumToInt(PR.SVE_GET_VL);
|
||||
pub const PR_SVE_VL_LEN_MASK = 0xffff;
|
||||
pub const PR_SVE_VL_INHERIT = 1 << 17;
|
||||
|
||||
pub const PR_GET_SPECULATION_CTRL = @enumToInt(PR.GET_SPECULATION_CTRL);
|
||||
pub const PR_SET_SPECULATION_CTRL = @enumToInt(PR.SET_SPECULATION_CTRL);
|
||||
pub const PR_SPEC_STORE_BYPASS = 0;
|
||||
pub const PR_SPEC_NOT_AFFECTED = 0;
|
||||
pub const PR_SPEC_PRCTL = 1 << 0;
|
||||
pub const PR_SPEC_ENABLE = 1 << 1;
|
||||
pub const PR_SPEC_DISABLE = 1 << 2;
|
||||
pub const PR_SPEC_FORCE_DISABLE = 1 << 3;
|
||||
@@ -1,35 +0,0 @@
|
||||
fn issecure_mask(comptime x: comptime_int) comptime_int {
|
||||
return 1 << x;
|
||||
}
|
||||
|
||||
pub const SECUREBITS_DEFAULT = 0x00000000;
|
||||
|
||||
pub const SECURE_NOROOT = 0;
|
||||
pub const SECURE_NOROOT_LOCKED = 1;
|
||||
|
||||
pub const SECBIT_NOROOT = issecure_mask(SECURE_NOROOT);
|
||||
pub const SECBIT_NOROOT_LOCKED = issecure_mask(SECURE_NOROOT_LOCKED);
|
||||
|
||||
pub const SECURE_NO_SETUID_FIXUP = 2;
|
||||
pub const SECURE_NO_SETUID_FIXUP_LOCKED = 3;
|
||||
|
||||
pub const SECBIT_NO_SETUID_FIXUP = issecure_mask(SECURE_NO_SETUID_FIXUP);
|
||||
pub const SECBIT_NO_SETUID_FIXUP_LOCKED = issecure_mask(SECURE_NO_SETUID_FIXUP_LOCKED);
|
||||
|
||||
pub const SECURE_KEEP_CAPS = 4;
|
||||
pub const SECURE_KEEP_CAPS_LOCKED = 5;
|
||||
|
||||
pub const SECBIT_KEEP_CAPS = issecure_mask(SECURE_KEEP_CAPS);
|
||||
pub const SECBIT_KEEP_CAPS_LOCKED = issecure_mask(SECURE_KEEP_CAPS_LOCKED);
|
||||
|
||||
pub const SECURE_NO_CAP_AMBIENT_RAISE = 6;
|
||||
pub const SECURE_NO_CAP_AMBIENT_RAISE_LOCKED = 7;
|
||||
|
||||
pub const SECBIT_NO_CAP_AMBIENT_RAISE = issecure_mask(SECURE_NO_CAP_AMBIENT_RAISE);
|
||||
pub const SECBIT_NO_CAP_AMBIENT_RAISE_LOCKED = issecure_mask(SECURE_NO_CAP_AMBIENT_RAISE_LOCKED);
|
||||
|
||||
pub const SECURE_ALL_BITS = issecure_mask(SECURE_NOROOT) |
|
||||
issecure_mask(SECURE_NO_SETUID_FIXUP) |
|
||||
issecure_mask(SECURE_KEEP_CAPS) |
|
||||
issecure_mask(SECURE_NO_CAP_AMBIENT_RAISE);
|
||||
pub const SECURE_ALL_LOCKS = SECURE_ALL_BITS << 1;
|
||||
@@ -1,638 +0,0 @@
|
||||
// x86-64-specific declarations that are intended to be imported into the POSIX namespace.
|
||||
const std = @import("../../../std.zig");
|
||||
const pid_t = linux.pid_t;
|
||||
const uid_t = linux.uid_t;
|
||||
const gid_t = linux.gid_t;
|
||||
const clock_t = linux.clock_t;
|
||||
const stack_t = linux.stack_t;
|
||||
const sigset_t = linux.sigset_t;
|
||||
|
||||
const linux = std.os.linux;
|
||||
const sockaddr = linux.sockaddr;
|
||||
const socklen_t = linux.socklen_t;
|
||||
const iovec = linux.iovec;
|
||||
const iovec_const = linux.iovec_const;
|
||||
|
||||
pub const mode_t = usize;
|
||||
pub const time_t = isize;
|
||||
|
||||
pub const SYS = enum(usize) {
|
||||
read = 0,
|
||||
write = 1,
|
||||
open = 2,
|
||||
close = 3,
|
||||
stat = 4,
|
||||
fstat = 5,
|
||||
lstat = 6,
|
||||
poll = 7,
|
||||
lseek = 8,
|
||||
mmap = 9,
|
||||
mprotect = 10,
|
||||
munmap = 11,
|
||||
brk = 12,
|
||||
rt_sigaction = 13,
|
||||
rt_sigprocmask = 14,
|
||||
rt_sigreturn = 15,
|
||||
ioctl = 16,
|
||||
pread = 17,
|
||||
pwrite = 18,
|
||||
readv = 19,
|
||||
writev = 20,
|
||||
access = 21,
|
||||
pipe = 22,
|
||||
select = 23,
|
||||
sched_yield = 24,
|
||||
mremap = 25,
|
||||
msync = 26,
|
||||
mincore = 27,
|
||||
madvise = 28,
|
||||
shmget = 29,
|
||||
shmat = 30,
|
||||
shmctl = 31,
|
||||
dup = 32,
|
||||
dup2 = 33,
|
||||
pause = 34,
|
||||
nanosleep = 35,
|
||||
getitimer = 36,
|
||||
alarm = 37,
|
||||
setitimer = 38,
|
||||
getpid = 39,
|
||||
sendfile = 40,
|
||||
socket = 41,
|
||||
connect = 42,
|
||||
accept = 43,
|
||||
sendto = 44,
|
||||
recvfrom = 45,
|
||||
sendmsg = 46,
|
||||
recvmsg = 47,
|
||||
shutdown = 48,
|
||||
bind = 49,
|
||||
listen = 50,
|
||||
getsockname = 51,
|
||||
getpeername = 52,
|
||||
socketpair = 53,
|
||||
setsockopt = 54,
|
||||
getsockopt = 55,
|
||||
clone = 56,
|
||||
fork = 57,
|
||||
vfork = 58,
|
||||
execve = 59,
|
||||
exit = 60,
|
||||
wait4 = 61,
|
||||
kill = 62,
|
||||
uname = 63,
|
||||
semget = 64,
|
||||
semop = 65,
|
||||
semctl = 66,
|
||||
shmdt = 67,
|
||||
msgget = 68,
|
||||
msgsnd = 69,
|
||||
msgrcv = 70,
|
||||
msgctl = 71,
|
||||
fcntl = 72,
|
||||
flock = 73,
|
||||
fsync = 74,
|
||||
fdatasync = 75,
|
||||
truncate = 76,
|
||||
ftruncate = 77,
|
||||
getdents = 78,
|
||||
getcwd = 79,
|
||||
chdir = 80,
|
||||
fchdir = 81,
|
||||
rename = 82,
|
||||
mkdir = 83,
|
||||
rmdir = 84,
|
||||
creat = 85,
|
||||
link = 86,
|
||||
unlink = 87,
|
||||
symlink = 88,
|
||||
readlink = 89,
|
||||
chmod = 90,
|
||||
fchmod = 91,
|
||||
chown = 92,
|
||||
fchown = 93,
|
||||
lchown = 94,
|
||||
umask = 95,
|
||||
gettimeofday = 96,
|
||||
getrlimit = 97,
|
||||
getrusage = 98,
|
||||
sysinfo = 99,
|
||||
times = 100,
|
||||
ptrace = 101,
|
||||
getuid = 102,
|
||||
syslog = 103,
|
||||
getgid = 104,
|
||||
setuid = 105,
|
||||
setgid = 106,
|
||||
geteuid = 107,
|
||||
getegid = 108,
|
||||
setpgid = 109,
|
||||
getppid = 110,
|
||||
getpgrp = 111,
|
||||
setsid = 112,
|
||||
setreuid = 113,
|
||||
setregid = 114,
|
||||
getgroups = 115,
|
||||
setgroups = 116,
|
||||
setresuid = 117,
|
||||
getresuid = 118,
|
||||
setresgid = 119,
|
||||
getresgid = 120,
|
||||
getpgid = 121,
|
||||
setfsuid = 122,
|
||||
setfsgid = 123,
|
||||
getsid = 124,
|
||||
capget = 125,
|
||||
capset = 126,
|
||||
rt_sigpending = 127,
|
||||
rt_sigtimedwait = 128,
|
||||
rt_sigqueueinfo = 129,
|
||||
rt_sigsuspend = 130,
|
||||
sigaltstack = 131,
|
||||
utime = 132,
|
||||
mknod = 133,
|
||||
uselib = 134,
|
||||
personality = 135,
|
||||
ustat = 136,
|
||||
statfs = 137,
|
||||
fstatfs = 138,
|
||||
sysfs = 139,
|
||||
getpriority = 140,
|
||||
setpriority = 141,
|
||||
sched_setparam = 142,
|
||||
sched_getparam = 143,
|
||||
sched_setscheduler = 144,
|
||||
sched_getscheduler = 145,
|
||||
sched_get_priority_max = 146,
|
||||
sched_get_priority_min = 147,
|
||||
sched_rr_get_interval = 148,
|
||||
mlock = 149,
|
||||
munlock = 150,
|
||||
mlockall = 151,
|
||||
munlockall = 152,
|
||||
vhangup = 153,
|
||||
modify_ldt = 154,
|
||||
pivot_root = 155,
|
||||
_sysctl = 156,
|
||||
prctl = 157,
|
||||
arch_prctl = 158,
|
||||
adjtimex = 159,
|
||||
setrlimit = 160,
|
||||
chroot = 161,
|
||||
sync = 162,
|
||||
acct = 163,
|
||||
settimeofday = 164,
|
||||
mount = 165,
|
||||
umount2 = 166,
|
||||
swapon = 167,
|
||||
swapoff = 168,
|
||||
reboot = 169,
|
||||
sethostname = 170,
|
||||
setdomainname = 171,
|
||||
iopl = 172,
|
||||
ioperm = 173,
|
||||
create_module = 174,
|
||||
init_module = 175,
|
||||
delete_module = 176,
|
||||
get_kernel_syms = 177,
|
||||
query_module = 178,
|
||||
quotactl = 179,
|
||||
nfsservctl = 180,
|
||||
getpmsg = 181,
|
||||
putpmsg = 182,
|
||||
afs_syscall = 183,
|
||||
tuxcall = 184,
|
||||
security = 185,
|
||||
gettid = 186,
|
||||
readahead = 187,
|
||||
setxattr = 188,
|
||||
lsetxattr = 189,
|
||||
fsetxattr = 190,
|
||||
getxattr = 191,
|
||||
lgetxattr = 192,
|
||||
fgetxattr = 193,
|
||||
listxattr = 194,
|
||||
llistxattr = 195,
|
||||
flistxattr = 196,
|
||||
removexattr = 197,
|
||||
lremovexattr = 198,
|
||||
fremovexattr = 199,
|
||||
tkill = 200,
|
||||
time = 201,
|
||||
futex = 202,
|
||||
sched_setaffinity = 203,
|
||||
sched_getaffinity = 204,
|
||||
set_thread_area = 205,
|
||||
io_setup = 206,
|
||||
io_destroy = 207,
|
||||
io_getevents = 208,
|
||||
io_submit = 209,
|
||||
io_cancel = 210,
|
||||
get_thread_area = 211,
|
||||
lookup_dcookie = 212,
|
||||
epoll_create = 213,
|
||||
epoll_ctl_old = 214,
|
||||
epoll_wait_old = 215,
|
||||
remap_file_pages = 216,
|
||||
getdents64 = 217,
|
||||
set_tid_address = 218,
|
||||
restart_syscall = 219,
|
||||
semtimedop = 220,
|
||||
fadvise64 = 221,
|
||||
timer_create = 222,
|
||||
timer_settime = 223,
|
||||
timer_gettime = 224,
|
||||
timer_getoverrun = 225,
|
||||
timer_delete = 226,
|
||||
clock_settime = 227,
|
||||
clock_gettime = 228,
|
||||
clock_getres = 229,
|
||||
clock_nanosleep = 230,
|
||||
exit_group = 231,
|
||||
epoll_wait = 232,
|
||||
epoll_ctl = 233,
|
||||
tgkill = 234,
|
||||
utimes = 235,
|
||||
vserver = 236,
|
||||
mbind = 237,
|
||||
set_mempolicy = 238,
|
||||
get_mempolicy = 239,
|
||||
mq_open = 240,
|
||||
mq_unlink = 241,
|
||||
mq_timedsend = 242,
|
||||
mq_timedreceive = 243,
|
||||
mq_notify = 244,
|
||||
mq_getsetattr = 245,
|
||||
kexec_load = 246,
|
||||
waitid = 247,
|
||||
add_key = 248,
|
||||
request_key = 249,
|
||||
keyctl = 250,
|
||||
ioprio_set = 251,
|
||||
ioprio_get = 252,
|
||||
inotify_init = 253,
|
||||
inotify_add_watch = 254,
|
||||
inotify_rm_watch = 255,
|
||||
migrate_pages = 256,
|
||||
openat = 257,
|
||||
mkdirat = 258,
|
||||
mknodat = 259,
|
||||
fchownat = 260,
|
||||
futimesat = 261,
|
||||
fstatat = 262,
|
||||
unlinkat = 263,
|
||||
renameat = 264,
|
||||
linkat = 265,
|
||||
symlinkat = 266,
|
||||
readlinkat = 267,
|
||||
fchmodat = 268,
|
||||
faccessat = 269,
|
||||
pselect6 = 270,
|
||||
ppoll = 271,
|
||||
unshare = 272,
|
||||
set_robust_list = 273,
|
||||
get_robust_list = 274,
|
||||
splice = 275,
|
||||
tee = 276,
|
||||
sync_file_range = 277,
|
||||
vmsplice = 278,
|
||||
move_pages = 279,
|
||||
utimensat = 280,
|
||||
epoll_pwait = 281,
|
||||
signalfd = 282,
|
||||
timerfd_create = 283,
|
||||
eventfd = 284,
|
||||
fallocate = 285,
|
||||
timerfd_settime = 286,
|
||||
timerfd_gettime = 287,
|
||||
accept4 = 288,
|
||||
signalfd4 = 289,
|
||||
eventfd2 = 290,
|
||||
epoll_create1 = 291,
|
||||
dup3 = 292,
|
||||
pipe2 = 293,
|
||||
inotify_init1 = 294,
|
||||
preadv = 295,
|
||||
pwritev = 296,
|
||||
rt_tgsigqueueinfo = 297,
|
||||
perf_event_open = 298,
|
||||
recvmmsg = 299,
|
||||
fanotify_init = 300,
|
||||
fanotify_mark = 301,
|
||||
prlimit64 = 302,
|
||||
name_to_handle_at = 303,
|
||||
open_by_handle_at = 304,
|
||||
clock_adjtime = 305,
|
||||
syncfs = 306,
|
||||
sendmmsg = 307,
|
||||
setns = 308,
|
||||
getcpu = 309,
|
||||
process_vm_readv = 310,
|
||||
process_vm_writev = 311,
|
||||
kcmp = 312,
|
||||
finit_module = 313,
|
||||
sched_setattr = 314,
|
||||
sched_getattr = 315,
|
||||
renameat2 = 316,
|
||||
seccomp = 317,
|
||||
getrandom = 318,
|
||||
memfd_create = 319,
|
||||
kexec_file_load = 320,
|
||||
bpf = 321,
|
||||
execveat = 322,
|
||||
userfaultfd = 323,
|
||||
membarrier = 324,
|
||||
mlock2 = 325,
|
||||
copy_file_range = 326,
|
||||
preadv2 = 327,
|
||||
pwritev2 = 328,
|
||||
pkey_mprotect = 329,
|
||||
pkey_alloc = 330,
|
||||
pkey_free = 331,
|
||||
statx = 332,
|
||||
io_pgetevents = 333,
|
||||
rseq = 334,
|
||||
pidfd_send_signal = 424,
|
||||
io_uring_setup = 425,
|
||||
io_uring_enter = 426,
|
||||
io_uring_register = 427,
|
||||
open_tree = 428,
|
||||
move_mount = 429,
|
||||
fsopen = 430,
|
||||
fsconfig = 431,
|
||||
fsmount = 432,
|
||||
fspick = 433,
|
||||
pidfd_open = 434,
|
||||
clone3 = 435,
|
||||
close_range = 436,
|
||||
openat2 = 437,
|
||||
pidfd_getfd = 438,
|
||||
faccessat2 = 439,
|
||||
process_madvise = 440,
|
||||
epoll_pwait2 = 441,
|
||||
|
||||
_,
|
||||
};
|
||||
|
||||
pub const O_CREAT = 0o100;
|
||||
pub const O_EXCL = 0o200;
|
||||
pub const O_NOCTTY = 0o400;
|
||||
pub const O_TRUNC = 0o1000;
|
||||
pub const O_APPEND = 0o2000;
|
||||
pub const O_NONBLOCK = 0o4000;
|
||||
pub const O_DSYNC = 0o10000;
|
||||
pub const O_SYNC = 0o4010000;
|
||||
pub const O_RSYNC = 0o4010000;
|
||||
pub const O_DIRECTORY = 0o200000;
|
||||
pub const O_NOFOLLOW = 0o400000;
|
||||
pub const O_CLOEXEC = 0o2000000;
|
||||
|
||||
pub const O_ASYNC = 0o20000;
|
||||
pub const O_DIRECT = 0o40000;
|
||||
pub const O_LARGEFILE = 0;
|
||||
pub const O_NOATIME = 0o1000000;
|
||||
pub const O_PATH = 0o10000000;
|
||||
pub const O_TMPFILE = 0o20200000;
|
||||
pub const O_NDELAY = O_NONBLOCK;
|
||||
|
||||
pub const F_DUPFD = 0;
|
||||
pub const F_GETFD = 1;
|
||||
pub const F_SETFD = 2;
|
||||
pub const F_GETFL = 3;
|
||||
pub const F_SETFL = 4;
|
||||
|
||||
pub const F_SETOWN = 8;
|
||||
pub const F_GETOWN = 9;
|
||||
pub const F_SETSIG = 10;
|
||||
pub const F_GETSIG = 11;
|
||||
|
||||
pub const F_GETLK = 5;
|
||||
pub const F_SETLK = 6;
|
||||
pub const F_SETLKW = 7;
|
||||
|
||||
pub const F_SETOWN_EX = 15;
|
||||
pub const F_GETOWN_EX = 16;
|
||||
|
||||
pub const F_GETOWNER_UIDS = 17;
|
||||
|
||||
/// only give out 32bit addresses
|
||||
pub const MAP_32BIT = 0x40;
|
||||
|
||||
/// stack-like segment
|
||||
pub const MAP_GROWSDOWN = 0x0100;
|
||||
|
||||
/// ETXTBSY
|
||||
pub const MAP_DENYWRITE = 0x0800;
|
||||
|
||||
/// mark it as an executable
|
||||
pub const MAP_EXECUTABLE = 0x1000;
|
||||
|
||||
/// pages are locked
|
||||
pub const MAP_LOCKED = 0x2000;
|
||||
|
||||
/// don't check for reservations
|
||||
pub const MAP_NORESERVE = 0x4000;
|
||||
|
||||
pub const VDSO_CGT_SYM = "__vdso_clock_gettime";
|
||||
pub const VDSO_CGT_VER = "LINUX_2.6";
|
||||
pub const VDSO_GETCPU_SYM = "__vdso_getcpu";
|
||||
pub const VDSO_GETCPU_VER = "LINUX_2.6";
|
||||
|
||||
pub const ARCH_SET_GS = 0x1001;
|
||||
pub const ARCH_SET_FS = 0x1002;
|
||||
pub const ARCH_GET_FS = 0x1003;
|
||||
pub const ARCH_GET_GS = 0x1004;
|
||||
|
||||
pub const REG_R8 = 0;
|
||||
pub const REG_R9 = 1;
|
||||
pub const REG_R10 = 2;
|
||||
pub const REG_R11 = 3;
|
||||
pub const REG_R12 = 4;
|
||||
pub const REG_R13 = 5;
|
||||
pub const REG_R14 = 6;
|
||||
pub const REG_R15 = 7;
|
||||
pub const REG_RDI = 8;
|
||||
pub const REG_RSI = 9;
|
||||
pub const REG_RBP = 10;
|
||||
pub const REG_RBX = 11;
|
||||
pub const REG_RDX = 12;
|
||||
pub const REG_RAX = 13;
|
||||
pub const REG_RCX = 14;
|
||||
pub const REG_RSP = 15;
|
||||
pub const REG_RIP = 16;
|
||||
pub const REG_EFL = 17;
|
||||
pub const REG_CSGSFS = 18;
|
||||
pub const REG_ERR = 19;
|
||||
pub const REG_TRAPNO = 20;
|
||||
pub const REG_OLDMASK = 21;
|
||||
pub const REG_CR2 = 22;
|
||||
|
||||
pub const LOCK_SH = 1;
|
||||
pub const LOCK_EX = 2;
|
||||
pub const LOCK_UN = 8;
|
||||
pub const LOCK_NB = 4;
|
||||
|
||||
pub const F_RDLCK = 0;
|
||||
pub const F_WRLCK = 1;
|
||||
pub const F_UNLCK = 2;
|
||||
|
||||
pub const Flock = extern struct {
|
||||
l_type: i16,
|
||||
l_whence: i16,
|
||||
l_start: off_t,
|
||||
l_len: off_t,
|
||||
l_pid: pid_t,
|
||||
};
|
||||
|
||||
pub const msghdr = extern struct {
|
||||
msg_name: ?*sockaddr,
|
||||
msg_namelen: socklen_t,
|
||||
msg_iov: [*]iovec,
|
||||
msg_iovlen: i32,
|
||||
__pad1: i32 = 0,
|
||||
msg_control: ?*c_void,
|
||||
msg_controllen: socklen_t,
|
||||
__pad2: socklen_t = 0,
|
||||
msg_flags: i32,
|
||||
};
|
||||
|
||||
pub const msghdr_const = extern struct {
|
||||
msg_name: ?*const sockaddr,
|
||||
msg_namelen: socklen_t,
|
||||
msg_iov: [*]iovec_const,
|
||||
msg_iovlen: i32,
|
||||
__pad1: i32 = 0,
|
||||
msg_control: ?*c_void,
|
||||
msg_controllen: socklen_t,
|
||||
__pad2: socklen_t = 0,
|
||||
msg_flags: i32,
|
||||
};
|
||||
|
||||
pub const off_t = i64;
|
||||
pub const ino_t = u64;
|
||||
pub const dev_t = u64;
|
||||
|
||||
// The `stat` definition used by the Linux kernel.
|
||||
pub const kernel_stat = extern struct {
|
||||
dev: dev_t,
|
||||
ino: ino_t,
|
||||
nlink: usize,
|
||||
|
||||
mode: u32,
|
||||
uid: uid_t,
|
||||
gid: gid_t,
|
||||
__pad0: u32,
|
||||
rdev: dev_t,
|
||||
size: off_t,
|
||||
blksize: isize,
|
||||
blocks: i64,
|
||||
|
||||
atim: timespec,
|
||||
mtim: timespec,
|
||||
ctim: timespec,
|
||||
__unused: [3]isize,
|
||||
|
||||
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;
|
||||
}
|
||||
};
|
||||
|
||||
// The `stat64` definition used by the libc.
|
||||
pub const libc_stat = kernel_stat;
|
||||
|
||||
pub const timespec = extern struct {
|
||||
tv_sec: isize,
|
||||
tv_nsec: isize,
|
||||
};
|
||||
|
||||
pub const timeval = extern struct {
|
||||
tv_sec: isize,
|
||||
tv_usec: isize,
|
||||
};
|
||||
|
||||
pub const timezone = extern struct {
|
||||
tz_minuteswest: i32,
|
||||
tz_dsttime: i32,
|
||||
};
|
||||
|
||||
pub const Elf_Symndx = u32;
|
||||
|
||||
pub const greg_t = usize;
|
||||
pub const gregset_t = [23]greg_t;
|
||||
pub const fpstate = extern struct {
|
||||
cwd: u16,
|
||||
swd: u16,
|
||||
ftw: u16,
|
||||
fop: u16,
|
||||
rip: usize,
|
||||
rdp: usize,
|
||||
mxcsr: u32,
|
||||
mxcr_mask: u32,
|
||||
st: [8]extern struct {
|
||||
significand: [4]u16,
|
||||
exponent: u16,
|
||||
padding: [3]u16 = undefined,
|
||||
},
|
||||
xmm: [16]extern struct {
|
||||
element: [4]u32,
|
||||
},
|
||||
padding: [24]u32 = undefined,
|
||||
};
|
||||
pub const fpregset_t = *fpstate;
|
||||
pub const sigcontext = extern struct {
|
||||
r8: usize,
|
||||
r9: usize,
|
||||
r10: usize,
|
||||
r11: usize,
|
||||
r12: usize,
|
||||
r13: usize,
|
||||
r14: usize,
|
||||
r15: usize,
|
||||
|
||||
rdi: usize,
|
||||
rsi: usize,
|
||||
rbp: usize,
|
||||
rbx: usize,
|
||||
rdx: usize,
|
||||
rax: usize,
|
||||
rcx: usize,
|
||||
rsp: usize,
|
||||
rip: usize,
|
||||
eflags: usize,
|
||||
|
||||
cs: u16,
|
||||
gs: u16,
|
||||
fs: u16,
|
||||
pad0: u16 = undefined,
|
||||
|
||||
err: usize,
|
||||
trapno: usize,
|
||||
oldmask: usize,
|
||||
cr2: usize,
|
||||
|
||||
fpstate: *fpstate,
|
||||
reserved1: [8]usize = undefined,
|
||||
};
|
||||
|
||||
pub const mcontext_t = extern struct {
|
||||
gregs: gregset_t,
|
||||
fpregs: fpregset_t,
|
||||
reserved1: [8]usize = undefined,
|
||||
};
|
||||
|
||||
pub const ucontext_t = extern struct {
|
||||
flags: usize,
|
||||
link: *ucontext_t,
|
||||
stack: stack_t,
|
||||
mcontext: mcontext_t,
|
||||
sigmask: sigset_t,
|
||||
fpregs_mem: [64]usize,
|
||||
};
|
||||
@@ -1,77 +0,0 @@
|
||||
usingnamespace @import("../linux.zig");
|
||||
|
||||
pub const XDP_SHARED_UMEM = (1 << 0);
|
||||
pub const XDP_COPY = (1 << 1);
|
||||
pub const XDP_ZEROCOPY = (1 << 2);
|
||||
|
||||
pub const XDP_UMEM_UNALIGNED_CHUNK_FLAG = (1 << 0);
|
||||
|
||||
pub const sockaddr_xdp = extern struct {
|
||||
family: u16 = AF_XDP,
|
||||
flags: u16,
|
||||
ifindex: u32,
|
||||
queue_id: u32,
|
||||
shared_umem_fd: u32,
|
||||
};
|
||||
|
||||
pub const XDP_USE_NEED_WAKEUP = (1 << 3);
|
||||
|
||||
pub const xdp_ring_offset = extern struct {
|
||||
producer: u64,
|
||||
consumer: u64,
|
||||
desc: u64,
|
||||
flags: u64,
|
||||
};
|
||||
|
||||
pub const xdp_mmap_offsets = extern struct {
|
||||
rx: xdp_ring_offset,
|
||||
tx: xdp_ring_offset,
|
||||
fr: xdp_ring_offset,
|
||||
cr: xdp_ring_offset,
|
||||
};
|
||||
|
||||
pub const XDP_MMAP_OFFSETS = 1;
|
||||
pub const XDP_RX_RING = 2;
|
||||
pub const XDP_TX_RING = 3;
|
||||
pub const XDP_UMEM_REG = 4;
|
||||
pub const XDP_UMEM_FILL_RING = 5;
|
||||
pub const XDP_UMEM_COMPLETION_RING = 6;
|
||||
pub const XDP_STATISTICS = 7;
|
||||
pub const XDP_OPTIONS = 8;
|
||||
|
||||
pub const xdp_umem_reg = extern struct {
|
||||
addr: u64,
|
||||
len: u64,
|
||||
chunk_size: u32,
|
||||
headroom: u32,
|
||||
flags: u32,
|
||||
};
|
||||
|
||||
pub const xdp_statistics = extern struct {
|
||||
rx_dropped: u64,
|
||||
rx_invalid_descs: u64,
|
||||
tx_invalid_descs: u64,
|
||||
rx_ring_full: u64,
|
||||
rx_fill_ring_empty_descs: u64,
|
||||
tx_ring_empty_descs: u64,
|
||||
};
|
||||
|
||||
pub const xdp_options = extern struct {
|
||||
flags: u32,
|
||||
};
|
||||
|
||||
pub const XDP_OPTIONS_ZEROCOPY = (1 << 0);
|
||||
|
||||
pub const XDP_PGOFF_RX_RING = 0;
|
||||
pub const XDP_PGOFF_TX_RING = 0x80000000;
|
||||
pub const XDP_UMEM_PGOFF_FILL_RING = 0x100000000;
|
||||
pub const XDP_UMEM_PGOFF_COMPLETION_RING = 0x180000000;
|
||||
|
||||
pub const XSK_UNALIGNED_BUF_OFFSET_SHIFT = 48;
|
||||
pub const XSK_UNALIGNED_BUF_ADDR_MASK = (1 << XSK_UNALIGNED_BUF_OFFSET_SHIFT) - 1;
|
||||
|
||||
pub const xdp_desc = extern struct {
|
||||
addr: u64,
|
||||
len: u32,
|
||||
options: u32,
|
||||
};
|
||||
Reference in New Issue
Block a user