authorgravatar for dev@sgregoratto.meStephen Gregoratto <dev@sgregoratto.me> 2026-02-20 12:15:40+11:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2026-05-23 06:15:24+02:00
loge1fc46fb6d24e34c77481845bd1ae3608061fc8c
tree487e680db775cb5aa4df03e4c3e1ef8db2c727e3
parenta9b7df4ca238bbf773a08c4c2c29ec15a4bc79bb
signaturebadge-check Signed by SSH key SHA256:7B/LJ7bpR1eX8aCXSr4mtd5M45VMPKcx9zY8e95b5QM

Linux: Add proper constants for Alpha


2 files changed, 589 insertions(+), 30 deletions(-)

lib/std/os/linux.zig+588-30
......@@ -18,6 +18,7 @@ const is_mips = native_arch.isMIPS();
1818const is_ppc = native_arch.isPowerPC();
1919const is_riscv = native_arch.isRISCV();
2020const is_sparc = native_arch.isSPARC();
21const is_hppa = native_arch.isHppa();
2122const iovec = std.posix.iovec;
2223const iovec_const = std.posix.iovec_const;
2324const winsize = std.posix.winsize;
......@@ -1943,23 +1944,68 @@ pub const F = struct {
19431944 pub const SETLK = GET_SET_LK.SETLK;
19441945 pub const SETLKW = GET_SET_LK.SETLKW;
19451946
1946 const GET_SET_LK = if (@sizeOf(usize) == 64) extern struct {
1947 pub const GETLK = if (is_mips) 14 else if (is_sparc) 7 else 5;
1948 pub const SETLK = if (is_mips) 6 else if (is_sparc) 8 else 6;
1949 pub const SETLKW = if (is_mips) 7 else if (is_sparc) 9 else 7;
1950 } else extern struct {
1951 // Ensure that 32-bit code uses the large-file variants (GETLK64, etc).
1947 pub const SETOWN = GET_SET_OWN.SETOWN;
1948 pub const GETOWN = GET_SET_OWN.GETOWN;
19521949
1953 pub const GETLK = if (is_mips) 33 else 12;
1954 pub const SETLK = if (is_mips) 34 else 13;
1955 pub const SETLKW = if (is_mips) 35 else 14;
1950 const GET_SET_LK = switch (native_arch) {
1951 .mips, .mipsel => struct {
1952 const GETLK = 33;
1953 const SETLK = 34;
1954 const SETLKW = 35;
1955 },
1956 .mips64, .mips64el => switch (native_abi) {
1957 .gnuabin32, .muslabin32 => struct {
1958 const GETLK = 33;
1959 const SETLK = 34;
1960 const SETLKW = 35;
1961 },
1962 else => struct {
1963 const GETLK = 14;
1964 const SETLK = 6;
1965 const SETLKW = 7;
1966 },
1967 },
1968 .alpha, .sparc64 => struct {
1969 const GETLK = 7;
1970 const SETLK = 8;
1971 const SETLKW = 9;
1972 },
1973 .hppa, .hppa64 => struct {
1974 const GETLK = 8;
1975 const SETLK = 9;
1976 const SETLKW = 10;
1977 },
1978 else => if (@sizeOf(usize) == 8) struct {
1979 const GETLK = 5;
1980 const SETLK = 6;
1981 const SETLKW = 7;
1982 } else struct {
1983 const GETLK = 12;
1984 const SETLK = 13;
1985 const SETLKW = 14;
1986 },
1987 };
1988 const GET_SET_OWN = switch (native_arch) {
1989 .mips, .mipsel, .mips64, .mips64el => struct {
1990 const GETOWN = 23;
1991 const SETOWN = 24;
1992 },
1993 .alpha, .sparc, .sparc64 => struct {
1994 const GETOWN = 5;
1995 const SETOWN = 6;
1996 },
1997 .hppa, .hppa64 => struct {
1998 const GETOWN = 11;
1999 const SETOWN = 12;
2000 },
2001 else => struct {
2002 const GETOWN = 8;
2003 const SETOWN = 9;
2004 },
19562005 };
19572006
1958 pub const SETOWN = if (is_mips) 24 else if (is_sparc) 6 else 8;
1959 pub const GETOWN = if (is_mips) 23 else if (is_sparc) 5 else 9;
1960
1961 pub const SETSIG = 10;
1962 pub const GETSIG = 11;
2007 pub const SETSIG = if (is_hppa or native_arch == .alpha) 13 else 11;
2008 pub const GETSIG = if (is_hppa or native_arch == .alpha) 14 else 12;
19632009
19642010 pub const SETOWN_EX = 15;
19652011 pub const GETOWN_EX = 16;
......@@ -1972,7 +2018,7 @@ pub const F = struct {
19722018
19732019 pub const RDLCK = if (is_sparc) 1 else 0;
19742020 pub const WRLCK = if (is_sparc) 2 else 1;
1975 pub const UNLCK = if (is_sparc) 3 else 2;
2021 pub const UNLCK = if (is_sparc) 3 else if (native_arch == .alpha) 8 else 2;
19762022
19772023 pub const LINUX_SPECIFIC_BASE = 1024;
19782024
......@@ -3437,6 +3483,294 @@ pub const E = switch (native_arch) {
34373483 HWPOISON = 135,
34383484 _,
34393485 },
3486 .alpha => enum(u16) {
3487 /// No error occurred.
3488 SUCCESS = 0,
3489
3490 /// Operation not permitted
3491 PERM = 1,
3492 /// No such file or directory
3493 NOENT = 2,
3494 /// No such process
3495 SRCH = 3,
3496 /// Interrupted system call
3497 INTR = 4,
3498 /// I/O error
3499 IO = 5,
3500 /// No such device or address
3501 NXIO = 6,
3502 /// Argument list too long
3503 @"2BIG" = 7,
3504 /// Exec format error
3505 NOEXEC = 8,
3506 /// Bad file number
3507 BADF = 9,
3508 /// No child processes
3509 CHILD = 10,
3510 /// Out of memory
3511 NOMEM = 12,
3512 /// Permission denied
3513 ACCES = 13,
3514 /// Bad address
3515 FAULT = 14,
3516 /// Block device required
3517 NOTBLK = 15,
3518 /// Device or resource busy
3519 BUSY = 16,
3520 /// File exists
3521 EXIST = 17,
3522 /// Cross-device link
3523 XDEV = 18,
3524 /// No such device
3525 NODEV = 19,
3526 /// Not a directory
3527 NOTDIR = 20,
3528 /// Is a directory
3529 ISDIR = 21,
3530 /// Invalid argument
3531 INVAL = 22,
3532 /// File table overflow
3533 NFILE = 23,
3534 /// Too many open files
3535 MFILE = 24,
3536 /// Not a typewriter
3537 NOTTY = 25,
3538 /// Text file busy
3539 TXTBSY = 26,
3540 /// File too large
3541 FBIG = 27,
3542 /// No space left on device
3543 NOSPC = 28,
3544 /// Illegal seek
3545 SPIPE = 29,
3546 /// Read-only file system
3547 ROFS = 30,
3548 /// Too many links
3549 MLINK = 31,
3550 /// Broken pipe
3551 PIPE = 32,
3552 /// Math argument out of domain of func
3553 DOM = 33,
3554 /// Math result not representable
3555 RANGE = 34,
3556
3557 /// Resource deadlock would occur
3558 DEADLK = 11,
3559
3560 /// Try again.
3561 /// Also used for WOULDBLOCK.
3562 AGAIN = 35,
3563 /// Operation now in progress
3564 INPROGRESS = 36,
3565 /// Operation already in progress
3566 ALREADY = 37,
3567 /// Socket operation on non-socket
3568 NOTSOCK = 38,
3569 /// Destination address required
3570 DESTADDRREQ = 39,
3571 /// Message too long
3572 MSGSIZE = 40,
3573 /// Protocol wrong type for socket
3574 PROTOTYPE = 41,
3575 /// Protocol not available
3576 NOPROTOOPT = 42,
3577 /// Protocol not supported
3578 PROTONOSUPPORT = 43,
3579 /// Socket type not supported
3580 SOCKTNOSUPPORT = 44,
3581 /// Operation not supported on transport endpoint
3582 OPNOTSUPP = 45,
3583 /// Protocol family not supported
3584 PFNOSUPPORT = 46,
3585 /// Address family not supported by protocol
3586 AFNOSUPPORT = 47,
3587 /// Address already in use
3588 ADDRINUSE = 48,
3589 /// Cannot assign requested address
3590 ADDRNOTAVAIL = 49,
3591 /// Network is down
3592 NETDOWN = 50,
3593 /// Network is unreachable
3594 NETUNREACH = 51,
3595 /// Network dropped connection because of reset
3596 NETRESET = 52,
3597 /// Software caused connection abort
3598 CONNABORTED = 53,
3599 /// Connection reset by peer
3600 CONNRESET = 54,
3601 /// No buffer space available
3602 NOBUFS = 55,
3603 /// Transport endpoint is already connected
3604 ISCONN = 56,
3605 /// Transport endpoint is not connected
3606 NOTCONN = 57,
3607 /// Cannot send after transport endpoint shutdown
3608 SHUTDOWN = 58,
3609 /// Too many references: cannot splice
3610 TOOMANYREFS = 59,
3611 /// Connection timed out
3612 TIMEDOUT = 60,
3613 /// Connection refused
3614 CONNREFUSED = 61,
3615 /// Too many symbolic links encountered
3616 LOOP = 62,
3617 /// File name too long
3618 NAMETOOLONG = 63,
3619 /// Host is down
3620 HOSTDOWN = 64,
3621 /// No route to host
3622 HOSTUNREACH = 65,
3623 /// Directory not empty
3624 NOTEMPTY = 66,
3625
3626 /// Too many users
3627 USERS = 68,
3628 /// Quota exceeded
3629 DQUOT = 69,
3630 /// Stale file handle
3631 STALE = 70,
3632 /// Object is remote
3633 REMOTE = 71,
3634
3635 /// No record locks available
3636 NOLCK = 77,
3637 /// Function not implemented
3638 NOSYS = 78,
3639
3640 /// No message of desired type
3641 NOMSG = 80,
3642 /// Identifier removed
3643 IDRM = 81,
3644 /// Out of streams resources
3645 NOSR = 82,
3646 /// Timer expired
3647 TIME = 83,
3648 /// Not a data message
3649 /// Also used for FSBADCRC.
3650 BADMSG = 84,
3651 /// Protocol error
3652 PROTO = 85,
3653 /// No data available
3654 NODATA = 86,
3655 /// Device not a stream
3656 NOSTR = 87,
3657
3658 /// Package not installed
3659 NOPKG = 92,
3660
3661 /// Illegal byte sequence
3662 ILSEQ = 116,
3663
3664 // The following are designated "random noise" by the kernel sources.
3665 /// Channel number out of range
3666 CHRNG = 88,
3667 /// Level 2 not synchronized
3668 L2NSYNC = 89,
3669 /// Level 3 halted
3670 L3HLT = 90,
3671 /// Level 3 reset
3672 L3RST = 91,
3673
3674 /// Link number out of range
3675 LNRNG = 93,
3676 /// Protocol driver not attached
3677 UNATCH = 94,
3678 /// No CSI structure available
3679 NOCSI = 95,
3680 /// Level 2 halted
3681 L2HLT = 96,
3682 /// Invalid exchange
3683 BADE = 97,
3684 /// Invalid request descriptor
3685 BADR = 98,
3686 /// Exchange full
3687 XFULL = 99,
3688 /// No anode
3689 NOANO = 100,
3690 /// Invalid request code
3691 BADRQC = 101,
3692 /// Invalid slot
3693 BADSLT = 102,
3694
3695 /// Bad font file format
3696 BFONT = 104,
3697 /// Machine is not on the network
3698 NONET = 105,
3699 /// Link has been severed
3700 NOLINK = 106,
3701 /// Advertise error
3702 ADV = 107,
3703 /// Srmount error
3704 SRMNT = 108,
3705 /// Communication error on send
3706 COMM = 109,
3707 /// Multihop attempted
3708 MULTIHOP = 110,
3709 /// RFS specific error
3710 DOTDOT = 111,
3711 /// Value too large for defined data type
3712 OVERFLOW = 112,
3713 /// Name not unique on network
3714 NOTUNIQ = 113,
3715 /// File descriptor in bad state
3716 BADFD = 114,
3717 /// Remote address changed
3718 REMCHG = 115,
3719
3720 /// Structure needs cleaning
3721 /// Also used for FSCORRUPTED.
3722 UCLEAN = 117,
3723 /// Not a XENIX named type file
3724 NOTNAM = 118,
3725 /// No XENIX semaphores available
3726 NAVAIL = 119,
3727 /// Is a named type file
3728 ISNAM = 120,
3729 /// Remote I/O error
3730 REMOTEIO = 121,
3731
3732 /// Can not access a needed shared library
3733 LIBACC = 122,
3734 /// Accessing a corrupted shared library
3735 LIBBAD = 123,
3736 /// .lib section in a.out corrupted
3737 LIBSCN = 124,
3738 /// Attempting to link in too many shared libraries
3739 LIBMAX = 125,
3740 /// Cannot exec a shared library directly
3741 LIBEXEC = 126,
3742 /// Interrupted system call should be restarted
3743 RESTART = 127,
3744 /// Streams pipe error
3745 STRPIPE = 128,
3746
3747 /// No medium found
3748 NOMEDIUM = 129,
3749 /// Wrong medium type
3750 MEDIUMTYPE = 130,
3751 /// Operation Cancelled
3752 CANCELED = 131,
3753 /// Required key not available
3754 NOKEY = 132,
3755 /// Key has expired
3756 KEYEXPIRED = 133,
3757 /// Key has been revoked
3758 KEYREVOKED = 134,
3759 /// Key was rejected by service
3760 KEYREJECTED = 135,
3761
3762 // For robust mutexes
3763 /// Owner died
3764 OWNERDEAD = 136,
3765 /// State not recoverable
3766 NOTRECOVERABLE = 137,
3767
3768 /// Operation not possible due to RF-kill
3769 RFKILL = 138,
3770 /// Memory page has hardware error
3771 HWPOISON = 139,
3772 _,
3773 },
34403774 else => enum(u16) {
34413775 /// No error occurred.
34423776 /// Same code used for `NSROK`.
......@@ -4008,6 +4342,14 @@ pub const SA = if (is_mips) struct {
40084342 pub const RESETHAND = 0x80000000;
40094343 pub const ONSTACK = 0x08000000;
40104344 pub const NODEFER = 0x40000000;
4345} else if (native_arch == .alpha) struct {
4346 pub const ONSTACK = 0x00000001;
4347 pub const RESTART = 0x00000002;
4348 pub const NOCLDSTOP = 0x00000004;
4349 pub const NODEFER = 0x00000008;
4350 pub const RESETHAND = 0x00000010;
4351 pub const NOCLDWAIT = 0x00000020;
4352 pub const SIGINFO = 0x00000040;
40114353} else struct {
40124354 pub const NOCLDSTOP = 1;
40134355 pub const NOCLDWAIT = 2;
......@@ -4155,6 +4497,50 @@ pub const SIG = if (is_mips) enum(u32) {
41554497 USR1 = 30,
41564498 USR2 = 31,
41574499 _,
4500} else if (is_hppa) enum(u32) {
4501 pub const BLOCK = 0;
4502 pub const UNBLOCK = 1;
4503 pub const SETMASK = 2;
4504
4505 pub const ERR: ?Sigaction.handler_fn = @ptrFromInt(maxInt(usize));
4506 pub const DFL: ?Sigaction.handler_fn = @ptrFromInt(0);
4507 pub const IGN: ?Sigaction.handler_fn = @ptrFromInt(1);
4508
4509 pub const POLL: SIG = .IO;
4510 pub const IOT: SIG = .ABRT;
4511
4512 HUP = 1,
4513 INT = 2,
4514 QUIT = 3,
4515 ILL = 4,
4516 TRAP = 5,
4517 ABRT = 6,
4518 STKFLT = 7,
4519 FPE = 8,
4520 KILL = 9,
4521 BUS = 10,
4522 SEGV = 11,
4523 XCPU = 12,
4524 PIPE = 13,
4525 ALRM = 14,
4526 TERM = 15,
4527 USR1 = 16,
4528 USR2 = 17,
4529 CHLD = 18,
4530 PWR = 19,
4531 VTALRM = 20,
4532 PROF = 21,
4533 IO = 22,
4534 WINCH = 23,
4535 STOP = 24,
4536 TSTP = 25,
4537 CONT = 26,
4538 TTIN = 27,
4539 TTOU = 28,
4540 URG = 29,
4541 XFSZ = 30,
4542 SYS = 31,
4543 _,
41584544} else enum(u32) {
41594545 pub const BLOCK = 0;
41604546 pub const UNBLOCK = 1;
......@@ -4231,8 +4617,20 @@ pub const SOCK = struct {
42314617 pub const SEQPACKET = 5;
42324618 pub const DCCP = 6;
42334619 pub const PACKET = 10;
4234 pub const CLOEXEC = if (is_sparc) 0o20000000 else 0o2000000;
4235 pub const NONBLOCK = if (is_mips) 0o200 else if (is_sparc) 0o40000 else 0o4000;
4620 pub const CLOEXEC = if (is_sparc)
4621 0o20000000
4622 else if (native_arch == .alpha)
4623 0o10000000
4624 else
4625 0o2000000;
4626 pub const NONBLOCK = if (is_mips)
4627 0o200
4628 else if (is_sparc)
4629 0o40000
4630 else if (is_hppa or native_arch == .alpha)
4631 0x40000000
4632 else
4633 0o4000;
42364634};
42374635
42384636pub const TCP = struct {
......@@ -4646,6 +5044,77 @@ pub const SO = if (is_mips) struct {
46465044 pub const RCVTIMEO_NEW = 68;
46475045 pub const SNDTIMEO_NEW = 69;
46485046 pub const DETACH_REUSEPORT_BPF = 71;
5047} else if (native_arch == .alpha) struct {
5048 pub const DEBUG = 1;
5049 pub const REUSEADDR = 0x0004;
5050 pub const KEEPALIVE = 0x0008;
5051 pub const DONTROUTE = 0x0010;
5052 pub const BROADCAST = 0x0020;
5053 pub const LINGER = 0x0080;
5054 pub const OOBINLINE = 0x0100;
5055 pub const REUSEPORT = 0x0200;
5056
5057 pub const SNDBUF = 0x1001;
5058 pub const RCVBUF = 0x1002;
5059 pub const SNDLOWAT = 0x1011;
5060 pub const RCVLOWAT = 0x1010;
5061 pub const RCVTIMEO = 0x1012;
5062 pub const SNDTIMEO = 0x1013;
5063 pub const ERROR = 0x1007;
5064 pub const TYPE = 0x1008;
5065 pub const ACCEPTCONN = 0x1014;
5066 pub const PROTOCOL = 0x1028;
5067 pub const DOMAIN = 0x1029;
5068
5069 pub const NO_CHECK = 11;
5070 pub const PRIORITY = 12;
5071 pub const BSDCOMPAT = 14;
5072 pub const PASSCRED = 17;
5073 pub const PEERCRED = 18;
5074 pub const PEERSEC = 30;
5075 pub const SNDBUFFORCE = 0x100a;
5076 pub const RCVBUFFORCE = 0x100b;
5077 pub const SECURITY_AUTHENTICATION = 19;
5078 pub const SECURITY_ENCRYPTION_TRANSPORT = 20;
5079 pub const SECURITY_ENCRYPTION_NETWORK = 21;
5080 pub const BINDTODEVICE = 25;
5081 pub const ATTACH_FILTER = 26;
5082 pub const DETACH_FILTER = 27;
5083 pub const GET_FILTER = ATTACH_FILTER;
5084 pub const PEERNAME = 28;
5085 pub const TIMESTAMP_OLD = 29;
5086 pub const PASSSEC = 34;
5087 pub const TIMESTAMPNS_OLD = 35;
5088 pub const MARK = 36;
5089 pub const TIMESTAMPING_OLD = 37;
5090 pub const RXQ_OVFL = 40;
5091 pub const WIFI_STATUS = 41;
5092 pub const PEEK_OFF = 42;
5093 pub const NOFCS = 43;
5094 pub const LOCK_FILTER = 44;
5095 pub const SELECT_ERR_QUEUE = 45;
5096 pub const BUSY_POLL = 46;
5097 pub const MAX_PACING_RATE = 47;
5098 pub const BPF_EXTENSIONS = 48;
5099 pub const INCOMING_CPU = 49;
5100 pub const ATTACH_BPF = 50;
5101 pub const DETACH_BPF = DETACH_FILTER;
5102 pub const ATTACH_REUSEPORT_CBPF = 51;
5103 pub const ATTACH_REUSEPORT_EBPF = 52;
5104 pub const CNX_ADVICE = 53;
5105 pub const MEMINFO = 55;
5106 pub const INCOMING_NAPI_ID = 56;
5107 pub const COOKIE = 57;
5108 pub const PEERGROUPS = 59;
5109 pub const ZEROCOPY = 60;
5110 pub const TXTIME = 61;
5111 pub const BINDTOIFINDEX = 62;
5112 pub const TIMESTAMP_NEW = 63;
5113 pub const TIMESTAMPNS_NEW = 64;
5114 pub const TIMESTAMPING_NEW = 65;
5115 pub const RCVTIMEO_NEW = 66;
5116 pub const SNDTIMEO_NEW = 67;
5117 pub const DETACH_REUSEPORT_BPF = 68;
46495118} else struct {
46505119 pub const DEBUG = 1;
46515120 pub const REUSEADDR = 2;
......@@ -4731,7 +5200,10 @@ pub const SCM = struct {
47315200};
47325201
47335202pub const SOL = struct {
4734 pub const SOCKET = if (is_mips or is_sparc) 65535 else 1;
5203 pub const SOCKET = if (is_mips or is_sparc or native_arch == .alpha)
5204 0xffff
5205 else
5206 1;
47355207
47365208 pub const IP = 0;
47375209 pub const IPV6 = 41;
......@@ -5318,7 +5790,7 @@ pub const T = if (is_mips) struct {
53185790 pub const IOCSERSETMULTI = 0x5490;
53195791 pub const IOCMIWAIT = 0x5491;
53205792 pub const IOCGICOUNT = 0x5492;
5321} else if (is_ppc) struct {
5793} else if (is_ppc or native_arch == .alpha) struct {
53225794 pub const FIOCLEX = IOCTL.IO('f', 1);
53235795 pub const FIONCLEX = IOCTL.IO('f', 2);
53245796 pub const FIOASYNC = IOCTL.IOW('f', 125, c_int);
......@@ -6102,6 +6574,15 @@ pub const TFD = switch (native_arch) {
61026574
61036575 pub const TIMER = TFD_TIMER;
61046576 },
6577 .alpha => packed struct(u32) {
6578 _0: u2 = 0,
6579 NONBLOCK: bool = false,
6580 _3: u18 = 0,
6581 CLOEXEC: bool = false,
6582 _: u10 = 0,
6583
6584 pub const TIMER = TFD_TIMER;
6585 },
61056586 else => packed struct(u32) {
61066587 _0: u11 = 0,
61076588 NONBLOCK: bool = false,
......@@ -6131,6 +6612,11 @@ pub const k_sigaction = switch (native_arch) {
61316612 flags: c_ulong,
61326613 mask: sigset_t,
61336614 },
6615 .alpha => extern struct {
6616 handler: k_sigaction_funcs.handler,
6617 mask: sigset_t,
6618 flags: c_int,
6619 },
61346620 else => extern struct {
61356621 handler: k_sigaction_funcs.handler,
61366622 flags: c_ulong,
......@@ -6155,6 +6641,7 @@ pub const Sigaction = struct {
61556641 mask: sigset_t,
61566642 flags: switch (native_arch) {
61576643 .mips, .mipsel, .mips64, .mips64el => c_uint,
6644 .alpha => c_int,
61586645 else => c_ulong,
61596646 },
61606647};
......@@ -7625,7 +8112,14 @@ pub const rusage = extern struct {
76258112};
76268113
76278114pub const NCC = if (is_ppc) 10 else 8;
7628pub const NCCS = if (is_mips) 32 else if (is_ppc) 19 else if (is_sparc) 17 else 32;
8115pub const NCCS = if (is_mips)
8116 32
8117else if (is_ppc or native_arch == .alpha)
8118 19
8119else if (is_sparc)
8120 17
8121else
8122 32;
76298123
76308124pub const speed_t = if (is_ppc) enum(c_uint) {
76318125 B0 = 0x0000000,
......@@ -7739,7 +8233,7 @@ pub const speed_t = if (is_ppc) enum(c_uint) {
77398233
77408234pub const tcflag_t = if (native_arch == .sparc) c_ulong else c_uint;
77418235
7742pub const tc_iflag_t = if (is_ppc) packed struct(tcflag_t) {
8236pub const tc_iflag_t = if (is_ppc or native_arch == .alpha) packed struct(tcflag_t) {
77438237 IGNBRK: bool = false,
77448238 BRKINT: bool = false,
77458239 IGNPAR: bool = false,
......@@ -7775,7 +8269,7 @@ pub const tc_iflag_t = if (is_ppc) packed struct(tcflag_t) {
77758269 _15: u17 = 0,
77768270};
77778271
7778pub const NLDLY = if (is_ppc) enum(u2) {
8272pub const NLDLY = if (is_ppc or native_arch == .alpha) enum(u2) {
77798273 NL0 = 0,
77808274 NL1 = 1,
77818275 NL2 = 2,
......@@ -7816,7 +8310,7 @@ pub const FFDLY = enum(u1) {
78168310 FF1 = 1,
78178311};
78188312
7819pub const tc_oflag_t = if (is_ppc) packed struct(tcflag_t) {
8313pub const tc_oflag_t = if (is_ppc or native_arch == .alpha) packed struct(tcflag_t) {
78208314 OPOST: bool = false,
78218315 ONLCR: bool = false,
78228316 OLCUC: bool = false,
......@@ -7875,7 +8369,7 @@ pub const CSIZE = enum(u2) {
78758369 CS8 = 3,
78768370};
78778371
7878pub const tc_cflag_t = if (is_ppc) packed struct(tcflag_t) {
8372pub const tc_cflag_t = if (is_ppc or native_arch == .alpha) packed struct(tcflag_t) {
78798373 _0: u8 = 0,
78808374 CSIZE: CSIZE = .CS5,
78818375 CSTOPB: bool = false,
......@@ -7922,7 +8416,7 @@ pub const tc_lflag_t = if (is_mips) packed struct(tcflag_t) {
79228416 TOSTOP: bool = false,
79238417 EXTPROC: bool = false,
79248418 _17: u15 = 0,
7925} else if (is_ppc) packed struct(tcflag_t) {
8419} else if (is_ppc or native_arch == .alpha) packed struct(tcflag_t) {
79268420 ECHOKE: bool = false,
79278421 ECHOE: bool = false,
79288422 ECHOK: bool = false,
......@@ -8023,6 +8517,24 @@ pub const V = if (is_mips) enum(u32) {
80238517 STOP = 14,
80248518 LNEXT = 15,
80258519 DISCARD = 16,
8520} else if (arch_bits == .alpha) enum(u32) {
8521 EOF = 0,
8522 EOL = 1,
8523 EOL2 = 2,
8524 ERASE = 3,
8525 WERASE = 4,
8526 KILL = 5,
8527 REPRINT = 6,
8528 SWTC = 7,
8529 INTR = 8,
8530 QUIT = 9,
8531 SUSP = 10,
8532 START = 12,
8533 STOP = 13,
8534 LNEXT = 14,
8535 DISCARD = 15,
8536 MIN = 16,
8537 TIME = 17,
80268538} else enum(u32) {
80278539 INTR = 0,
80288540 QUIT = 1,
......@@ -8053,7 +8565,7 @@ pub const sgttyb = if (is_mips or is_ppc or is_sparc) extern struct {
80538565 flags: if (is_mips) c_int else c_short,
80548566} else void;
80558567
8056pub const tchars = if (is_mips or is_ppc or is_sparc) extern struct {
8568pub const tchars = if (is_mips or is_ppc or is_sparc or native_arch == .alpha) extern struct {
80578569 intrc: c_char,
80588570 quitc: c_char,
80598571 startc: c_char,
......@@ -8062,7 +8574,7 @@ pub const tchars = if (is_mips or is_ppc or is_sparc) extern struct {
80628574 brkc: c_char,
80638575} else void;
80648576
8065pub const ltchars = if (is_mips or is_ppc or is_sparc) extern struct {
8577pub const ltchars = if (is_mips or is_ppc or is_sparc or native_arch == .alpha) extern struct {
80668578 suspc: c_char,
80678579 dsuspc: c_char,
80688580 rprntc: c_char,
......@@ -8087,7 +8599,7 @@ pub const termios = if (is_mips or is_sparc) extern struct {
80878599 lflag: tc_lflag_t,
80888600 line: cc_t,
80898601 cc: [NCCS]cc_t,
8090} else if (is_ppc) extern struct {
8602} else if (is_ppc or native_arch == .alpha) extern struct {
80918603 iflag: tc_iflag_t,
80928604 oflag: tc_oflag_t,
80938605 cflag: tc_cflag_t,
......@@ -8107,7 +8619,7 @@ pub const termios = if (is_mips or is_sparc) extern struct {
81078619 ospeed: speed_t,
81088620};
81098621
8110pub const termios2 = if (is_mips) extern struct {
8622pub const termios2 = if (is_mips or native_arch == .alpha) extern struct {
81118623 iflag: tc_iflag_t,
81128624 oflag: tc_oflag_t,
81138625 cflag: tc_cflag_t,
......@@ -8686,6 +9198,49 @@ pub const rlimit_resource = if (native_arch.isMIPS()) enum(c_int) {
86869198 /// call before being forcibly descheduled.
86879199 RTTIME = 15,
86889200
9201 _,
9202} else if (native_arch == .alpha) enum(c_int) {
9203 /// Per-process CPU limit, in seconds.
9204 CPU = 0,
9205 /// Largest file that can be created, in bytes.
9206 FSIZE = 1,
9207 /// Maximum size of data segment, in bytes.
9208 DATA = 2,
9209 /// Maximum size of stack segment, in bytes.
9210 STACK = 3,
9211 /// Largest core file that can be created, in bytes.
9212 CORE = 4,
9213 /// Largest resident set size, in bytes.
9214 /// This affects swapping; processes that are exceeding their
9215 /// resident set size will be more likely to have physical memory
9216 /// taken from them.
9217 RSS = 5,
9218 /// Number of open files.
9219 NOFILE = 6,
9220 /// Address space limit.
9221 AS = 7,
9222 /// Number of processes.
9223 NPROC = 8,
9224 /// Locked-in-memory address space.
9225 MEMLOCK = 9,
9226 /// Maximum number of file locks.
9227 LOCKS = 10,
9228 /// Maximum number of pending signals.
9229 SIGPENDING = 11,
9230 /// Maximum bytes in POSIX message queues.
9231 MSGQUEUE = 12,
9232 /// Maximum nice priority allowed to raise to.
9233 /// Nice levels 19 .. -20 correspond to 0 .. 39
9234 /// values of this resource limit.
9235 NICE = 13,
9236 /// Maximum realtime priority allowed for non-privileged
9237 /// processes.
9238 RTPRIO = 14,
9239 /// Maximum CPU time in µs that a process scheduled under a real-time
9240 /// scheduling policy may consume without making a blocking system
9241 /// call before being forcibly descheduled.
9242 RTTIME = 15,
9243
86899244 _,
86909245} else enum(c_int) {
86919246 /// Per-process CPU limit, in seconds.
......@@ -8736,7 +9291,10 @@ pub const rlim_t = u64;
87369291
87379292pub const RLIM = struct {
87389293 /// No limit
8739 pub const INFINITY = ~@as(rlim_t, 0);
9294 pub const INFINITY: rlim_t = if (native_arch == .alpha)
9295 ~@as(u63, 0)
9296 else
9297 ~@as(rlim_t, 0);
87409298
87419299 pub const SAVED_MAX = INFINITY;
87429300 pub const SAVED_CUR = INFINITY;
lib/std/os/linux/ioctl.zig+1
......@@ -11,6 +11,7 @@ const bits = switch (@import("builtin").cpu.arch) {
1111 .powerpc64le,
1212 .sparc,
1313 .sparc64,
14 .alpha,
1415 => .{ .size = 13, .dir = 3, .none = 1, .read = 2, .write = 4 },
1516 else => .{ .size = 14, .dir = 2, .none = 0, .read = 2, .write = 1 },
1617};