From 797f1a0ec0abddc63aadb6e7a155d1c6f7321a55 Mon Sep 17 00:00:00 2001 From: Meghan Denny Date: Fri, 16 Oct 2026 04:03:18 -0700 Subject: [PATCH] add linux --- linux.zig | 6301 +++++++++++++++++++++++++++++++++++++++++++++++++++++ sys.zig | 3 + 2 files changed, 6304 insertions(+) create mode 100644 linux.zig diff --git a/linux.zig b/linux.zig new file mode 100644 index 0000000000000000000000000000000000000000..17b8e6550bbf562ef28c11c695da16ead8b1b0cc --- /dev/null +++ b/linux.zig @@ -0,0 +1,6301 @@ +const std = @import("std"); +const linux = std.os.linux; +const builtin = @import("builtin"); +const arch = builtin.target.cpu.arch; + +comptime { + std.debug.assert(builtin.target.os.tag == .linux); + std.debug.assert(@bitSizeOf(usize) == 64); +} + +pub const errno = struct { + pub const Error = error{ + Unexpected, + EPERM, + ENOENT, + ESRCH, + EINTR, + EIO, + ENXIO, + E2BIG, + ENOEXEC, + EBADF, + ECHILD, + EAGAIN, + ENOMEM, + EACCES, + EFAULT, + ENOTBLK, + EBUSY, + EEXIST, + EXDEV, + ENODEV, + ENOTDIR, + EISDIR, + EINVAL, + ENFILE, + EMFILE, + ENOTTY, + ETXTBSY, + EFBIG, + ENOSPC, + ESPIPE, + EROFS, + EMLINK, + EPIPE, + EDOM, + ERANGE, + EDEADLK, + ENAMETOOLONG, + ENOLCK, + ENOSYS, + ENOTEMPTY, + ELOOP, + ENOMSG, + EIDRM, + ECHRNG, + EL2NSYNC, + EL3HLT, + EL3RST, + ELNRNG, + EUNATCH, + ENOCSI, + EL2HLT, + EBADE, + EBADR, + EXFULL, + ENOANO, + EBADRQC, + EBADSLT, + EDEADLOCK, + EBFONT, + ENOSTR, + ENODATA, + ETIME, + ENOSR, + ENONET, + ENOPKG, + EREMOTE, + ENOLINK, + EADV, + ESRMNT, + ECOMM, + EPROTO, + EMULTIHOP, + EDOTDOT, + EBADMSG, + EOVERFLOW, + ENOTUNIQ, + EBADFD, + EREMCHG, + ELIBACC, + ELIBBAD, + ELIBSCN, + ELIBMAX, + ELIBEXEC, + EILSEQ, + ERESTART, + ESTRPIPE, + EUSERS, + ENOTSOCK, + EDESTADDRREQ, + EMSGSIZE, + EPROTOTYPE, + ENOPROTOOPT, + EPROTONOSUPPORT, + ESOCKTNOSUPPORT, + EOPNOTSUPP, + EPFNOSUPPORT, + EAFNOSUPPORT, + EADDRINUSE, + EADDRNOTAVAIL, + ENETDOWN, + ENETUNREACH, + ENETRESET, + ECONNABORTED, + ECONNRESET, + ENOBUFS, + EISCONN, + ENOTCONN, + ESHUTDOWN, + ETOOMANYREFS, + ETIMEDOUT, + ECONNREFUSED, + EHOSTDOWN, + EHOSTUNREACH, + EALREADY, + EINPROGRESS, + ESTALE, + EUCLEAN, + ENOTNAM, + ENAVAIL, + EISNAM, + EREMOTEIO, + EDQUOT, + ENOMEDIUM, + EMEDIUMTYPE, + ECANCELED, + ENOKEY, + EKEYEXPIRED, + EKEYREVOKED, + EKEYREJECTED, + EOWNERDEAD, + ENOTRECOVERABLE, + ERFKILL, + EHWPOISON, + }; + + pub const Enum = switch (builtin.target.cpu.arch) { + .arc, + .arceb, + .arm, + .armeb, + .aarch64, + .aarch64_be, + .csky, + .hexagon, + .loongarch32, + .loongarch64, + .m68k, + .riscv32, + .riscv32be, + .riscv64, + .riscv64be, + .s390x, + .sparc, + .sparc64, + .x86_16, + .x86, + .x86_64, + .xtensa, + .xtensaeb, + => enum(c_ushort) { + EPERM = 1, + ENOENT = 2, + ESRCH = 3, + EINTR = 4, + EIO = 5, + ENXIO = 6, + E2BIG = 7, + ENOEXEC = 8, + EBADF = 9, + ECHILD = 10, + EAGAIN = 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, + EDEADLK = 35, + ENAMETOOLONG = 36, + ENOLCK = 37, + ENOSYS = 38, + ENOTEMPTY = 39, + ELOOP = 40, + // + ENOMSG = 42, + EIDRM = 43, + ECHRNG = 44, + EL2NSYNC = 45, + EL3HLT = 46, + EL3RST = 47, + ELNRNG = 48, + EUNATCH = 49, + ENOCSI = 50, + EL2HLT = 51, + EBADE = 52, + EBADR = 53, + EXFULL = 54, + ENOANO = 55, + EBADRQC = 56, + EBADSLT = 57, + // + EBFONT = 59, + ENOSTR = 60, + ENODATA = 61, + ETIME = 62, + ENOSR = 63, + ENONET = 64, + ENOPKG = 65, + EREMOTE = 66, + ENOLINK = 67, + EADV = 68, + ESRMNT = 69, + ECOMM = 70, + EPROTO = 71, + EMULTIHOP = 72, + EDOTDOT = 73, + EBADMSG = 74, + EOVERFLOW = 75, + ENOTUNIQ = 76, + EBADFD = 77, + EREMCHG = 78, + ELIBACC = 79, + ELIBBAD = 80, + ELIBSCN = 81, + ELIBMAX = 82, + ELIBEXEC = 83, + EILSEQ = 84, + ERESTART = 85, + ESTRPIPE = 86, + EUSERS = 87, + ENOTSOCK = 88, + EDESTADDRREQ = 89, + EMSGSIZE = 90, + EPROTOTYPE = 91, + ENOPROTOOPT = 92, + EPROTONOSUPPORT = 93, + ESOCKTNOSUPPORT = 94, + EOPNOTSUPP = 95, + EPFNOSUPPORT = 96, + EAFNOSUPPORT = 97, + EADDRINUSE = 98, + EADDRNOTAVAIL = 99, + ENETDOWN = 100, + ENETUNREACH = 101, + ENETRESET = 102, + ECONNABORTED = 103, + ECONNRESET = 104, + ENOBUFS = 105, + EISCONN = 106, + ENOTCONN = 107, + ESHUTDOWN = 108, + ETOOMANYREFS = 109, + ETIMEDOUT = 110, + ECONNREFUSED = 111, + EHOSTDOWN = 112, + EHOSTUNREACH = 113, + EALREADY = 114, + EINPROGRESS = 115, + ESTALE = 116, + EUCLEAN = 117, + ENOTNAM = 118, + ENAVAIL = 119, + EISNAM = 120, + EREMOTEIO = 121, + EDQUOT = 122, + ENOMEDIUM = 123, + EMEDIUMTYPE = 124, + ECANCELED = 125, + ENOKEY = 126, + EKEYEXPIRED = 127, + EKEYREVOKED = 128, + EKEYREJECTED = 129, + EOWNERDEAD = 130, + ENOTRECOVERABLE = 131, + ERFKILL = 132, + EHWPOISON = 133, + _, + pub const EWOULDBLOCK: Enum = .EAGAIN; + pub const EDEADLOCK: Enum = .EDEADLK; + pub const ENOTSUP: Enum = .EOPNOTSUPP; + }, + .mips, + .mipsel, + => enum(c_ushort) { + EPERM = 1, + ENOENT = 2, + ESRCH = 3, + EINTR = 4, + EIO = 5, + ENXIO = 6, + E2BIG = 7, + ENOEXEC = 8, + EBADF = 9, + ECHILD = 10, + EAGAIN = 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, + ENOMSG = 35, + EIDRM = 36, + ECHRNG = 37, + EL2NSYNC = 38, + EL3HLT = 39, + EL3RST = 40, + ELNRNG = 41, + EUNATCH = 42, + ENOCSI = 43, + EL2HLT = 44, + EDEADLK = 45, + ENOLCK = 46, + EBADE = 50, + EBADR = 51, + EXFULL = 52, + ENOANO = 53, + EBADRQC = 54, + EBADSLT = 55, + EDEADLOCK = 56, + EBFONT = 59, + ENOSTR = 60, + ENODATA = 61, + ETIME = 62, + ENOSR = 63, + ENONET = 64, + ENOPKG = 65, + EREMOTE = 66, + ENOLINK = 67, + EADV = 68, + ESRMNT = 69, + ECOMM = 70, + EPROTO = 71, + EDOTDOT = 73, + EMULTIHOP = 74, + EBADMSG = 77, + ENAMETOOLONG = 78, + EOVERFLOW = 79, + ENOTUNIQ = 80, + EBADFD = 81, + EREMCHG = 82, + ELIBACC = 83, + ELIBBAD = 84, + ELIBSCN = 85, + ELIBMAX = 86, + ELIBEXEC = 87, + EILSEQ = 88, + ENOSYS = 89, + ELOOP = 90, + ERESTART = 91, + ESTRPIPE = 92, + ENOTEMPTY = 93, + EUSERS = 94, + ENOTSOCK = 95, + EDESTADDRREQ = 96, + EMSGSIZE = 97, + EPROTOTYPE = 98, + ENOPROTOOPT = 99, + EPROTONOSUPPORT = 120, + ESOCKTNOSUPPORT = 121, + EOPNOTSUPP = 122, + EPFNOSUPPORT = 123, + EAFNOSUPPORT = 124, + EADDRINUSE = 125, + EADDRNOTAVAIL = 126, + ENETDOWN = 127, + ENETUNREACH = 128, + ENETRESET = 129, + ECONNABORTED = 130, + ECONNRESET = 131, + ENOBUFS = 132, + EISCONN = 133, + ENOTCONN = 134, + EUCLEAN = 135, + ENOTNAM = 137, + ENAVAIL = 138, + EISNAM = 139, + EREMOTEIO = 140, + ESHUTDOWN = 143, + ETOOMANYREFS = 144, + ETIMEDOUT = 145, + ECONNREFUSED = 146, + EHOSTDOWN = 147, + EHOSTUNREACH = 148, + EALREADY = 149, + EINPROGRESS = 150, + ESTALE = 151, + ECANCELED = 158, + ENOMEDIUM = 159, + EMEDIUMTYPE = 160, + ENOKEY = 161, + EKEYEXPIRED = 162, + EKEYREVOKED = 163, + EKEYREJECTED = 164, + EOWNERDEAD = 165, + ENOTRECOVERABLE = 166, + ERFKILL = 167, + EHWPOISON = 168, + EDQUOT = 1133, + _, + pub const ENOTSUP: Enum = .EOPNOTSUPP; + pub const EWOULDBLOCK: Enum = .EAGAIN; + }, + .mips64, + .mips64el, + => enum(c_ushort) { + EPERM = 1, + ENOENT = 2, + ESRCH = 3, + EINTR = 4, + EIO = 5, + ENXIO = 6, + E2BIG = 7, + ENOEXEC = 8, + EBADF = 9, + ECHILD = 10, + EAGAIN = 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, + ENOMSG = 35, + EIDRM = 36, + ECHRNG = 37, + EL2NSYNC = 38, + EL3HLT = 39, + EL3RST = 40, + ELNRNG = 41, + EUNATCH = 42, + ENOCSI = 43, + EL2HLT = 44, + EDEADLK = 45, + ENOLCK = 46, + EBADE = 50, + EBADR = 51, + EXFULL = 52, + ENOANO = 53, + EBADRQC = 54, + EBADSLT = 55, + EDEADLOCK = 56, + EBFONT = 59, + ENOSTR = 60, + ENODATA = 61, + ETIME = 62, + ENOSR = 63, + ENONET = 64, + ENOPKG = 65, + EREMOTE = 66, + ENOLINK = 67, + EADV = 68, + ESRMNT = 69, + ECOMM = 70, + EPROTO = 71, + EDOTDOT = 73, + EMULTIHOP = 74, + EBADMSG = 77, + ENAMETOOLONG = 78, + EOVERFLOW = 79, + ENOTUNIQ = 80, + EBADFD = 81, + EREMCHG = 82, + ELIBACC = 83, + ELIBBAD = 84, + ELIBSCN = 85, + ELIBMAX = 86, + ELIBEXEC = 87, + EILSEQ = 88, + ENOSYS = 89, + ELOOP = 90, + ERESTART = 91, + ESTRPIPE = 92, + ENOTEMPTY = 93, + EUSERS = 94, + ENOTSOCK = 95, + EDESTADDRREQ = 96, + EMSGSIZE = 97, + EPROTOTYPE = 98, + ENOPROTOOPT = 99, + EPROTONOSUPPORT = 120, + ESOCKTNOSUPPORT = 121, + EOPNOTSUPP = 122, + EPFNOSUPPORT = 123, + EAFNOSUPPORT = 124, + EADDRINUSE = 125, + EADDRNOTAVAIL = 126, + ENETDOWN = 127, + ENETUNREACH = 128, + ENETRESET = 129, + ECONNABORTED = 130, + ECONNRESET = 131, + ENOBUFS = 132, + EISCONN = 133, + ENOTCONN = 134, + EUCLEAN = 135, + ENOTNAM = 137, + ENAVAIL = 138, + EISNAM = 139, + EREMOTEIO = 140, + ESHUTDOWN = 143, + ETOOMANYREFS = 144, + ETIMEDOUT = 145, + ECONNREFUSED = 146, + EHOSTDOWN = 147, + EHOSTUNREACH = 148, + EALREADY = 149, + EINPROGRESS = 150, + ESTALE = 151, + ECANCELED = 158, + ENOMEDIUM = 159, + EMEDIUMTYPE = 160, + ENOKEY = 161, + EKEYEXPIRED = 162, + EKEYREVOKED = 163, + EKEYREJECTED = 164, + EOWNERDEAD = 165, + ENOTRECOVERABLE = 166, + ERFKILL = 167, + EHWPOISON = 168, + EDQUOT = 1133, + _, + pub const ENOTSUP: Enum = .EOPNOTSUPP; + pub const EWOULDBLOCK: Enum = .EAGAIN; + }, + .powerpc, + .powerpcle, + => enum(c_ushort) { + EPERM = 1, + ENOENT = 2, + ESRCH = 3, + EINTR = 4, + EIO = 5, + ENXIO = 6, + E2BIG = 7, + ENOEXEC = 8, + EBADF = 9, + ECHILD = 10, + EAGAIN = 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, + EDEADLK = 35, + ENAMETOOLONG = 36, + ENOLCK = 37, + ENOSYS = 38, + ENOTEMPTY = 39, + ELOOP = 40, + ENOMSG = 42, + EIDRM = 43, + ECHRNG = 44, + EL2NSYNC = 45, + EL3HLT = 46, + EL3RST = 47, + ELNRNG = 48, + EUNATCH = 49, + ENOCSI = 50, + EL2HLT = 51, + EBADE = 52, + EBADR = 53, + EXFULL = 54, + ENOANO = 55, + EBADRQC = 56, + EBADSLT = 57, + EDEADLOCK = 58, + EBFONT = 59, + ENOSTR = 60, + ENODATA = 61, + ETIME = 62, + ENOSR = 63, + ENONET = 64, + ENOPKG = 65, + EREMOTE = 66, + ENOLINK = 67, + EADV = 68, + ESRMNT = 69, + ECOMM = 70, + EPROTO = 71, + EMULTIHOP = 72, + EDOTDOT = 73, + EBADMSG = 74, + EOVERFLOW = 75, + ENOTUNIQ = 76, + EBADFD = 77, + EREMCHG = 78, + ELIBACC = 79, + ELIBBAD = 80, + ELIBSCN = 81, + ELIBMAX = 82, + ELIBEXEC = 83, + EILSEQ = 84, + ERESTART = 85, + ESTRPIPE = 86, + EUSERS = 87, + ENOTSOCK = 88, + EDESTADDRREQ = 89, + EMSGSIZE = 90, + EPROTOTYPE = 91, + ENOPROTOOPT = 92, + EPROTONOSUPPORT = 93, + ESOCKTNOSUPPORT = 94, + EOPNOTSUPP = 95, + EPFNOSUPPORT = 96, + EAFNOSUPPORT = 97, + EADDRINUSE = 98, + EADDRNOTAVAIL = 99, + ENETDOWN = 100, + ENETUNREACH = 101, + ENETRESET = 102, + ECONNABORTED = 103, + ECONNRESET = 104, + ENOBUFS = 105, + EISCONN = 106, + ENOTCONN = 107, + ESHUTDOWN = 108, + ETOOMANYREFS = 109, + ETIMEDOUT = 110, + ECONNREFUSED = 111, + EHOSTDOWN = 112, + EHOSTUNREACH = 113, + EALREADY = 114, + EINPROGRESS = 115, + ESTALE = 116, + EUCLEAN = 117, + ENOTNAM = 118, + ENAVAIL = 119, + EISNAM = 120, + EREMOTEIO = 121, + EDQUOT = 122, + ENOMEDIUM = 123, + EMEDIUMTYPE = 124, + ECANCELED = 125, + ENOKEY = 126, + EKEYEXPIRED = 127, + EKEYREVOKED = 128, + EKEYREJECTED = 129, + EOWNERDEAD = 130, + ENOTRECOVERABLE = 131, + ERFKILL = 132, + EHWPOISON = 133, + _, + pub const EWOULDBLOCK: Enum = .EAGAIN; + pub const ENOTSUP: Enum = .EOPNOTSUPP; + }, + .powerpc64, + .powerpc64le, + => enum(c_ushort) { + EPERM = 1, + ENOENT = 2, + ESRCH = 3, + EINTR = 4, + EIO = 5, + ENXIO = 6, + E2BIG = 7, + ENOEXEC = 8, + EBADF = 9, + ECHILD = 10, + EAGAIN = 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, + EDEADLK = 35, + ENAMETOOLONG = 36, + ENOLCK = 37, + ENOSYS = 38, + ENOTEMPTY = 39, + ELOOP = 40, + ENOMSG = 42, + EIDRM = 43, + ECHRNG = 44, + EL2NSYNC = 45, + EL3HLT = 46, + EL3RST = 47, + ELNRNG = 48, + EUNATCH = 49, + ENOCSI = 50, + EL2HLT = 51, + EBADE = 52, + EBADR = 53, + EXFULL = 54, + ENOANO = 55, + EBADRQC = 56, + EBADSLT = 57, + EDEADLOCK = 58, + EBFONT = 59, + ENOSTR = 60, + ENODATA = 61, + ETIME = 62, + ENOSR = 63, + ENONET = 64, + ENOPKG = 65, + EREMOTE = 66, + ENOLINK = 67, + EADV = 68, + ESRMNT = 69, + ECOMM = 70, + EPROTO = 71, + EMULTIHOP = 72, + EDOTDOT = 73, + EBADMSG = 74, + EOVERFLOW = 75, + ENOTUNIQ = 76, + EBADFD = 77, + EREMCHG = 78, + ELIBACC = 79, + ELIBBAD = 80, + ELIBSCN = 81, + ELIBMAX = 82, + ELIBEXEC = 83, + EILSEQ = 84, + ERESTART = 85, + ESTRPIPE = 86, + EUSERS = 87, + ENOTSOCK = 88, + EDESTADDRREQ = 89, + EMSGSIZE = 90, + EPROTOTYPE = 91, + ENOPROTOOPT = 92, + EPROTONOSUPPORT = 93, + ESOCKTNOSUPPORT = 94, + EOPNOTSUPP = 95, + EPFNOSUPPORT = 96, + EAFNOSUPPORT = 97, + EADDRINUSE = 98, + EADDRNOTAVAIL = 99, + ENETDOWN = 100, + ENETUNREACH = 101, + ENETRESET = 102, + ECONNABORTED = 103, + ECONNRESET = 104, + ENOBUFS = 105, + EISCONN = 106, + ENOTCONN = 107, + ESHUTDOWN = 108, + ETOOMANYREFS = 109, + ETIMEDOUT = 110, + ECONNREFUSED = 111, + EHOSTDOWN = 112, + EHOSTUNREACH = 113, + EALREADY = 114, + EINPROGRESS = 115, + ESTALE = 116, + EUCLEAN = 117, + ENOTNAM = 118, + ENAVAIL = 119, + EISNAM = 120, + EREMOTEIO = 121, + EDQUOT = 122, + ENOMEDIUM = 123, + EMEDIUMTYPE = 124, + ECANCELED = 125, + ENOKEY = 126, + EKEYEXPIRED = 127, + EKEYREVOKED = 128, + EKEYREJECTED = 129, + EOWNERDEAD = 130, + ENOTRECOVERABLE = 131, + ERFKILL = 132, + EHWPOISON = 133, + _, + pub const EWOULDBLOCK: Enum = .EAGAIN; + pub const ENOTSUP: Enum = .EOPNOTSUPP; + }, + .alpha => unreachable, + .microblaze, .microblazeel => unreachable, + .sh, .sheb => unreachable, + // nios2 + // openrisc + // parisc + // um + // @compileError("TODO: " ++ @tagName(v)), + .avr, + .bpfel, + .bpfeb, + .msp430, + .amdgcn, + .thumb, + .thumbeb, + .propeller, + .xcore, + .nvptx, + .nvptx64, + .spirv32, + .spirv64, + .kalimba, + .lanai, + .wasm32, + .wasm64, + .ve, + .or1k, + .hppa, + .hppa64, + .kvx, + => unreachable, + }; + + pub fn byName(name: []const u8) ?Error { + inline for (comptime std.meta.fieldNames(Error)) |field_name| { + if (std.mem.eql(u8, name, field_name)) { + return @field(Error, field_name); + } + } + return null; + } + + comptime { + // assert Enum is sequential + var value: c_ushort = 0; // SUCCESS + for (std.enums.values(Enum)) |val| { + std.debug.assert(@intFromEnum(val) > value); + value = @intFromEnum(val); + } + } + comptime { + // sanity test + std.debug.assert(@intFromEnum(Enum.EPERM) == 1); + } + const list = blk: { + const values = std.enums.values(Enum); + const len = @intFromEnum(values[values.len - 1]) + 1; + var errors: [len]Error = @splat(error.Unexpected); + for (values) |f| errors[@intFromEnum(f)] = @field(Error, @tagName(f)); + const final = errors; + break :blk final; + }; + + pub fn fromInt(code: c_int) Error { + @setRuntimeSafety(false); + if (code >= list.len) return error.Unexpected; + if (code <= 0) return error.Unexpected; + return list[@intCast(code)]; + } + + pub fn fromLibC() c_int { + return libc.__errno_location().*; + } +}; + +pub const eai = struct { + pub const Error = error{ + EAI_BADFLAGS, + EAI_NONAME, + EAI_AGAIN, + EAI_FAIL, + EAI_NODATA, + EAI_FAMILY, + EAI_SOCKTYPE, + EAI_SERVICE, + EAI_MEMORY, + EAI_SYSTEM, + EAI_OVERFLOW, + }; + + pub const Enum = enum(c_int) { + EAI_BADFLAGS = -1, + EAI_NONAME = -2, + EAI_AGAIN = -3, + EAI_FAIL = -4, + EAI_NODATA = -5, + EAI_FAMILY = -6, + EAI_SOCKTYPE = -7, + EAI_SERVICE = -8, + EAI_MEMORY = -10, + EAI_SYSTEM = -11, + EAI_OVERFLOW = -12, + }; + + pub fn fromInt(code: c_int) Error { + return switch (@as(Enum, @enumFromInt(code))) { + .EAI_BADFLAGS => error.EAI_BADFLAGS, + .EAI_NONAME => error.EAI_NONAME, + .EAI_AGAIN => error.EAI_AGAIN, + .EAI_FAIL => error.EAI_FAIL, + .EAI_NODATA => error.EAI_NODATA, + .EAI_FAMILY => error.EAI_FAMILY, + .EAI_SOCKTYPE => error.EAI_SOCKTYPE, + .EAI_SERVICE => error.EAI_SERVICE, + .EAI_MEMORY => error.EAI_MEMORY, + .EAI_SYSTEM => error.EAI_SYSTEM, + .EAI_OVERFLOW => error.EAI_OVERFLOW, + }; + } +}; + +pub const libc = struct { + /// void _Exit(int status); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/_Exit.html + pub extern fn _Exit(status: c_int) noreturn; + + /// void _exit(int status); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/_exit.html + pub extern fn _exit(status: c_int) noreturn; + + /// long a64l(const char *s); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/a64l.html + pub extern fn a64l(s: [*]const u8) c_long; + + /// void abort(void); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/abort.html + pub extern fn abort() void; + + /// int abs(int i); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/abs.html + pub extern fn abs(i: c_int) c_int; + + /// int accept(int socket, struct sockaddr *restrict address, socklen_t *restrict address_len); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/accept.html + pub extern fn accept(socket: c_int, noalias address: ?*struct_sockaddr, noalias address_len: *socklen_t) c_int; + + /// int access(const char *path, int amode); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/access.html + pub extern fn access(path: [*:0]const u8, amode: c_int) c_int; + + /// double acos(double x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/acos.html + pub extern fn acos(x: f64) f64; + + /// float acosf(float x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/acosf.html + pub extern fn acosf(x: f32) f32; + + /// double acosh(double x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/acosh.html + pub extern fn acosh(x: f64) f64; + + /// float acoshf(float x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/acoshf.html + pub extern fn acoshf(x: f32) f32; + + /// long double acoshl(long double x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/acoshl.html + pub extern fn acoshl(x: c_longdouble) c_longdouble; + + /// long double acosl(long double x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/acosl.html + pub extern fn acosl(x: c_longdouble) c_longdouble; + + /// int aio_cancel(int fildes, struct aiocb *aiocbp); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/aio_cancel.html + // pub extern fn aio_cancel(__fildes: c_int, __aiocbp: [*c]struct_aiocb) c_int; + + /// int aio_error(const struct aiocb *aiocbp); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/aio_error.html + // pub extern fn aio_error(__aiocbp: [*c]const struct_aiocb) c_int; + + /// int aio_fsync(int op, struct aiocb *aiocbp); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/aio_fsync.html + // pub extern fn aio_fsync(__operation: c_int, __aiocbp: [*c]struct_aiocb) c_int; + + /// int aio_read(struct aiocb *aiocbp); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/aio_read.html + // pub extern fn aio_read(__aiocbp: [*c]struct_aiocb) c_int; + + /// ssize_t aio_return(struct aiocb *aiocbp); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/aio_return.html + // pub extern fn aio_return(__aiocbp: [*c]struct_aiocb) isize; + + /// int aio_suspend(const struct aiocb *const list[], int nent, const struct timespec *timeout); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/aio_suspend.html + // pub extern fn aio_suspend(__list: [*c]const [*c]const struct_aiocb, __nent: c_int, noalias __timeout: [*c]const struct_timespec) c_int; + + /// int aio_write(struct aiocb *aiocbp); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/aio_write.html + // pub extern fn aio_write(__aiocbp: [*c]struct_aiocb) c_int; + + /// unsigned alarm(unsigned seconds); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/alarm.html + pub extern fn alarm(seconds: c_uint) c_uint; + + /// int alphasort(const struct dirent **d1, const struct dirent **d2); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/alphasort.html + // pub extern fn alphasort(__e1: [*c][*c]const struct_dirent, __e2: [*c][*c]const struct_dirent) c_int; + + /// char *asctime(const struct tm *timeptr); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/asctime.html + // pub extern fn asctime(timeptr: *struct_tm) ?[*:0]u8; + + /// char *asctime_r(const struct tm *restrict tm, char *restrict buf); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/asctime_r.html + // pub extern fn asctime_r(noalias tm: *const struct_tm, buf: *[26]u8) ?[25:0]u8; + + /// double asin(double x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/asin.html + pub extern fn asin(x: f64) f64; + + /// float asinf(float x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/asinf.html + pub extern fn asinf(x: f32) f32; + + /// double asinh(double x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/asinh.html + pub extern fn asinh(x: f64) f64; + + /// float asinhf(float x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/asinhf.html + pub extern fn asinhf(x: f32) f32; + + /// long double asinhl(long double x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/asinhl.html + pub extern fn asinhl(x: c_longdouble) c_longdouble; + + /// long double asinl(long double x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/asinl.html + pub extern fn asinl(x: c_longdouble) c_longdouble; + + /// double atan(double x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/atan.html + pub extern fn atan(x: f64) f64; + + /// double atan2(double y, double x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/atan2.html + pub extern fn atan2(y: f64, x: f64) f64; + + /// float atan2f(float y, float x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/atan2f.html + pub extern fn atan2f(y: f32, x: f32) f32; + + /// long double atan2l(long double y, long double x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/atan2l.html + pub extern fn atan2l(y: c_longdouble, x: c_longdouble) c_longdouble; + + /// float atanf(float x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/atanf.html + pub extern fn atanf(x: f32) f32; + + /// double atanh(double x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/atanh.html + pub extern fn atanh(x: f64) f64; + + /// float atanhf(float x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/atanhf.html + pub extern fn atanhf(x: f32) f32; + + /// long double atanhl(long double x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/atanhl.html + pub extern fn atanhl(x: c_longdouble) c_longdouble; + + /// long double atanl(long double x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/atanl.html + pub extern fn atanl(x: c_longdouble) c_longdouble; + + /// int atexit(void (*func)(void)); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/atexit.html + pub extern fn atexit(func: *const fn () callconv(.C) void) c_int; + + /// double atof(const char *str); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/atof.html + pub extern fn atof(str: [*:0]const u8) f64; + + /// int atoi(const char *str); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/atoi.html + pub extern fn atoi(str: [*:0]const u8) c_int; + + /// long atol(const char *str); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/atol.html + pub extern fn atol(str: [*:0]const u8) c_long; + + /// long long atoll(const char *nptr); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/atoll.html + pub extern fn atoll(nptr: [*:0]const u8) c_longlong; + + /// char *basename(char *path); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/basename.html + pub extern fn basename(path: [*:0]u8) [*:0]u8; + + /// int bind(int socket, const struct sockaddr *address, socklen_t address_len); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/bind.html + pub extern fn bind(socket: c_int, address: *const struct_sockaddr, address_len: socklen_t) c_int; + + /// void *bsearch(const void *key, const void *base, size_t nel, size_t width, int (*compar)(const void *, const void *)); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/bsearch.html + pub extern fn bsearch(key: *const anyopaque, base: *const anyopaque, nel: usize, width: usize, compar: *const fn (*const anyopaque, *const anyopaque) callconv(.C) c_int) ?*anyopaque; + + /// wint_t btowc(int c); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/btowc.html + pub extern fn btowc(c: c_int) c_int; + + /// double cabs(double complex z); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/cabs.html + pub const cabs = @compileError("TODO cabs"); + + /// float cabsf(float complex z); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/cabsf.html + pub const cabsf = @compileError("TODO cabsf"); + + /// long double cabsl(long double complex z); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/cabsl.html + pub const cabsl = @compileError("TODO cabsl"); + + /// double complex cacos(double complex z); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/cacos.html + pub const cacos = @compileError("TODO cacos"); + + /// float complex cacosf(float complex z); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/cacosf.html + pub const cacosf = @compileError("TODO cacosf"); + + /// double complex cacosh(double complex z); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/cacosh.html + pub const cacosh = @compileError("TODO cacosh"); + + /// float complex cacoshf(float complex z); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/cacoshf.html + pub const cacoshf = @compileError("TODO cacoshf"); + + /// long double complex cacoshl(long double complex z); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/cacoshl.html + pub const cacoshl = @compileError("TODO cacoshl"); + + /// long double complex cacosl(long double complex z); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/cacosl.html + pub const cacosl = @compileError("TODO cacosl"); + + /// void *calloc(size_t nelem, size_t elsize); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/calloc.html + pub extern fn calloc(nelem: usize, elsize: usize) ?*anyopaque; + + /// double carg(double complex z); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/carg.html + pub const carg = @compileError("TODO carg"); + + /// float cargf(float complex z); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/cargf.html + pub const cargf = @compileError("TODO cargf"); + + /// long double cargl(long double complex z); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/cargl.html + pub const cargl = @compileError("TODO cargl"); + + /// double complex casin(double complex z); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/casin.html + pub const casin = @compileError("TODO casin"); + + /// float complex casinf(float complex z); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/casinf.html + pub const casinf = @compileError("TODO casinf"); + + /// double complex casinh(double complex z); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/casinh.html + pub const casinh = @compileError("TODO casinh"); + + /// float complex casinhf(float complex z); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/casinhf.html + pub const casinhf = @compileError("TODO casinhf"); + + /// long double complex casinhl(long double complex z); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/casinhl.html + pub const casinhl = @compileError("TODO casinhl"); + + /// long double complex casinl(long double complex z); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/casinl.html + pub const casinl = @compileError("TODO casinl"); + + /// double complex catan(double complex z); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/catan.html + pub const catan = @compileError("TODO catan"); + + /// float complex catanf(float complex z); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/catanf.html + pub const catanf = @compileError("TODO catanf"); + + /// double complex catanh(double complex z); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/catanh.html + pub const catanh = @compileError("TODO catanh"); + + /// float complex catanhf(float complex z); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/catanhf.html + pub const catanhf = @compileError("TODO catanhf"); + + /// long double complex catanhl(long double complex z); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/catanhl.html + pub const catanhl = @compileError("TODO catanhl"); + + /// long double complex catanl(long double complex z); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/catanl.html + pub const catanl = @compileError("TODO catanl"); + + /// int catclose(nl_catd catd); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/catclose.html + pub extern fn catclose(catd: nl_catd) c_int; + + /// char *catgets(nl_catd catd, int set_id, int msg_id, const char *s); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/catgets.html + pub extern fn catgets(catd: nl_catd, set_id: c_int, msg_id: c_int, s: [*:0]const u8) [*:0]u8; + + /// nl_catd catopen(const char *name, int oflag); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/catopen.html + pub extern fn catopen(name: [*:0]const u8, oflag: c_int) nl_catd; + + /// double cbrt(double x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/cbrt.html + pub extern fn cbrt(x: f64) f64; + + /// float cbrtf(float x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/cbrtf.html + pub extern fn cbrtf(x: f32) f32; + + /// long double cbrtl(long double x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/cbrtl.html + pub extern fn cbrtl(x: c_longdouble) c_longdouble; + + /// double complex ccos(double complex z); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/ccos.html + pub const ccos = @compileError("TODO ccos"); + + /// float complex ccosf(float complex z); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/ccosf.html + pub const ccosf = @compileError("TODO ccosf"); + + /// double complex ccosh(double complex z); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/ccosh.html + pub const ccosh = @compileError("TODO ccosh"); + + /// float complex ccoshf(float complex z); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/ccoshf.html + pub const ccoshf = @compileError("TODO ccoshf"); + + /// long double complex ccoshl(long double complex z); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/ccoshl.html + pub const ccoshl = @compileError("TODO ccoshl"); + + /// long double complex ccosl(long double complex z); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/ccosl.html + pub const ccosl = @compileError("TODO ccosl"); + + /// double ceil(double x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/ceil.html + pub extern fn ceil(x: f64) f64; + + /// float ceilf(float x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/ceilf.html + pub extern fn ceilf(x: f32) f32; + + /// long double ceill(long double x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/ceill.html + pub extern fn ceill(x: c_longdouble) c_longdouble; + + /// double complex cexp(double complex z); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/cexp.html + pub const cexp = @compileError("TODO cexp"); + + /// float complex cexpf(float complex z); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/cexpf.html + pub const cexpf = @compileError("TODO cexpf"); + + /// long double complex cexpl(long double complex z); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/cexpl.html + pub const cexpl = @compileError("TODO cexpl"); + + /// speed_t cfgetispeed(const struct termios *termios_p); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/cfgetispeed.html + // pub extern fn cfgetispeed(__termios_p: [*c]const struct_termios) speed_t; + + /// speed_t cfgetospeed(const struct termios *termios_p); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/cfgetospeed.html + // pub extern fn cfgetospeed(__termios_p: [*c]const struct_termios) speed_t; + + /// int cfsetispeed(struct termios *termios_p, speed_t speed); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/cfsetispeed.html + // pub extern fn cfsetispeed(__termios_p: [*c]struct_termios, __speed: speed_t) c_int; + + /// int cfsetospeed(struct termios *termios_p, speed_t speed); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/cfsetospeed.html + // pub extern fn cfsetospeed(__termios_p: [*c]struct_termios, __speed: speed_t) c_int; + + /// int chdir(const char *path); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/chdir.html + pub extern fn chdir(path: [*:0]const u8) c_int; + + /// int chmod(const char *path, mode_t mode); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/chmod.html + pub extern fn chmod(path: [*:0]const u8, mode: mode_t) c_int; + + /// int chown(const char *path, uid_t owner, gid_t group); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/chown.html + pub extern fn chown(path: [*:0]const u8, owner: uid_t, group: gid_t) c_int; + + /// double cimag(double complex z); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/cimag.html + pub const cimag = @compileError("TODO cimag"); + + /// float cimagf(float complex z); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/cimagf.html + pub const cimagf = @compileError("TODO cimagf"); + + /// long double cimagl(long double complex z); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/cimagl.html + pub const cimagl = @compileError("TODO cimagl"); + + /// void clearerr(FILE *stream); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/clearerr.html + pub extern fn clearerr(stream: *FILE) void; + + /// clock_t clock(void); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/clock.html + pub extern fn clock() clock_t; + + /// int clock_getcpuclockid(pid_t pid, clockid_t *clock_id); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/clock_getcpuclockid.html + pub extern fn clock_getcpuclockid(pid: pid_t, clock_id: *clockid_t) c_int; + + /// int clock_getres(clockid_t clock_id, struct timespec *res); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/clock_getres.html + pub extern fn clock_getres(clock_id: clockid_t, res: ?*struct_timespec) c_int; + + /// int clock_gettime(clockid_t clock_id, struct timespec *tp); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/clock_gettime.html + pub extern fn clock_gettime(clock_id: clockid_t, tp: *struct_timespec) c_int; + + /// int clock_nanosleep(clockid_t clock_id, int flags, const struct timespec *rqtp, struct timespec *rmtp); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/clock_nanosleep.html + pub extern fn clock_nanosleep(clock_id: clockid_t, flags: c_int, rqtp: *const struct_timespec, rmtp: ?*struct_timespec) c_int; + + /// int clock_settime(clockid_t clock_id, const struct timespec *tp); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/clock_settime.html + pub extern fn clock_settime(clock_id: clockid_t, tp: *const struct_timespec) c_int; + + /// double complex clog(double complex z); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/clog.html + pub const clog = @compileError("TODO clog"); + + /// float complex clogf(float complex z); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/clogf.html + pub const clogf = @compileError("TODO clogf"); + + /// long double complex clogl(long double complex z); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/clogl.html + pub const clogl = @compileError("TODO clogl"); + + /// int close(int fildes); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/close.html + pub extern fn close(fildes: c_int) c_int; + + /// int closedir(DIR *dirp); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/closedir.html + pub extern fn closedir(dirp: *DIR) c_int; + + /// void closelog(void); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/closelog.html + pub extern fn closelog() void; + + /// size_t confstr(int name, char *buf, size_t len); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/confstr.html + pub extern fn confstr(name: c_int, buf: ?[*:0]u8, len: usize) usize; + + /// double complex conj(double complex z); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/conj.html + pub const conj = @compileError("TODO conj"); + + /// float complex conjf(float complex z); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/conjf.html + pub const conjf = @compileError("TODO conjf"); + + /// long double complex conjl(long double complex z); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/conjl.html + pub const conjl = @compileError("TODO conjl"); + + /// int connect(int socket, const struct sockaddr *address, socklen_t address_len); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/connect.html + pub extern fn connect(socket: c_int, address: *const struct_sockaddr, address_len: socklen_t) c_int; + + /// double copysign(double x, double y); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/copysign.html + pub extern fn copysign(x: f64, y: f64) f64; + + /// float copysignf(float x, float y); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/copysignf.html + pub extern fn copysignf(x: f32, y: f32) f32; + + /// long double copysignl(long double x, long double y); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/copysignl.html + pub extern fn copysignl(x: c_longdouble, y: c_longdouble) c_longdouble; + + /// double cos(double x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/cos.html + pub extern fn cos(x: f64) f64; + + /// float cosf(float x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/cosf.html + pub extern fn cosf(x: f32) f32; + + /// double cosh(double x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/cosh.html + pub extern fn cosh(x: f64) f64; + + /// float coshf(float x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/coshf.html + pub extern fn coshf(x: f32) f32; + + /// long double coshl(long double x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/coshl.html + pub extern fn coshl(x: c_longdouble) c_longdouble; + + /// long double cosl(long double x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/cosl.html + pub extern fn cosl(x: c_longdouble) c_longdouble; + + /// double complex cpow(double complex x, double complex y); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/cpow.html + pub const cpow = @compileError("TODO cpow"); + + /// float complex cpowf(float complex x, float complex y); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/cpowf.html + pub const cpowf = @compileError("TODO cpowf"); + + /// long double complex cpowl(long double complex x, long double complex y); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/cpowl.html + pub const cpowl = @compileError("TODO cpowl"); + + /// double complex cproj(double complex z); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/cproj.html + pub const cproj = @compileError("TODO cproj"); + + /// float complex cprojf(float complex z); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/cprojf.html + pub const cprojf = @compileError("TODO cprojf"); + + /// long double complex cprojl(long double complex z); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/cprojl.html + pub const cprojl = @compileError("TODO cprojl"); + + /// double creal(double complex z); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/creal.html + pub const creal = @compileError("TODO creal"); + + /// float crealf(float complex z); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/crealf.html + pub const crealf = @compileError("TODO crealf"); + + /// long double creall(long double complex z); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/creall.html + pub const creall = @compileError("TODO creall"); + + /// int creat(const char *path, mode_t mode); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/creat.html + pub extern fn creat(path: [*:0]const u8, mode: mode_t) c_int; + + /// char *crypt(const char *key, const char *salt); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/crypt.html + pub extern fn crypt(key: [*:0]const u8, salt: [*]const u8) ?[*:0]u8; + + /// double complex csin(double complex z); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/csin.html + pub const csin = @compileError("TODO csin"); + + /// float complex csinf(float complex z); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/csinf.html + pub const csinf = @compileError("TODO csinf"); + + /// double complex csinh(double complex z); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/csinh.html + pub const csinh = @compileError("TODO csinh"); + + /// float complex csinhf(float complex z); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/csinhf.html + pub const csinhf = @compileError("TODO csinhf"); + + /// long double complex csinhl(long double complex z); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/csinhl.html + pub const csinhl = @compileError("TODO csinhl"); + + /// long double complex csinl(long double complex z); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/csinl.html + pub const csinl = @compileError("TODO csinl"); + + /// double complex csqrt(double complex z); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/csqrt.html + pub const csqrt = @compileError("TODO csqrt"); + + /// float complex csqrtf(float complex z); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/csqrtf.html + pub const csqrtf = @compileError("TODO csqrtf"); + + /// long double complex csqrtl(long double complex z); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/csqrtl.html + pub const csqrtl = @compileError("TODO csqrtl"); + + /// double complex ctan(double complex z); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/ctan.html + pub const ctan = @compileError("TODO ctan"); + + /// float complex ctanf(float complex z); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/ctanf.html + pub const ctanf = @compileError("TODO ctanf"); + + /// double complex ctanh(double complex z); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/ctanh.html + pub const ctanh = @compileError("TODO ctanh"); + + /// float complex ctanhf(float complex z); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/ctanhf.html + pub const ctanhf = @compileError("TODO ctanhf"); + + /// long double complex ctanhl(long double complex z); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/ctanhl.html + pub const ctanhl = @compileError("TODO ctanhl"); + + /// long double complex ctanl(long double complex z); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/ctanl.html + pub const ctanl = @compileError("TODO ctanl"); + + /// char *ctermid(char *s); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/ctermid.html + pub extern fn ctermid(s: ?[*:0]u8) [*:0]u8; + + /// char *ctime(const time_t *clock); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/ctime.html + pub extern fn ctime(clock: *const time_t) ?[*:0]u8; + + /// char *ctime_r(const time_t *clock, char *buf); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/ctime_r.html + pub extern fn ctime_r(noalias clock: [*c]const time_t, noalias buf: [*]u8) ?[*:0]u8; + + /// int dbm_clearerr(DBM *db); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/dbm_clearerr.html + pub const dbm_clearerr = @compileError("TODO dbm_clearerr"); + + /// void dbm_close(DBM *db); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/dbm_close.html + pub const dbm_close = @compileError("TODO dbm_close"); + + /// int dbm_delete(DBM *db, datum key); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/dbm_delete.html + pub const dbm_delete = @compileError("TODO dbm_delete"); + + /// int dbm_error(DBM *db); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/dbm_error.html + pub const dbm_error = @compileError("TODO dbm_error"); + + /// datum dbm_fetch(DBM *db, datum key); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/dbm_fetch.html + pub const dbm_fetch = @compileError("TODO dbm_fetch"); + + /// datum dbm_firstkey(DBM *db); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/dbm_firstkey.html + pub const dbm_firstkey = @compileError("TODO dbm_firstkey"); + + /// datum dbm_nextkey(DBM *db); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/dbm_nextkey.html + pub const dbm_nextkey = @compileError("TODO dbm_nextkey"); + + /// DBM *dbm_open(const char *file, int open_flags, mode_t file_mode); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/dbm_open.html + pub const dbm_open = @compileError("TODO dbm_open"); + + /// int dbm_store(DBM *db, datum key, datum content, int store_mode); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/dbm_store.html + pub const dbm_store = @compileError("TODO dbm_store"); + + /// double difftime(time_t time1, time_t time0); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/difftime.html + pub extern fn difftime(time1: time_t, time0: time_t) f64; + + /// int dirfd(DIR *dirp); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/dirfd.html + pub extern fn dirfd(dirp: *DIR) c_int; + + /// char *dirname(char *path); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/dirname.html + pub extern fn dirname(path: ?[*:0]u8) [*:0]u8; + + /// div_t div(int numer, int denom); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/div.html + pub extern fn div(numer: c_int, denom: c_int) div_t; + + /// int dlclose(void *handle); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/dlclose.html + pub extern fn dlclose(handle: *anyopaque) c_int; + + /// char *dlerror(void); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/dlerror.html + pub extern fn dlerror() ?[*:0]u8; + + /// void *dlopen(const char *file, int mode); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/dlopen.html + pub extern fn dlopen(file: [*:0]const u8, mode: c_int) ?*anyopaque; + + /// void *dlsym(void *restrict handle, const char *restrict name); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/dlsym.html + pub extern fn dlsym(noalias handle: *anyopaque, noalias name: [*:0]const u8) ?*anyopaque; + + /// int dprintf(int fildes, const char *restrict format, ...); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/dprintf.html + pub extern fn dprintf(__fd: c_int, noalias __fmt: [*c]const u8, ...) c_int; + + /// double drand48(void); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/drand48.html + pub extern fn drand48() f64; + + /// int dup(int fildes); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/dup.html + pub extern fn dup(fildes: c_int) c_int; + + /// int dup2(int fildes, int fildes2); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/dup2.html + pub extern fn dup2(fildes: c_int, fildes2: c_int) c_int; + + /// locale_t duplocale(locale_t locobj); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/duplocale.html + pub extern fn duplocale(locobj: locale_t) ?locale_t; + + /// void encrypt(char block[64], int edflag); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/encrypt.html + pub const encrypt = @compileError("TODO encrypt"); + + /// void endgrent(void); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/endgrent.html + pub extern fn endgrent() void; + + /// void endhostent(void); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/endhostent.html + pub extern fn endhostent() void; + + /// void endnetent(void); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/endnetent.html + pub extern fn endnetent() void; + + /// void endprotoent(void); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/endprotoent.html + pub extern fn endprotoent() void; + + /// void endpwent(void); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/endpwent.html + pub extern fn endpwent() void; + + /// void endservent(void); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/endservent.html + pub extern fn endservent() void; + + /// void endutxent(void); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/endutxent.html + pub extern fn endutxent() void; + + /// double erand48(unsigned short xsubi[3]); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/erand48.html + pub extern fn erand48(xsubi: *[3]c_ushort) f64; + + /// double erf(double x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/erf.html + pub extern fn erf(x: f64) f64; + + /// double erfc(double x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/erfc.html + pub extern fn erfc(x: f64) f64; + + /// float erfcf(float x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/erfcf.html + pub extern fn erfcf(x: f32) f32; + + /// long double erfcl(long double x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/erfcl.html + pub extern fn erfcl(x: c_longdouble) c_longdouble; + + /// float erff(float x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/erff.html + pub extern fn erff(x: f32) f32; + + /// long double erfl(long double x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/erfl.html + pub extern fn erfl(x: c_longdouble) c_longdouble; + + /// int execl(const char *path, const char *arg0, ... /*, (char *)0 */); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/execl.html + pub extern fn execl(__path: [*c]const u8, __arg: [*c]const u8, ...) c_int; + + /// int execle(const char *path, const char *arg0, ... /*, (char *)0, char *const envp[]*/); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/execle.html + pub extern fn execle(__path: [*c]const u8, __arg: [*c]const u8, ...) c_int; + + /// int execlp(const char *file, const char *arg0, ... /*, (char *)0 */); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/execlp.html + pub extern fn execlp(__file: [*c]const u8, __arg: [*c]const u8, ...) c_int; + + /// int execv(const char *path, char *const argv[]); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/execv.html + pub extern fn execv(__path: [*c]const u8, __argv: [*c]const [*c]u8) c_int; + + /// int execve(const char *path, char *const argv[], char *const envp[]); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/execve.html + pub extern fn execve(__path: [*c]const u8, __argv: [*c]const [*c]u8, __envp: [*c]const [*c]u8) c_int; + + /// int execvp(const char *file, char *const argv[]); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/execvp.html + pub extern fn execvp(file: [*:0]const u8, argv: [*:null]const ?[*:0]const u8) c_int; + + /// void exit(int status); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/exit.html + pub extern fn exit(status: c_int) noreturn; + + /// double exp(double x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/exp.html + pub extern fn exp(x: f64) f64; + + /// double exp2(double x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/exp2.html + pub extern fn exp2(x: f64) f64; + + /// float exp2f(float x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/exp2f.html + pub extern fn exp2f(x: f32) f32; + + /// long double exp2l(long double x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/exp2l.html + pub extern fn exp2l(x: c_longdouble) c_longdouble; + + /// float expf(float x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/expf.html + pub extern fn expf(x: f32) f32; + + /// long double expl(long double x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/expl.html + pub extern fn expl(x: c_longdouble) c_longdouble; + + /// double expm1(double x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/expm1.html + pub extern fn expm1(x: f64) f64; + + /// float expm1f(float x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/expm1f.html + pub extern fn expm1f(x: f32) f32; + + /// long double expm1l(long double x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/expm1l.html + pub extern fn expm1l(x: c_longdouble) c_longdouble; + + /// double fabs(double x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/fabs.html + pub extern fn fabs(x: f64) f64; + + /// float fabsf(float x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/fabsf.html + pub extern fn fabsf(x: f32) f32; + + /// long double fabsl(long double x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/fabsl.html + pub extern fn fabsl(x: c_longdouble) c_longdouble; + + /// int faccessat(int fd, const char *path, int amode, int flag); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/faccessat.html + pub extern fn faccessat(fd: c_int, path: [*:0]const u8, amode: c_int, flag: c_int) c_int; + + /// int fattach(int fildes, const char *path); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/fattach.html + pub const fattach = @compileError("TODO fattach"); + + /// int fchdir(int fildes); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/fchdir.html + pub extern fn fchdir(fildes: c_int) c_int; + + /// int fchmod(int fildes, mode_t mode); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/fchmod.html + pub extern fn fchmod(fildes: c_int, mode: mode_t) c_int; + + /// int fchmodat(int fd, const char *path, mode_t mode, int flag); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/fchmodat.html + pub extern fn fchmodat(fd: c_int, path: [*:0]const u8, mode: mode_t, flag: c_int) c_int; + + /// int fchown(int fildes, uid_t owner, gid_t group); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/fchown.html + pub extern fn fchown(fildes: c_int, owner: uid_t, group: gid_t) c_int; + + /// int fchownat(int fd, const char *path, uid_t owner, gid_t group, int flag); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/fchownat.html + pub extern fn fchownat(fd: c_int, path: [*:0]const u8, owner: uid_t, group: gid_t, flag: c_int) c_int; + + /// int fclose(FILE *stream); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/fclose.html + pub extern fn fclose(stream: *FILE) c_int; + + /// int fcntl(int fildes, int cmd, ...); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/fcntl.html + pub extern fn fcntl(__fd: c_int, __cmd: c_int, ...) c_int; + + /// int fdatasync(int fildes); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/fdatasync.html + pub extern fn fdatasync(fildes: c_int) c_int; + + /// int fdetach(const char *path); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/fdetach.html + pub const fdetach = @compileError("TODO fdetach"); + + /// double fdim(double x, double y); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/fdim.html + pub extern fn fdim(x: f64, y: f64) f64; + + /// float fdimf(float x, float y); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/fdimf.html + pub extern fn fdimf(x: f32, y: f32) f32; + + /// long double fdiml(long double x, long double y); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/fdiml.html + pub extern fn fdiml(x: c_longdouble, y: c_longdouble) c_longdouble; + + /// FILE *fdopen(int fildes, const char *mode); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/fdopen.html + pub extern fn fdopen(__fd: c_int, __modes: [*c]const u8) [*c]FILE; + + /// DIR *fdopendir(int fd); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/fdopendir.html + pub extern fn fdopendir(__fd: c_int) ?*DIR; + + /// int feclearexcept(int excepts); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/feclearexcept.html + pub extern fn feclearexcept(excepts: c_int) c_int; + + /// int fegetenv(fenv_t *envp); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/fegetenv.html + // pub extern fn fegetenv(__envp: ?*fenv_t) c_int; + + /// int fegetexceptflag(fexcept_t *flagp, int excepts); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/fegetexceptflag.html + // pub extern fn fegetexceptflag(__flagp: [*c]fexcept_t, __excepts: c_int) c_int; + + /// int fegetround(void); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/fegetround.html + pub extern fn fegetround() c_int; + + /// int feholdexcept(fenv_t *envp); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/feholdexcept.html + // pub extern fn feholdexcept(__envp: ?*fenv_t) c_int; + + /// int feof(FILE *stream); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/feof.html + pub extern fn feof(__stream: [*c]FILE) c_int; + + /// int feraiseexcept(int excepts); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/feraiseexcept.html + pub extern fn feraiseexcept(excepts: c_int) c_int; + + /// int ferror(FILE *stream); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/ferror.html + pub extern fn ferror(__stream: [*c]FILE) c_int; + + /// int fesetenv(const fenv_t *envp); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/fesetenv.html + // pub extern fn fesetenv(__envp: ?*const fenv_t) c_int; + + /// int fesetexceptflag(const fexcept_t *flagp, int excepts); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/fesetexceptflag.html + // pub extern fn fesetexceptflag(__flagp: [*c]const fexcept_t, __excepts: c_int) c_int; + + /// int fesetround(int round); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/fesetround.html + pub extern fn fesetround(round: c_int) c_int; + + /// int fetestexcept(int excepts); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/fetestexcept.html + pub extern fn fetestexcept(excepts: c_int) c_int; + + /// int feupdateenv(const fenv_t *envp); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/feupdateenv.html + // pub extern fn feupdateenv(__envp: ?*const fenv_t) c_int; + + /// int fexecve(int fd, char *const argv[], char *const envp[]); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/fexecve.html + pub extern fn fexecve(__fd: c_int, __argv: [*c]const [*c]u8, __envp: [*c]const [*c]u8) c_int; + + /// int fflush(FILE *stream); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/fflush.html + pub extern fn fflush(__stream: [*c]FILE) c_int; + + /// int ffs(int i); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/ffs.html + pub extern fn ffs(i: c_int) c_int; + + /// int fgetc(FILE *stream); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/fgetc.html + pub extern fn fgetc(__stream: [*c]FILE) c_int; + + /// int fgetpos(FILE *restrict stream, fpos_t *restrict pos); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/fgetpos.html + // pub extern fn fgetpos(noalias __stream: [*c]FILE, noalias __pos: [*c]fpos_t) c_int; + + /// char *fgets(char *restrict s, int n, FILE *restrict stream); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/fgets.html + pub extern fn fgets(noalias __s: [*c]u8, __n: c_int, noalias __stream: [*c]FILE) [*c]u8; + + /// wint_t fgetwc(FILE *stream); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/fgetwc.html + // pub extern fn fgetwc(__stream: [*c]__FILE) wint_t; + + /// wchar_t *fgetws(wchar_t *restrict ws, int n, FILE *restrict stream); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/fgetws.html + // pub extern fn fgetws(noalias __ws: [*c]wchar_t, __n: c_int, noalias __stream: [*c]__FILE) [*c]wchar_t; + + /// int fileno(FILE *stream); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/fileno.html + pub extern fn fileno(__stream: [*c]FILE) c_int; + + /// void flockfile(FILE *file); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/flockfile.html + pub extern fn flockfile(__stream: [*c]FILE) void; + + /// double floor(double x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/floor.html + pub extern fn floor(x: f64) f64; + + /// float floorf(float x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/floorf.html + pub extern fn floorf(x: f32) f32; + + /// long double floorl(long double x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/floorl.html + pub extern fn floorl(x: c_longdouble) c_longdouble; + + /// double fma(double x, double y, double z); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/fma.html + pub extern fn fma(x: f64, y: f64, z: f64) f64; + + /// float fmaf(float x, float y, float z); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/fmaf.html + pub extern fn fmaf(x: f32, y: f32, z: f32) f32; + + /// long double fmal(long double x, long double y, long double z); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/fmal.html + pub extern fn fmal(x: c_longdouble, y: c_longdouble, z: c_longdouble) c_longdouble; + + /// double fmax(double x, double y); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/fmax.html + pub extern fn fmax(x: f64, y: f64) f64; + + /// float fmaxf(float x, float y); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/fmaxf.html + pub extern fn fmaxf(x: f32, y: f32) f32; + + /// long double fmaxl(long double x, long double y); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/fmaxl.html + pub extern fn fmaxl(x: c_longdouble, y: c_longdouble) c_longdouble; + + /// FILE *fmemopen(void *restrict buf, size_t size, const char *restrict mode); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/fmemopen.html + pub extern fn fmemopen(__s: ?*anyopaque, __len: usize, __modes: [*c]const u8) [*c]FILE; + + /// double fmin(double x, double y); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/fmin.html + pub extern fn fmin(x: f64, y: f64) f64; + + /// float fminf(float x, float y); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/fminf.html + pub extern fn fminf(x: f32, y: f32) f32; + + /// long double fminl(long double x, long double y); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/fminl.html + pub extern fn fminl(x: c_longdouble, y: c_longdouble) c_longdouble; + + /// double fmod(double x, double y); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/fmod.html + pub extern fn fmod(x: f64, y: f64) f64; + + /// float fmodf(float x, float y); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/fmodf.html + pub extern fn fmodf(x: f32, y: f32) f32; + + /// long double fmodl(long double x, long double y); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/fmodl.html + pub extern fn fmodl(x: c_longdouble, y: c_longdouble) c_longdouble; + + /// int fmtmsg(long classification, const char *label, int severity, const char *text, const char *action, const char *tag); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/fmtmsg.html + pub extern fn fmtmsg(__classification: c_long, __label: [*c]const u8, __severity: c_int, __text: [*c]const u8, __action: [*c]const u8, __tag: [*c]const u8) c_int; + + /// int fnmatch(const char *pattern, const char *string, int flags); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/fnmatch.html + pub extern fn fnmatch(__pattern: [*c]const u8, __name: [*c]const u8, __flags: c_int) c_int; + + /// FILE *fopen(const char *restrict filename, const char *restrict mode); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/fopen.html + pub extern fn fopen(__filename: [*c]const u8, __modes: [*c]const u8) [*c]FILE; + + /// pid_t fork(void); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/fork.html + pub extern fn fork() pid_t; + + /// long fpathconf(int fildes, int name); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/fpathconf.html + pub extern fn fpathconf(fildes: c_int, name: c_int) c_long; + + /// int fprintf(FILE *restrict stream, const char *restrict format, ...); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/fprintf.html + pub extern fn fprintf(__stream: [*c]FILE, __format: [*c]const u8, ...) c_int; + + /// int fputc(int c, FILE *stream); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/fputc.html + pub extern fn fputc(__c: c_int, __stream: [*c]FILE) c_int; + + /// int fputs(const char *restrict s, FILE *restrict stream); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/fputs.html + pub extern fn fputs(noalias __s: [*c]const u8, noalias __stream: [*c]FILE) c_int; + + /// wint_t fputwc(wchar_t wc, FILE *stream); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/fputwc.html + // pub extern fn fputwc(__wc: wchar_t, __stream: [*c]__FILE) wint_t; + + /// int fputws(const wchar_t *restrict ws, FILE *restrict stream); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/fputws.html + // pub extern fn fputws(noalias __ws: [*c]const wchar_t, noalias __stream: [*c]__FILE) c_int; + + /// size_t fread(void *restrict ptr, size_t size, size_t nitems, FILE *restrict stream); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/fread.html + pub extern fn fread(__ptr: ?*anyopaque, __size: c_ulong, __n: c_ulong, __stream: [*c]FILE) c_ulong; + + /// void free(void *ptr); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/free.html + pub extern fn free(ptr: ?*anyopaque) void; + + /// void freeaddrinfo(struct addrinfo *ai); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/freeaddrinfo.html + pub extern fn freeaddrinfo(ai: *const struct_addrinfo) void; + + /// void freelocale(locale_t locobj); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/freelocale.html + pub extern fn freelocale(locobj: locale_t) void; + + /// FILE *freopen(const char *restrict filename, const char *restrict mode, FILE *restrict stream); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/freopen.html + pub extern fn freopen(noalias __filename: [*c]const u8, noalias __modes: [*c]const u8, noalias __stream: [*c]FILE) [*c]FILE; + + /// double frexp(double num, int *exp); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/frexp.html + pub extern fn frexp(x: f64, exp: *c_int) f64; + + /// float frexpf(float num, int *exp); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/frexpf.html + pub extern fn frexpf(x: f32, exp: *c_int) f32; + + /// long double frexpl(long double num, int *exp); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/frexpl.html + pub extern fn frexpl(x: c_longdouble, exp: *c_int) c_longdouble; + + /// int fscanf(FILE *restrict stream, const char *restrict format, ...); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/fscanf.html + pub extern fn fscanf(noalias __stream: [*c]FILE, noalias __format: [*c]const u8, ...) c_int; + + /// int fseek(FILE *stream, long offset, int whence); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/fseek.html + pub extern fn fseek(__stream: [*c]FILE, __off: c_long, __whence: c_int) c_int; + + /// int fseeko(FILE *stream, off_t offset, int whence); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/fseeko.html + // pub extern fn fseeko(__stream: [*c]FILE, __off: off_t, __whence: c_int) c_int; + + /// int fsetpos(FILE *stream, const fpos_t *pos); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/fsetpos.html + // pub extern fn fsetpos(__stream: [*c]FILE, __pos: [*c]const fpos_t) c_int; + + /// int fstat(int fildes, struct stat *buf); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/fstat.html + pub extern fn fstat(fd: c_int, buf: *struct_stat) c_int; + + /// int fstatat(int fd, const char *restrict path, struct stat *restrict buf, int flag); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/fstatat.html + pub extern fn fstatat(fd: c_int, noalias path: [*:0]const u8, noalias buf: *struct_stat, flag: c_int) c_int; + + /// int fstatvfs(int fildes, struct statvfs *buf); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/fstatvfs.html + // pub extern fn fstatvfs(__fildes: c_int, __buf: [*c]struct_statvfs) c_int; + + /// int fsync(int fildes); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/fsync.html + pub extern fn fsync(fd: c_int) c_int; + + /// long ftell(FILE *stream); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/ftell.html + pub extern fn ftell(__stream: [*c]FILE) c_long; + + /// off_t ftello(FILE *stream); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/ftello.html + // pub extern fn ftello(__stream: [*c]FILE) off_t; + + /// key_t ftok(const char *path, int id); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/ftok.html + // pub extern fn ftok(__pathname: [*c]const u8, __proj_id: c_int) key_t; + + /// int ftruncate(int fildes, off_t length); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/ftruncate.html + // pub extern fn ftruncate(__fd: c_int, __length: off_t) c_int; + + /// int ftrylockfile(FILE *file); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/ftrylockfile.html + pub extern fn ftrylockfile(__stream: [*c]FILE) c_int; + + /// int ftw(const char *path, int (*fn)(const char *, const struct stat *ptr, int flag), int ndirs); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/ftw.html + // pub extern fn ftw(__dir: [*c]const u8, __func: __ftw_func_t, __descriptors: c_int) c_int; + + /// void funlockfile(FILE *file); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/funlockfile.html + pub extern fn funlockfile(__stream: [*c]FILE) void; + + /// int futimens(int fd, const struct timespec times[2]); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/futimens.html + pub extern fn futimens(fd: c_int, times: *const [2]struct_timespec) c_int; + + /// int fwide(FILE *stream, int mode); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/fwide.html + // pub extern fn fwide(__fp: [*c]__FILE, __mode: c_int) c_int; + + /// int fwprintf(FILE *restrict stream, const wchar_t *restrict format, ...); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/fwprintf.html + // pub extern fn fwprintf(noalias __stream: [*c]__FILE, noalias __format: [*c]const wchar_t, ...) c_int; + + /// size_t fwrite(const void *restrict ptr, size_t size, size_t nitems, FILE *restrict stream); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/fwrite.html + pub extern fn fwrite(__ptr: ?*const anyopaque, __size: c_ulong, __n: c_ulong, __s: [*c]FILE) c_ulong; + + /// int fwscanf(FILE *restrict stream, const wchar_t *restrict format, ...); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/fwscanf.html + // pub extern fn fwscanf(noalias __stream: [*c]__FILE, noalias __format: [*c]const wchar_t, ...) c_int; + + /// const char *gai_strerror(int ecode); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/gai_strerror.html + pub extern fn gai_strerror(__ecode: c_int) [*c]const u8; + + /// int getaddrinfo(const char *restrict nodename, const char *restrict servname, const struct addrinfo *restrict hints, struct addrinfo **restrict res); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/getaddrinfo.html + pub extern fn getaddrinfo(noalias nodename: ?[*:0]const u8, noalias servname: ?[*:0]const u8, noalias req: ?*const struct_addrinfo, noalias pai: **const struct_addrinfo) c_int; + + /// int getc(FILE *stream); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/getc.html + pub extern fn getc(__stream: [*c]FILE) c_int; + + /// int getc_unlocked(FILE *stream); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/getc_unlocked.html + pub extern fn getc_unlocked(__stream: [*c]FILE) c_int; + + /// int getchar(void); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/getchar.html + pub extern fn getchar() c_int; + + /// int getchar_unlocked(void); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/getchar_unlocked.html + pub extern fn getchar_unlocked() c_int; + + /// char *getcwd(char *buf, size_t size); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/getcwd.html + pub extern fn getcwd(buf: [*]u8, size: usize) ?[*:0]u8; + + /// struct tm *getdate(const char *string); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/getdate.html + pub const getdate = @compileError("TODO getdate"); + + /// ssize_t getdelim(char **restrict lineptr, size_t *restrict n, int delimiter, FILE *restrict stream); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/getdelim.html + pub extern fn getdelim(noalias __lineptr: [*c][*c]u8, noalias __n: [*c]usize, __delimiter: c_int, noalias __stream: [*c]FILE) isize; + + /// gid_t getegid(void); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/getegid.html + pub extern fn getegid() gid_t; + + /// char *getenv(const char *name); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/getenv.html + pub extern fn getenv(name: [*:0]const u8) ?[*:0]u8; + + /// uid_t geteuid(void); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/geteuid.html + pub extern fn geteuid() uid_t; + + /// gid_t getgid(void); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/getgid.html + pub extern fn getgid() gid_t; + + /// struct group *getgrent(void); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/getgrent.html + pub extern fn getgrent() ?*struct_group; + + /// struct group *getgrgid(gid_t gid); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/getgrgid.html + pub extern fn getgrgid(gid: gid_t) ?*struct_group; + + /// int getgrgid_r(gid_t gid, struct group *grp, char *buffer, size_t bufsize, struct group **result); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/getgrgid_r.html + pub extern fn getgrgid_r(__gid: gid_t, noalias __resultbuf: [*c]struct_group, noalias __buffer: [*c]u8, __buflen: usize, noalias __result: [*c][*c]struct_group) c_int; + + /// struct group *getgrnam(const char *name); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/getgrnam.html + pub extern fn getgrnam(name: [*:0]const u8) ?*struct_group; + + /// int getgrnam_r(const char *name, struct group *grp, char *buffer, size_t bufsize, struct group **result); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/getgrnam_r.html + pub extern fn getgrnam_r(noalias __name: [*c]const u8, noalias __resultbuf: [*c]struct_group, noalias __buffer: [*c]u8, __buflen: usize, noalias __result: [*c][*c]struct_group) c_int; + + /// int getgroups(int gidsetsize, gid_t grouplist[]); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/getgroups.html + pub extern fn getgroups(__size: c_int, __list: [*c]gid_t) c_int; + + /// struct hostent *gethostent(void); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/gethostent.html + pub extern fn gethostent() ?*struct_hostent; + + /// long gethostid(void); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/gethostid.html + pub extern fn gethostid() c_long; + + /// int gethostname(char *name, size_t namelen); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/gethostname.html + pub extern fn gethostname(name: [*:0]u8, len: usize) c_int; + + /// int getitimer(int which, struct itimerval *value); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/getitimer.html + // pub extern fn getitimer(__which: __itimer_which_t, __value: [*c]struct_itimerval) c_int; + + /// ssize_t getline(char **restrict lineptr, size_t *restrict n, FILE *restrict stream); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/getline.html + pub extern fn getline(noalias __lineptr: [*c][*c]u8, noalias __n: [*c]usize, noalias __stream: [*c]FILE) isize; + + /// char *getlogin(void); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/getlogin.html + pub extern fn getlogin() ?[*:0]u8; + + /// int getlogin_r(char *name, size_t namesize); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/getlogin_r.html + pub extern fn getlogin_r(__name: [*c]u8, __name_len: usize) c_int; + + /// int getmsg(int fildes, struct strbuf *restrict ctlptr, struct strbuf *restrict dataptr, int *restrict flagsp); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/getmsg.html + pub const getmsg = @compileError("TODO getmsg"); + + /// int getnameinfo(const struct sockaddr *restrict sa, socklen_t salen, char *restrict node, socklen_t nodelen, char *restrict service, socklen_t servicelen, int flags); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/getnameinfo.html + pub extern fn getnameinfo(noalias __sa: [*c]const struct_sockaddr, __salen: socklen_t, noalias __host: [*c]u8, __hostlen: socklen_t, noalias __serv: [*c]u8, __servlen: socklen_t, __flags: c_int) c_int; + + /// struct netent *getnetbyaddr(uint32_t net, int type); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/getnetbyaddr.html + pub extern fn getnetbyaddr(net: u32, type: c_int) ?*struct_netent; + + /// struct netent *getnetbyname(const char *name); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/getnetbyname.html + pub extern fn getnetbyname(name: [*:0]const u8) ?*struct_netent; + + /// struct netent *getnetent(void); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/getnetent.html + pub extern fn getnetent() ?*struct_netent; + + /// int getopt(int argc, char * const argv[], const char *optstring); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/getopt.html + pub extern fn getopt(___argc: c_int, ___argv: [*c]const [*c]u8, __shortopts: [*c]const u8) c_int; + + /// int getpeername(int socket, struct sockaddr *restrict address, socklen_t *restrict address_len); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/getpeername.html + pub extern fn getpeername(__fd: c_int, noalias __addr: [*c]struct_sockaddr, noalias __len: [*c]socklen_t) c_int; + + /// pid_t getpgid(pid_t pid); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/getpgid.html + pub extern fn getpgid(pid: pid_t) pid_t; + + /// pid_t getpgrp(void); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/getpgrp.html + pub extern fn getpgrp() pid_t; + + /// pid_t getpid(void); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/getpid.html + pub extern fn getpid() pid_t; + + /// int getpmsg(int fildes, struct strbuf *restrict ctlptr, struct strbuf *restrict dataptr, int *restrict bandp, int *restrict flagsp); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/getpmsg.html + pub const getpmsg = @compileError("TODO getpmsg"); + + /// pid_t getppid(void); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/getppid.html + pub extern fn getppid() pid_t; + + /// int getpriority(int which, id_t who); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/getpriority.html + // pub extern fn getpriority(__which: __priority_which_t, __who: id_t) c_int; + + /// struct protoent *getprotobyname(const char *name); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/getprotobyname.html + pub extern fn getprotobyname(name: [*:0]const u8) ?*struct_protoent; + + /// struct protoent *getprotobynumber(int proto); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/getprotobynumber.html + pub extern fn getprotobynumber(proto: c_int) ?*struct_protoent; + + /// struct protoent *getprotoent(void); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/getprotoent.html + pub extern fn getprotoent() ?*struct_protoent; + + /// struct passwd *getpwent(void); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/getpwent.html + pub extern fn getpwent() ?*struct_passwd; + + /// struct passwd *getpwnam(const char *name); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/getpwnam.html + pub extern fn getpwnam(name: [*:0]const u8) ?*struct_passwd; + + /// int getpwnam_r(const char *name, struct passwd *pwd, char *buffer, size_t bufsize, struct passwd **result); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/getpwnam_r.html + pub extern fn getpwnam_r(noalias __name: [*c]const u8, noalias __resultbuf: [*c]struct_passwd, noalias __buffer: [*c]u8, __buflen: usize, noalias __result: [*c][*c]struct_passwd) c_int; + + /// struct passwd *getpwuid(uid_t uid); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/getpwuid.html + pub extern fn getpwuid(uid: uid_t) ?*struct_passwd; + + /// int getpwuid_r(uid_t uid, struct passwd *pwd, char *buffer, size_t bufsize, struct passwd **result); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/getpwuid_r.html + pub extern fn getpwuid_r(__uid: uid_t, noalias __resultbuf: [*c]struct_passwd, noalias __buffer: [*c]u8, __buflen: usize, noalias __result: [*c][*c]struct_passwd) c_int; + + /// int getrlimit(int resource, struct rlimit *rlp); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/getrlimit.html + // pub extern fn getrlimit(__resource: __rlimit_resource_t, __rlimits: [*c]struct_rlimit) c_int; + + /// int getrusage(int who, struct rusage *r_usage); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/getrusage.html + // pub extern fn getrusage(__who: __rusage_who_t, __usage: [*c]struct_rusage) c_int; + + /// char *gets(char *s); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/gets.html + pub extern fn gets(s: [*]u8) [*:0]u8; + + /// struct servent *getservbyname(const char *name, const char *proto); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/getservbyname.html + pub extern fn getservbyname(__name: [*c]const u8, __proto: [*c]const u8) [*c]struct_servent; + + /// struct servent *getservbyport(int port, const char *proto); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/getservbyport.html + pub extern fn getservbyport(__port: c_int, __proto: [*c]const u8) [*c]struct_servent; + + /// struct servent *getservent(void); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/getservent.html + pub extern fn getservent() ?*struct_servent; + + /// pid_t getsid(pid_t pid); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/getsid.html + pub extern fn getsid(pid: pid_t) pid_t; + + /// int getsockname(int socket, struct sockaddr *restrict address, socklen_t *restrict address_len); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/getsockname.html + pub extern fn getsockname(fd: c_int, noalias addr: *struct_sockaddr, noalias len: *socklen_t) c_int; + + /// int getsockopt(int socket, int level, int option_name, void *restrict option_value, socklen_t *restrict option_len); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/getsockopt.html + pub extern fn getsockopt(__fd: c_int, __level: c_int, __optname: c_int, noalias __optval: ?*anyopaque, noalias __optlen: [*c]socklen_t) c_int; + + /// int getsubopt(char **optionp, char * const *keylistp, char **valuep); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/getsubopt.html + pub extern fn getsubopt(noalias __optionp: [*c][*c]u8, noalias __tokens: [*c]const [*c]u8, noalias __valuep: [*c][*c]u8) c_int; + + /// int gettimeofday(struct timeval *restrict tp, void *restrict tzp); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/gettimeofday.html + // pub extern fn gettimeofday(noalias __tv: [*c]struct_timeval, noalias __tz: ?*anyopaque) c_int; + + /// uid_t getuid(void); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/getuid.html + pub extern fn getuid() uid_t; + + /// struct utmpx *getutxent(void); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/getutxent.html + pub extern fn getutxent() ?*struct_utmpx; + + /// struct utmpx *getutxid(const struct utmpx *id); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/getutxid.html + pub extern fn getutxid(__id: [*c]const struct_utmpx) [*c]struct_utmpx; + + /// struct utmpx *getutxline(const struct utmpx *line); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/getutxline.html + pub extern fn getutxline(__line: [*c]const struct_utmpx) [*c]struct_utmpx; + + /// wint_t getwc(FILE *stream); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/getwc.html + // pub extern fn getwc(__stream: [*c]__FILE) wint_t; + + /// wint_t getwchar(void); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/getwchar.html + pub extern fn getwchar() wint_t; + + /// int glob(const char *restrict pattern, int flags, int(*errfunc)(const char *epath, int eerrno), glob_t *restrict pglob); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/glob.html + // pub extern fn glob(noalias __pattern: [*c]const u8, __flags: c_int, __errfunc: ?*const fn ([*c]const u8, c_int) callconv(.C) c_int, noalias __pglob: [*c]glob_t) c_int; + + /// void globfree(glob_t *pglob); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/globfree.html + // pub extern fn globfree(__pglob: [*c]glob_t) void; + + /// struct tm *gmtime(const time_t *timer); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/gmtime.html + // pub extern fn gmtime(__timer: [*c]const time_t) [*c]struct_tm; + + /// struct tm *gmtime_r(const time_t *restrict timer, struct tm *restrict result); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/gmtime_r.html + // pub extern fn gmtime_r(noalias __timer: [*c]const time_t, noalias __tp: [*c]struct_tm) [*c]struct_tm; + + /// int grantpt(int fildes); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/grantpt.html + pub extern fn grantpt(fd: c_int) c_int; + + /// int hcreate(size_t nel); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/hcreate.html + pub extern fn hcreate(nel: usize) c_int; + + /// void hdestroy(void); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/hdestroy.html + pub extern fn hdestroy() void; + + /// ENTRY *hsearch(ENTRY item, ACTION action); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/hsearch.html + // pub extern fn hsearch(__item: ENTRY, __action: ACTION) [*c]ENTRY; + + /// uint32_t htonl(uint32_t hostlong); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/htonl.html + pub extern fn htonl(hostlong: u32) u32; + + /// uint16_t htons(uint16_t hostshort); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/htons.html + pub extern fn htons(hostshort: u16) u16; + + /// double hypot(double x, double y); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/hypot.html + pub extern fn hypot(x: f64, y: f64) f64; + + /// float hypotf(float x, float y); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/hypotf.html + pub extern fn hypotf(x: f32, y: f32) f32; + + /// long double hypotl(long double x, long double y); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/hypotl.html + pub extern fn hypotl(x: c_longdouble, y: c_longdouble) c_longdouble; + + /// size_t iconv(iconv_t cd, char **restrict inbuf, size_t *restrict inbytesleft, char **restrict outbuf, size_t *restrict outbytesleft); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/iconv.html + // pub extern fn iconv(__cd: iconv_t, noalias __inbuf: [*c][*c]u8, noalias __inbytesleft: [*c]usize, noalias __outbuf: [*c][*c]u8, noalias __outbytesleft: [*c]usize) usize; + + /// int iconv_close(iconv_t cd); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/iconv_close.html + // pub extern fn iconv_close(__cd: iconv_t) c_int; + + /// iconv_t iconv_open(const char *tocode, const char *fromcode); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/iconv_open.html + // pub extern fn iconv_open(__tocode: [*c]const u8, __fromcode: [*c]const u8) iconv_t; + + /// void if_freenameindex(struct if_nameindex *ptr); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/if_freenameindex.html + pub extern fn if_freenameindex(ptr: *struct_if_nameindex) void; + + /// char *if_indextoname(unsigned ifindex, char *ifname); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/if_indextoname.html + pub extern fn if_indextoname(__ifindex: c_uint, __ifname: [*c]u8) [*c]u8; + + /// struct if_nameindex *if_nameindex(void); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/if_nameindex.html + pub extern fn if_nameindex() ?*struct_if_nameindex; + + /// unsigned if_nametoindex(const char *ifname); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/if_nametoindex.html + pub extern fn if_nametoindex(ifname: [*:0]const u8) c_uint; + + /// int ilogb(double x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/ilogb.html + pub extern fn ilogb(x: f64) c_int; + + /// int ilogbf(float x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/ilogbf.html + pub extern fn ilogbf(x: f32) c_int; + + /// int ilogbl(long double x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/ilogbl.html + pub extern fn ilogbl(x: c_longdouble) c_int; + + /// intmax_t imaxabs(intmax_t j); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/imaxabs.html + pub extern fn imaxabs(j: intmax_t) intmax_t; + + /// imaxdiv_t imaxdiv(intmax_t numer, intmax_t denom); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/imaxdiv.html + // pub extern fn imaxdiv(__numer: intmax_t, __denom: intmax_t) imaxdiv_t; + + /// in_addr_t inet_addr(const char *cp); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/inet_addr.html + // pub extern fn inet_addr(__cp: [*c]const u8) in_addr_t; + + /// char *inet_ntoa(struct in_addr in); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/inet_ntoa.html + // pub extern fn inet_ntoa(__in: struct_in_addr) [*c]u8; + + /// const char *inet_ntop(int af, const void *restrict src, char *restrict dst, socklen_t size); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/inet_ntop.html + pub extern fn inet_ntop(__af: c_int, noalias __cp: ?*const anyopaque, noalias __buf: [*c]u8, __len: socklen_t) [*c]const u8; + + /// int inet_pton(int af, const char *restrict src, void *restrict dst); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/inet_pton.html + pub extern fn inet_pton(__af: c_int, noalias __cp: [*c]const u8, noalias __buf: ?*anyopaque) c_int; + + /// char *initstate(unsigned seed, char *state, size_t size); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/initstate.html + pub extern fn initstate(__seed: c_uint, __statebuf: [*c]u8, __statelen: usize) [*c]u8; + + /// void insque(void *element, void *pred); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/insque.html + pub extern fn insque(elem: *anyopaque, prev: ?*anyopaque) void; + + /// int ioctl(int fildes, int request, ... /* arg */); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/ioctl.html + pub const ioctl = @compileError("TODO ioctl"); + + /// int isalnum(int c); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/isalnum.html + pub extern fn isalnum(c: c_int) c_int; + + /// int isalnum_l(int c, locale_t locale); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/isalnum_l.html + pub extern fn isalnum_l(c: c_int, locale: locale_t) c_int; + + /// int isalpha(int c); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/isalpha.html + pub extern fn isalpha(c: c_int) c_int; + + /// int isalpha_l(int c, locale_t locale); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/isalpha_l.html + pub extern fn isalpha_l(c: c_int, locale: locale_t) c_int; + + /// int isascii(int c); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/isascii.html + pub extern fn isascii(c: c_int) c_int; + + /// int isastream(int fildes); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/isastream.html + pub extern fn isastream(fd: c_int) c_int; + + /// int isatty(int fildes); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/isatty.html + pub extern fn isatty(fd: c_int) c_int; + + /// int isblank(int c); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/isblank.html + pub extern fn isblank(c: c_int) c_int; + + /// int isblank_l(int c, locale_t locale); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/isblank_l.html + pub extern fn isblank_l(c: c_int, locale: locale_t) c_int; + + /// int iscntrl(int c); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/iscntrl.html + pub extern fn iscntrl(c: c_int) c_int; + + /// int iscntrl_l(int c, locale_t locale); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/iscntrl_l.html + pub extern fn iscntrl_l(c: c_int, locale: locale_t) c_int; + + /// int isdigit(int c); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/isdigit.html + pub extern fn isdigit(c: c_int) c_int; + + /// int isdigit_l(int c, locale_t locale); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/isdigit_l.html + pub extern fn isdigit_l(c: c_int, locale: locale_t) c_int; + + /// int isgraph(int c); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/isgraph.html + pub extern fn isgraph(c: c_int) c_int; + + /// int isgraph_l(int c, locale_t locale); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/isgraph_l.html + pub extern fn isgraph_l(c: c_int, locale: locale_t) c_int; + + /// int islower(int c); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/islower.html + pub extern fn islower(c: c_int) c_int; + + /// int islower_l(int c, locale_t locale); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/islower_l.html + pub extern fn islower_l(c: c_int, locale: locale_t) c_int; + + /// int isprint(int c); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/isprint.html + pub extern fn isprint(c: c_int) c_int; + + /// int isprint_l(int c, locale_t locale); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/isprint_l.html + pub extern fn isprint_l(c: c_int, locale: locale_t) c_int; + + /// int ispunct(int c); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/ispunct.html + pub extern fn ispunct(c: c_int) c_int; + + /// int ispunct_l(int c, locale_t locale); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/ispunct_l.html + pub extern fn ispunct_l(c: c_int, locale: locale_t) c_int; + + /// int isspace(int c); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/isspace.html + pub extern fn isspace(c: c_int) c_int; + + /// int isspace_l(int c, locale_t locale); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/isspace_l.html + pub extern fn isspace_l(c: c_int, locale: locale_t) c_int; + + /// int isupper(int c); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/isupper.html + pub extern fn isupper(c: c_int) c_int; + + /// int isupper_l(int c, locale_t locale); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/isupper_l.html + pub extern fn isupper_l(c: c_int, locale: locale_t) c_int; + + /// int iswalnum(wint_t wc); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/iswalnum.html + pub extern fn iswalnum(wc: wint_t) c_int; + + /// int iswalnum_l(wint_t wc, locale_t locale); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/iswalnum_l.html + pub extern fn iswalnum_l(wc: wint_t, locale: locale_t) c_int; + + /// int iswalpha(wint_t wc); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/iswalpha.html + pub extern fn iswalpha(wc: wint_t) c_int; + + /// int iswalpha_l(wint_t wc, locale_t locale); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/iswalpha_l.html + pub extern fn iswalpha_l(wc: wint_t, locale: locale_t) c_int; + + /// int iswblank(wint_t wc); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/iswblank.html + pub extern fn iswblank(wc: wint_t) c_int; + + /// int iswblank_l(wint_t wc, locale_t locale); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/iswblank_l.html + pub extern fn iswblank_l(wc: wint_t, locale: locale_t) c_int; + + /// int iswcntrl(wint_t wc); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/iswcntrl.html + pub extern fn iswcntrl(wc: wint_t) c_int; + + /// int iswcntrl_l(wint_t wc, locale_t locale); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/iswcntrl_l.html + pub extern fn iswcntrl_l(wc: wint_t, locale: locale_t) c_int; + + /// int iswctype(wint_t wc, wctype_t charclass); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/iswctype.html + // pub extern fn iswctype(__wc: wint_t, __desc: wctype_t) c_int; + + /// int iswctype_l(wint_t wc, wctype_t charclass, locale_t locale); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/iswctype_l.html + // pub extern fn iswctype_l(__wc: wint_t, __desc: wctype_t, __locale: locale_t) c_int; + + /// int iswdigit(wint_t wc); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/iswdigit.html + pub extern fn iswdigit(wc: wint_t) c_int; + + /// int iswdigit_l(wint_t wc, locale_t locale); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/iswdigit_l.html + pub extern fn iswdigit_l(wc: wint_t, locale: locale_t) c_int; + + /// int iswgraph(wint_t wc); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/iswgraph.html + pub extern fn iswgraph(wc: wint_t) c_int; + + /// int iswgraph_l(wint_t wc, locale_t locale); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/iswgraph_l.html + pub extern fn iswgraph_l(wc: wint_t, locale: locale_t) c_int; + + /// int iswlower(wint_t wc); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/iswlower.html + pub extern fn iswlower(wc: wint_t) c_int; + + /// int iswlower_l(wint_t wc, locale_t locale); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/iswlower_l.html + pub extern fn iswlower_l(wc: wint_t, locale: locale_t) c_int; + + /// int iswprint(wint_t wc); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/iswprint.html + pub extern fn iswprint(wc: wint_t) c_int; + + /// int iswprint_l(wint_t wc, locale_t locale); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/iswprint_l.html + pub extern fn iswprint_l(wc: wint_t, locale: locale_t) c_int; + + /// int iswpunct(wint_t wc); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/iswpunct.html + pub extern fn iswpunct(wc: wint_t) c_int; + + /// int iswpunct_l(wint_t wc, locale_t locale); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/iswpunct_l.html + pub extern fn iswpunct_l(wc: wint_t, locale: locale_t) c_int; + + /// int iswspace(wint_t wc); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/iswspace.html + pub extern fn iswspace(wc: wint_t) c_int; + + /// int iswspace_l(wint_t wc, locale_t locale); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/iswspace_l.html + pub extern fn iswspace_l(wc: wint_t, locale: locale_t) c_int; + + /// int iswupper(wint_t wc); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/iswupper.html + pub extern fn iswupper(wc: wint_t) c_int; + + /// int iswupper_l(wint_t wc, locale_t locale); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/iswupper_l.html + pub extern fn iswupper_l(wc: wint_t, locale: locale_t) c_int; + + /// int iswxdigit(wint_t wc); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/iswxdigit.html + pub extern fn iswxdigit(wc: wint_t) c_int; + + /// int iswxdigit_l(wint_t wc, locale_t locale); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/iswxdigit_l.html + pub extern fn iswxdigit_l(wc: wint_t, locale: locale_t) c_int; + + /// int isxdigit(int c); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/isxdigit.html + pub extern fn isxdigit(c: c_int) c_int; + + /// int isxdigit_l(int c, locale_t locale); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/isxdigit_l.html + pub extern fn isxdigit_l(c: c_int, locale: locale_t) c_int; + + /// double j0(double x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/j0.html + pub extern fn j0(x: f64) f64; + + /// double j1(double x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/j1.html + pub extern fn j1(x: f64) f64; + + /// double jn(int n, double x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/jn.html + pub extern fn jn(n: c_int, x: f64) f64; + + /// long jrand48(unsigned short xsubi[3]); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/jrand48.html + pub extern fn jrand48(__xsubi: [*c]c_ushort) c_long; + + /// int kill(pid_t pid, int sig); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/kill.html + pub extern fn kill(pid: pid_t, sig: c_int) c_int; + + /// int killpg(pid_t pgrp, int sig); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/killpg.html + // pub extern fn killpg(__pgrp: __pid_t, __sig: c_int) c_int; + + /// char *l64a(long value); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/l64a.html + pub extern fn l64a(__n: c_long) [*c]u8; + + /// long labs(long i); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/labs.html + pub extern fn labs(i: c_long) c_long; + + /// int lchown(const char *path, uid_t owner, gid_t group); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/lchown.html + pub extern fn lchown(__file: [*c]const u8, __owner: uid_t, __group: gid_t) c_int; + + /// void lcong48(unsigned short param[7]); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/lcong48.html + pub extern fn lcong48(__param: [*c]c_ushort) void; + + /// double ldexp(double x, int exp); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/ldexp.html + pub extern fn ldexp(x: f64, exp: c_int) f64; + + /// float ldexpf(float x, int exp); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/ldexpf.html + pub extern fn ldexpf(x: f32, exp: c_int) f32; + + /// long double ldexpl(long double x, int exp); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/ldexpl.html + pub extern fn ldexpl(__x: c_longdouble, __exponent: c_int) c_longdouble; + + /// ldiv_t ldiv(long numer, long denom); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/ldiv.html + // pub extern fn ldiv(__numer: c_long, __denom: c_long) ldiv_t; + + /// void *lfind(const void *key, const void *base, size_t *nelp, size_t width, int (*compar)(const void *, const void *)); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/lfind.html + // pub extern fn lfind(__key: ?*const anyopaque, __base: ?*const anyopaque, __nmemb: [*c]usize, __size: usize, __compar: __compar_fn_t) ?*anyopaque; + + /// double lgamma(double x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/lgamma.html + pub extern fn lgamma(x: f64) f64; + + /// float lgammaf(float x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/lgammaf.html + pub extern fn lgammaf(x: f32) f32; + + /// long double lgammal(long double x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/lgammal.html + pub extern fn lgammal(x: c_longdouble) c_longdouble; + + /// int link(const char *path1, const char *path2); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/link.html + pub extern fn link(__from: [*c]const u8, __to: [*c]const u8) c_int; + + /// int linkat(int fd1, const char *path1, int fd2, const char *path2, int flag); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/linkat.html + pub extern fn linkat(__fromfd: c_int, __from: [*c]const u8, __tofd: c_int, __to: [*c]const u8, __flags: c_int) c_int; + + /// int lio_listio(int mode, struct aiocb *restrict const list[restrict], int nent, struct sigevent *restrict sig); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/lio_listio.html + // pub extern fn lio_listio(__mode: c_int, noalias __list: [*c]const [*c]struct_aiocb, __nent: c_int, noalias __sig: [*c]struct_sigevent) c_int; + + /// int listen(int socket, int backlog); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/listen.html + pub extern fn listen(socket: c_int, backlog: c_int) c_int; + + /// long long llabs(long long i); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/llabs.html + pub extern fn llabs(x: c_longlong) c_longlong; + + /// lldiv_t lldiv(long long numer, long long denom); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/lldiv.html + // pub extern fn lldiv(__numer: c_longlong, __denom: c_longlong) lldiv_t; + + /// long long llrint(double x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/llrint.html + pub extern fn llrint(x: f64) c_longlong; + + /// long long llrintf(float x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/llrintf.html + pub extern fn llrintf(x: f32) c_longlong; + + /// long long llrintl(long double x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/llrintl.html + pub extern fn llrintl(x: c_longdouble) c_longlong; + + /// long long llround(double x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/llround.html + pub extern fn llround(x: f64) c_longlong; + + /// long long llroundf(float x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/llroundf.html + pub extern fn llroundf(x: f32) c_longlong; + + /// long long llroundl(long double x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/llroundl.html + pub extern fn llroundl(x: c_longdouble) c_longlong; + + /// struct lconv *localeconv(void); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/localeconv.html + pub extern fn localeconv() *struct_lconv; + + /// struct tm *localtime(const time_t *timer); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/localtime.html + // pub extern fn localtime(__timer: [*c]const time_t) [*c]struct_tm; + + /// struct tm *localtime_r(const time_t *restrict timer, struct tm *restrict result); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/localtime_r.html + // pub extern fn localtime_r(noalias __timer: [*c]const time_t, noalias __tp: [*c]struct_tm) [*c]struct_tm; + + /// int lockf(int fildes, int function, off_t size); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/lockf.html + // pub extern fn lockf(__fd: c_int, __cmd: c_int, __len: off_t) c_int; + + /// double log(double x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/log.html + pub extern fn log(x: f64) f64; + + /// double log1p(double x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/log1p.html + pub extern fn log1p(x: f64) f64; + + /// float log1pf(float x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/log1pf.html + pub extern fn log1pf(x: f32) f32; + + /// long double log1pl(long double x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/log1pl.html + pub extern fn log1pl(x: c_longdouble) c_longdouble; + + /// double log2(double x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/log2.html + pub extern fn log2(x: f64) f64; + + /// float log2f(float x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/log2f.html + pub extern fn log2f(x: f32) f32; + + /// long double log2l(long double x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/log2l.html + pub extern fn log2l(x: c_longdouble) c_longdouble; + + /// double log10(double x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/log10.html + pub extern fn log10(x: f64) f64; + + /// float log10f(float x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/log10f.html + pub extern fn log10f(x: f32) f32; + + /// long double log10l(long double x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/log10l.html + pub extern fn log10l(x: c_longdouble) c_longdouble; + + /// double logb(double x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/logb.html + pub extern fn logb(x: f64) f64; + + /// float logbf(float x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/logbf.html + pub extern fn logbf(x: f32) f32; + + /// long double logbl(long double x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/logbl.html + pub extern fn logbl(x: c_longdouble) c_longdouble; + + /// float logf(float x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/logf.html + pub extern fn logf(x: f32) f32; + + /// long double logl(long double x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/logl.html + pub extern fn logl(x: c_longdouble) c_longdouble; + + /// long lrand48(void); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/lrand48.html + pub extern fn lrand48() c_long; + + /// long lrint(double x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/lrint.html + pub extern fn lrint(x: f64) c_long; + + /// long lrintf(float x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/lrintf.html + pub extern fn lrintf(x: f32) c_long; + + /// long lrintl(long double x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/lrintl.html + pub extern fn lrintl(x: c_longdouble) c_long; + + /// long lround(double x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/lround.html + pub extern fn lround(x: f64) c_long; + + /// long lroundf(float x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/lroundf.html + pub extern fn lroundf(x: f32) c_long; + + /// long lroundl(long double x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/lroundl.html + pub extern fn lroundl(x: c_longdouble) c_long; + + /// void *lsearch(const void *key, void *base, size_t *nelp, size_t width, int (*compar)(const void *, const void *)); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/lsearch.html + // pub extern fn lsearch(__key: ?*const anyopaque, __base: ?*anyopaque, __nmemb: [*c]usize, __size: usize, __compar: __compar_fn_t) ?*anyopaque; + + /// off_t lseek(int fildes, off_t offset, int whence); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/lseek.html + pub extern fn lseek(fd: c_int, offset: off_t, whence: c_int) off_t; + + /// int lstat(const char *restrict path, struct stat *restrict buf); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/lstat.html + // pub extern fn lstat(noalias __file: [*c]const u8, noalias __buf: [*c]struct_stat) c_int; + + /// void *malloc(size_t size); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/malloc.html + pub extern fn malloc(size: usize) ?*anyopaque; + + /// int mblen(const char *s, size_t n); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/mblen.html + pub extern fn mblen(__s: [*c]const u8, __n: usize) c_int; + + /// size_t mbrlen(const char *restrict s, size_t n, mbstate_t *restrict ps); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/mbrlen.html + // pub extern fn mbrlen(noalias __s: [*c]const u8, __n: usize, noalias __ps: [*c]mbstate_t) usize; + + /// size_t mbrtowc(wchar_t *restrict pwc, const char *restrict s, size_t n, mbstate_t *restrict ps); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/mbrtowc.html + // pub extern fn mbrtowc(noalias __pwc: [*c]wchar_t, noalias __s: [*c]const u8, __n: usize, noalias __p: [*c]mbstate_t) usize; + + /// int mbsinit(const mbstate_t *ps); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/mbsinit.html + // pub extern fn mbsinit(__ps: [*c]const mbstate_t) c_int; + + /// size_t mbsnrtowcs(wchar_t *restrict dst, const char **restrict src, size_t nmc, size_t len, mbstate_t *restrict ps); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/mbsnrtowcs.html + // pub extern fn mbsnrtowcs(noalias __dst: [*c]wchar_t, noalias __src: [*c][*c]const u8, __nmc: usize, __len: usize, noalias __ps: [*c]mbstate_t) usize; + + /// size_t mbsrtowcs(wchar_t *restrict dst, const char **restrict src, size_t len, mbstate_t *restrict ps); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/mbsrtowcs.html + // pub extern fn mbsrtowcs(noalias __dst: [*c]wchar_t, noalias __src: [*c][*c]const u8, __len: usize, noalias __ps: [*c]mbstate_t) usize; + + /// size_t mbstowcs(wchar_t *restrict pwcs, const char *restrict s, size_t n); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/mbstowcs.html + pub extern fn mbstowcs(noalias __pwcs: [*c]wchar_t, noalias __s: [*c]const u8, __n: usize) usize; + + /// int mbtowc(wchar_t *restrict pwc, const char *restrict s, size_t n); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/mbtowc.html + pub extern fn mbtowc(noalias __pwc: [*c]wchar_t, noalias __s: [*c]const u8, __n: usize) c_int; + + /// void *memccpy(void *restrict s1, const void *restrict s2, int c, size_t n); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/memccpy.html + pub extern fn memccpy(__dest: ?*anyopaque, __src: ?*const anyopaque, __c: c_int, __n: c_ulong) ?*anyopaque; + + /// void *memchr(const void *s, int c, size_t n); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/memchr.html + pub extern fn memchr(__s: ?*const anyopaque, __c: c_int, __n: c_ulong) ?*anyopaque; + + /// int memcmp(const void *s1, const void *s2, size_t n); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/memcmp.html + pub extern fn memcmp(__s1: ?*const anyopaque, __s2: ?*const anyopaque, __n: c_ulong) c_int; + + /// void *memcpy(void *restrict s1, const void *restrict s2, size_t n); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/memcpy.html + pub extern fn memcpy(__dest: ?*anyopaque, __src: ?*const anyopaque, __n: c_ulong) ?*anyopaque; + + /// void *memmove(void *s1, const void *s2, size_t n); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/memmove.html + pub extern fn memmove(__dest: ?*anyopaque, __src: ?*const anyopaque, __n: c_ulong) ?*anyopaque; + + /// void *memset(void *s, int c, size_t n); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/memset.html + pub extern fn memset(__s: ?*anyopaque, __c: c_int, __n: c_ulong) ?*anyopaque; + + /// int mkdir(const char *path, mode_t mode); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/mkdir.html + pub extern fn mkdir(path: [*:0]const u8, __mode: mode_t) c_int; + + /// int mkdirat(int fd, const char *path, mode_t mode); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/mkdirat.html + pub extern fn mkdirat(fd: c_int, path: [*:0]const u8, mode: mode_t) c_int; + + /// char *mkdtemp(char *template); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/mkdtemp.html + pub extern fn mkdtemp(template: [*:0]u8) ?[*:0]u8; + + /// int mkfifo(const char *path, mode_t mode); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/mkfifo.html + pub extern fn mkfifo(path: [*:0]const u8, mode: mode_t) c_int; + + /// int mkfifoat(int fd, const char *path, mode_t mode); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/mkfifoat.html + pub extern fn mkfifoat(fd: c_int, path: [*:0]const u8, mode: mode_t) c_int; + + /// int mknod(const char *path, mode_t mode, dev_t dev); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/mknod.html + // pub extern fn mknod(__path: [*c]const u8, __mode: mode_t, __dev: __dev_t) c_int; + + /// int mknodat(int fd, const char *path, mode_t mode, dev_t dev); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/mknodat.html + // pub extern fn mknodat(__fd: c_int, __path: [*c]const u8, __mode: mode_t, __dev: __dev_t) c_int; + + /// int mkstemp(char *template); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/mkstemp.html + pub extern fn mkstemp(template: [*:0]u8) c_int; + + /// time_t mktime(struct tm *timeptr); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/mktime.html + // pub extern fn mktime(__tp: [*c]struct_tm) time_t; + + /// int mlock(const void *addr, size_t len); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/mlock.html + pub extern fn mlock(__addr: ?*const anyopaque, __len: usize) c_int; + + /// int mlockall(int flags); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/mlockall.html + pub extern fn mlockall(flags: c_int) c_int; + + /// void *mmap(void *addr, size_t len, int prot, int flags, int fildes, off_t off); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/mmap.html + pub extern fn mmap(addr: ?*anyopaque, len: usize, prot: c_int, flags: c_int, fd: c_int, offset: off_t) *allowzero anyopaque; + + /// double modf(double x, double *iptr); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/modf.html + pub extern fn modf(__x: f64, __iptr: [*c]f64) f64; + + /// float modff(float value, float *iptr); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/modff.html + pub extern fn modff(__x: f32, __iptr: [*c]f32) f32; + + /// long double modfl(long double value, long double *iptr); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/modfl.html + pub extern fn modfl(__x: c_longdouble, __iptr: [*c]c_longdouble) c_longdouble; + + /// int mprotect(void *addr, size_t len, int prot); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/mprotect.html + pub extern fn mprotect(__addr: ?*anyopaque, __len: usize, __prot: c_int) c_int; + + /// int mq_close(mqd_t mqdes); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/mq_close.html + // pub extern fn mq_close(__mqdes: mqd_t) c_int; + + /// int mq_getattr(mqd_t mqdes, struct mq_attr *mqstat); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/mq_getattr.html + // pub extern fn mq_getattr(__mqdes: mqd_t, __mqstat: [*c]struct_mq_attr) c_int; + + /// int mq_notify(mqd_t mqdes, const struct sigevent *notification); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/mq_notify.html + // pub extern fn mq_notify(__mqdes: mqd_t, __notification: [*c]const struct_sigevent) c_int; + + /// mqd_t mq_open(const char *name, int oflag, ...); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/mq_open.html + // pub extern fn mq_open(__name: [*c]const u8, __oflag: c_int, ...) mqd_t; + + /// ssize_t mq_receive(mqd_t mqdes, char *msg_ptr, size_t msg_len, unsigned *msg_prio); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/mq_receive.html + // pub extern fn mq_receive(__mqdes: mqd_t, __msg_ptr: [*c]u8, __msg_len: usize, __msg_prio: [*c]c_uint) isize; + + /// int mq_send(mqd_t mqdes, const char *msg_ptr, size_t msg_len, unsigned msg_prio); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/mq_send.html + // pub extern fn mq_send(__mqdes: mqd_t, __msg_ptr: [*c]const u8, __msg_len: usize, __msg_prio: c_uint) c_int; + + /// int mq_setattr(mqd_t mqdes, const struct mq_attr *restrict mqstat, struct mq_attr *restrict omqstat); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/mq_setattr.html + // pub extern fn mq_setattr(__mqdes: mqd_t, noalias __mqstat: [*c]const struct_mq_attr, noalias __omqstat: [*c]struct_mq_attr) c_int; + + /// ssize_t mq_timedreceive(mqd_t mqdes, char *restrict msg_ptr, size_t msg_len, unsigned *restrict msg_prio, const struct timespec *restrict abstime); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/mq_timedreceive.html + // pub extern fn mq_timedreceive(__mqdes: mqd_t, noalias __msg_ptr: [*c]u8, __msg_len: usize, noalias __msg_prio: [*c]c_uint, noalias __abs_timeout: [*c]const struct_timespec) isize; + + /// int mq_timedsend(mqd_t mqdes, const char *msg_ptr, size_t msg_len, unsigned msg_prio, const struct timespec *abstime); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/mq_timedsend.html + // pub extern fn mq_timedsend(__mqdes: mqd_t, __msg_ptr: [*c]const u8, __msg_len: usize, __msg_prio: c_uint, __abs_timeout: [*c]const struct_timespec) c_int; + + /// int mq_unlink(const char *name); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/mq_unlink.html + pub extern fn mq_unlink(name: [*:0]const u8) c_int; + + /// long mrand48(void); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/mrand48.html + pub extern fn mrand48() c_long; + + /// int msgctl(int msqid, int cmd, struct msqid_ds *buf); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/msgctl.html + // pub extern fn msgctl(__msqid: c_int, __cmd: c_int, __buf: [*c]struct_msqid_ds) c_int; + + /// int msgget(key_t key, int msgflg); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/msgget.html + // pub extern fn msgget(__key: key_t, __msgflg: c_int) c_int; + + /// ssize_t msgrcv(int msqid, void *msgp, size_t msgsz, long msgtyp, int msgflg); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/msgrcv.html + pub extern fn msgrcv(__msqid: c_int, __msgp: ?*anyopaque, __msgsz: usize, __msgtyp: c_long, __msgflg: c_int) isize; + + /// int msgsnd(int msqid, const void *msgp, size_t msgsz, int msgflg); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/msgsnd.html + pub extern fn msgsnd(__msqid: c_int, __msgp: ?*const anyopaque, __msgsz: usize, __msgflg: c_int) c_int; + + /// int msync(void *addr, size_t len, int flags); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/msync.html + pub extern fn msync(__addr: ?*anyopaque, __len: usize, __flags: c_int) c_int; + + /// int munlock(const void *addr, size_t len); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/munlock.html + pub extern fn munlock(__addr: ?*const anyopaque, __len: usize) c_int; + + /// int munlockall(void); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/munlockall.html + pub extern fn munlockall() void; + + /// int munmap(void *addr, size_t len); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/munmap.html + pub extern fn munmap(addr: *const anyopaque, len: usize) c_int; + + /// double nan(const char *tagp); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/nan.html + pub extern fn nan(__tagb: [*c]const u8) f64; + + /// float nanf(const char *tagp); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/nanf.html + pub extern fn nanf(__tagb: [*c]const u8) f32; + + /// long double nanl(const char *tagp); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/nanl.html + pub extern fn nanl(__tagb: [*c]const u8) c_longdouble; + + /// int nanosleep(const struct timespec *rqtp, struct timespec *rmtp); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/nanosleep.html + pub extern fn nanosleep(__requested_time: [*c]const struct_timespec, __remaining: [*c]struct_timespec) c_int; + + /// double nearbyint(double x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/nearbyint.html + pub extern fn nearbyint(x: f64) f64; + + /// float nearbyintf(float x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/nearbyintf.html + pub extern fn nearbyintf(x: f32) f32; + + /// long double nearbyintl(long double x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/nearbyintl.html + pub extern fn nearbyintl(x: c_longdouble) c_longdouble; + + /// locale_t newlocale(int category_mask, const char *locale, locale_t base); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/newlocale.html + pub extern fn newlocale(__category_mask: c_int, __locale: [*c]const u8, __base: locale_t) locale_t; + + /// double nextafter(double x, double y); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/nextafter.html + pub extern fn nextafter(x: f64, y: f64) f64; + + /// float nextafterf(float x, float y); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/nextafterf.html + pub extern fn nextafterf(x: f32, y: f32) f32; + + /// long double nextafterl(long double x, long double y); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/nextafterl.html + pub extern fn nextafterl(x: c_longdouble, y: c_longdouble) c_longdouble; + + /// double nexttoward(double x, long double y); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/nexttoward.html + pub extern fn nexttoward(x: f64, y: c_longdouble) f64; + + /// float nexttowardf(float x, long double y); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/nexttowardf.html + pub extern fn nexttowardf(x: f32, y: c_longdouble) f32; + + /// long double nexttowardl(long double x, long double y); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/nexttowardl.html + pub extern fn nexttowardl(x: c_longdouble, y: c_longdouble) c_longdouble; + + /// int nftw(const char *path, int (*fn)(const char *, const struct stat *, int, struct FTW *), int fd_limit, int flags); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/nftw.html + pub const nftw = @compileError("TODO nftw"); + + /// int nice(int incr); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/nice.html + pub extern fn nice(incr: c_int) c_int; + + /// char *nl_langinfo(nl_item item); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/nl_langinfo.html + // pub extern fn nl_langinfo(__item: nl_item) [*c]u8; + + /// char *nl_langinfo_l(nl_item item, locale_t locale); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/nl_langinfo_l.html + // pub extern fn nl_langinfo_l(__item: nl_item, __l: locale_t) [*c]u8; + + /// long nrand48(unsigned short xsubi[3]); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/nrand48.html + pub extern fn nrand48(__xsubi: [*c]c_ushort) c_long; + + /// uint32_t ntohl(uint32_t netlong); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/ntohl.html + pub extern fn ntohl(netlong: u32) u32; + + /// uint16_t ntohs(uint16_t netshort); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/ntohs.html + pub extern fn ntohs(netshort: u16) u16; + + /// int open(const char *path, int oflag, ...); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/open.html + pub extern fn open(__file: [*c]const u8, __oflag: c_int, ...) c_int; + + /// FILE *open_memstream(char **bufp, size_t *sizep); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/open_memstream.html + pub extern fn open_memstream(__bufloc: [*c][*c]u8, __sizeloc: [*c]usize) [*c]FILE; + + /// FILE *open_wmemstream(wchar_t **bufp, size_t *sizep); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/open_wmemstream.html + // pub extern fn open_wmemstream(__bufloc: [*c][*c]wchar_t, __sizeloc: [*c]usize) [*c]__FILE; + + /// int openat(int fd, const char *path, int oflag, ...); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/openat.html + pub extern fn openat(fd: c_int, file: [*:0]const u8, oflag: c_int, ...) c_int; + + /// DIR *opendir(const char *dirname); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/opendir.html + pub extern fn opendir(__name: [*c]const u8) ?*DIR; + + /// void openlog(const char *ident, int logopt, int facility); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/openlog.html + pub extern fn openlog(__ident: [*c]const u8, __option: c_int, __facility: c_int) void; + + /// long pathconf(const char *path, int name); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pathconf.html + pub extern fn pathconf(__path: [*c]const u8, __name: c_int) c_long; + + /// int pause(void); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pause.html + pub extern fn pause() c_int; + + /// int pclose(FILE *stream); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pclose.html + pub extern fn pclose(__stream: [*c]FILE) c_int; + + /// void perror(const char *s); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/perror.html + pub extern fn perror(__s: [*c]const u8) void; + + /// int pipe(int fildes[2]); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pipe.html + pub extern fn pipe(pipefd: *[2]c_int) c_int; + + /// int pipe2(int fildes[2], int flag); + /// https://pubs.opengroup.org/onlinepubs/9799919799/functions/pipe.html + pub extern fn pipe2(pipefd: *[2]c_int, flag: c_int) c_int; + + /// int poll(struct pollfd fds[], nfds_t nfds, int timeout); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/poll.html + pub extern fn poll(fds: [*]struct_pollfd, nfds: nfds_t, timeout: c_int) c_int; + + /// FILE *popen(const char *command, const char *mode); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/popen.html + pub extern fn popen(__command: [*c]const u8, __modes: [*c]const u8) [*c]FILE; + + /// int posix_fadvise(int fd, off_t offset, off_t len, int advice); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/posix_fadvise.html + pub extern fn posix_fadvise(__fd: c_int, __offset: off_t, __len: off_t, __advise: c_int) c_int; + + /// int posix_fallocate(int fd, off_t offset, off_t len); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/posix_fallocate.html + pub extern fn posix_fallocate(__fd: c_int, __offset: off_t, __len: off_t) c_int; + + /// int posix_madvise(void *addr, size_t len, int advice); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/posix_madvise.html + pub extern fn posix_madvise(__addr: ?*anyopaque, __len: usize, __advice: c_int) c_int; + + /// int posix_mem_offset(const void *restrict addr, size_t len, off_t *restrict off, size_t *restrict contig_len, int *restrict fildes); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/posix_mem_offset.html + pub const posix_mem_offset = @compileError("TODO posix_mem_offset"); + + /// int posix_memalign(void **memptr, size_t alignment, size_t size); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/posix_memalign.html + pub extern fn posix_memalign(__memptr: [*c]?*anyopaque, __alignment: usize, __size: usize) c_int; + + /// int posix_openpt(int oflag); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/posix_openpt.html + pub const posix_openpt = @compileError("TODO posix_openpt"); + + /// int posix_spawn(pid_t *restrict pid, const char *restrict path, const posix_spawn_file_actions_t *file_actions, const posix_spawnattr_t *restrict attrp, char *const argv[restrict], char *const envp[restrict]); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/posix_spawn.html + // pub extern fn posix_spawn(noalias __pid: [*c]pid_t, noalias __path: [*c]const u8, noalias __file_actions: [*c]const posix_spawn_file_actions_t, noalias __attrp: [*c]const posix_spawnattr_t, noalias __argv: [*c]const [*c]u8, noalias __envp: [*c]const [*c]u8) c_int; + + /// int posix_spawn_file_actions_addclose(posix_spawn_file_actions_t *file_actions, int fildes); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/posix_spawn_file_actions_addclose.html + // pub extern fn posix_spawn_file_actions_addclose(__file_actions: [*c]posix_spawn_file_actions_t, __fd: c_int) c_int; + + /// int posix_spawn_file_actions_adddup2(posix_spawn_file_actions_t *file_actions, int fildes, int newfildes); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/posix_spawn_file_actions_adddup2.html + // pub extern fn posix_spawn_file_actions_adddup2(__file_actions: [*c]posix_spawn_file_actions_t, __fd: c_int, __newfd: c_int) c_int; + + /// int posix_spawn_file_actions_addopen(posix_spawn_file_actions_t *restrict file_actions, int fildes, const char *restrict path, int oflag, mode_t mode); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/posix_spawn_file_actions_addopen.html + // pub extern fn posix_spawn_file_actions_addopen(noalias __file_actions: [*c]posix_spawn_file_actions_t, __fd: c_int, noalias __path: [*c]const u8, __oflag: c_int, __mode: mode_t) c_int; + + /// int posix_spawn_file_actions_destroy(posix_spawn_file_actions_t *file_actions); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/posix_spawn_file_actions_destroy.html + // pub extern fn posix_spawn_file_actions_destroy(__file_actions: [*c]posix_spawn_file_actions_t) c_int; + + /// int posix_spawn_file_actions_init(posix_spawn_file_actions_t *file_actions); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/posix_spawn_file_actions_init.html + // pub extern fn posix_spawn_file_actions_init(__file_actions: [*c]posix_spawn_file_actions_t) c_int; + + /// int posix_spawnattr_destroy(posix_spawnattr_t *attr); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/posix_spawnattr_destroy.html + // pub extern fn posix_spawnattr_destroy(__attr: [*c]posix_spawnattr_t) c_int; + + /// int posix_spawnattr_getflags(const posix_spawnattr_t *restrict attr, short *restrict flags); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/posix_spawnattr_getflags.html + // pub extern fn posix_spawnattr_getflags(noalias __attr: [*c]const posix_spawnattr_t, noalias __flags: [*c]c_short) c_int; + + /// int posix_spawnattr_getpgroup(const posix_spawnattr_t *restrict attr, pid_t *restrict pgroup); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/posix_spawnattr_getpgroup.html + // pub extern fn posix_spawnattr_getpgroup(noalias __attr: [*c]const posix_spawnattr_t, noalias __pgroup: [*c]pid_t) c_int; + + /// int posix_spawnattr_getschedparam(const posix_spawnattr_t *restrict attr, struct sched_param *restrict schedparam); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/posix_spawnattr_getschedparam.html + // pub extern fn posix_spawnattr_getschedparam(noalias __attr: [*c]const posix_spawnattr_t, noalias __schedparam: [*c]struct_sched_param) c_int; + + /// int posix_spawnattr_getschedpolicy(const posix_spawnattr_t *restrict attr, int *restrict schedpolicy); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/posix_spawnattr_getschedpolicy.html + // pub extern fn posix_spawnattr_getschedpolicy(noalias __attr: [*c]const posix_spawnattr_t, noalias __schedpolicy: [*c]c_int) c_int; + + /// int posix_spawnattr_getsigdefault(const posix_spawnattr_t *restrict attr, sigset_t *restrict sigdefault); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/posix_spawnattr_getsigdefault.html + // pub extern fn posix_spawnattr_getsigdefault(noalias __attr: [*c]const posix_spawnattr_t, noalias __sigdefault: [*c]sigset_t) c_int; + + /// int posix_spawnattr_getsigmask(const posix_spawnattr_t *restrict attr, sigset_t *restrict sigmask); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/posix_spawnattr_getsigmask.html + // pub extern fn posix_spawnattr_getsigmask(noalias __attr: [*c]const posix_spawnattr_t, noalias __sigmask: [*c]sigset_t) c_int; + + /// int posix_spawnattr_init(posix_spawnattr_t *attr); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/posix_spawnattr_init.html + // pub extern fn posix_spawnattr_init(__attr: [*c]posix_spawnattr_t) c_int; + + /// int posix_spawnattr_setflags(posix_spawnattr_t *attr, short flags); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/posix_spawnattr_setflags.html + // pub extern fn posix_spawnattr_setflags(_attr: [*c]posix_spawnattr_t, __flags: c_short) c_int; + + /// int posix_spawnattr_setpgroup(posix_spawnattr_t *attr, pid_t pgroup); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/posix_spawnattr_setpgroup.html + // pub extern fn posix_spawnattr_setpgroup(__attr: [*c]posix_spawnattr_t, __pgroup: pid_t) c_int; + + /// int posix_spawnattr_setschedparam(posix_spawnattr_t *restrict attr, const struct sched_param *restrict schedparam); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/posix_spawnattr_setschedparam.html + // pub extern fn posix_spawnattr_setschedparam(noalias __attr: [*c]posix_spawnattr_t, noalias __schedparam: [*c]const struct_sched_param) c_int; + + /// int posix_spawnattr_setschedpolicy(posix_spawnattr_t *attr, int schedpolicy); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/posix_spawnattr_setschedpolicy.html + // pub extern fn posix_spawnattr_setschedpolicy(__attr: [*c]posix_spawnattr_t, __schedpolicy: c_int) c_int; + + /// int posix_spawnattr_setsigdefault(posix_spawnattr_t *restrict attr, const sigset_t *restrict sigdefault); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/posix_spawnattr_setsigdefault.html + // pub extern fn posix_spawnattr_setsigdefault(noalias __attr: [*c]posix_spawnattr_t, noalias __sigdefault: [*c]const sigset_t) c_int; + + /// int posix_spawnattr_setsigmask(posix_spawnattr_t *restrict attr, const sigset_t *restrict sigmask); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/posix_spawnattr_setsigmask.html + // pub extern fn posix_spawnattr_setsigmask(noalias __attr: [*c]posix_spawnattr_t, noalias __sigmask: [*c]const sigset_t) c_int; + + /// int posix_spawnp(pid_t *restrict pid, const char *restrict file, const posix_spawn_file_actions_t *file_actions, const posix_spawnattr_t *restrict attrp, char *const argv[restrict], char *const envp[restrict]); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/posix_spawnp.html + // pub extern fn posix_spawnp(__pid: [*c]pid_t, __file: [*c]const u8, __file_actions: [*c]const posix_spawn_file_actions_t, __attrp: [*c]const posix_spawnattr_t, __argv: [*c]const [*c]u8, __envp: [*c]const [*c]u8) c_int; + + /// int posix_typed_mem_get_info(int fildes, struct posix_typed_mem_info *info); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/posix_typed_mem_get_info.html + pub const posix_typed_mem_get_info = @compileError("TODO posix_typed_mem_get_info"); + + /// int posix_typed_mem_open(const char *name, int oflag, int tflag); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/posix_typed_mem_open.html + pub const posix_typed_mem_open = @compileError("TODO posix_typed_mem_open"); + + /// double pow(double x, double y); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pow.html + pub extern fn pow(x: f64, y: f64) f64; + + /// float powf(float x, float y); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/powf.html + pub extern fn powf(x: f32, y: f32) f32; + + /// long double powl(long double x, long double y); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/powl.html + pub extern fn powl(x: c_longdouble, y: c_longdouble) c_longdouble; + + /// ssize_t pread(int fildes, void *buf, size_t nbyte, off_t offset); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pread.html + pub extern fn pread(__fd: c_int, __buf: ?*anyopaque, __nbytes: usize, __offset: off_t) isize; + + /// int printf(const char *restrict format, ...); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/printf.html + pub extern fn printf(__format: [*c]const u8, ...) c_int; + + /// int pselect(int nfds, fd_set *restrict readfds, fd_set *restrict writefds, fd_set *restrict errorfds, const struct timespec *restrict timeout, const sigset_t *restrict sigmask); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pselect.html + // pub extern fn pselect(__nfds: c_int, noalias __readfds: [*c]fd_set, noalias __writefds: [*c]fd_set, noalias __exceptfds: [*c]fd_set, noalias __timeout: [*c]const struct_timespec, noalias __sigmask: [*c]const __sigset_t) c_int; + + /// void psiginfo(const siginfo_t *pinfo, const char *message); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/psiginfo.html + // pub extern fn psiginfo(__pinfo: [*c]const siginfo_t, __s: [*c]const u8) void; + + /// void psignal(int signum, const char *message); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/psignal.html + pub extern fn psignal(__sig: c_int, __s: [*c]const u8) void; + + /// int pthread_atfork(void (*prepare)(void), void (*parent)(void), void (*child)(void)); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pthread_atfork.html + pub extern fn pthread_atfork(__prepare: ?*const fn () callconv(.C) void, __parent: ?*const fn () callconv(.C) void, __child: ?*const fn () callconv(.C) void) c_int; + + /// int pthread_attr_destroy(pthread_attr_t *attr); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pthread_attr_destroy.html + pub extern fn pthread_attr_destroy(attr: *pthread_attr_t) c_int; + + /// int pthread_attr_getdetachstate(const pthread_attr_t *attr, int *detachstate); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pthread_attr_getdetachstate.html + // pub extern fn pthread_attr_getdetachstate(__attr: [*c]const pthread_attr_t, __detachstate: [*c]c_int) c_int; + + /// int pthread_attr_getguardsize(const pthread_attr_t *restrict attr, size_t *restrict guardsize); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pthread_attr_getguardsize.html + // pub extern fn pthread_attr_getguardsize(__attr: [*c]const pthread_attr_t, __guardsize: [*c]usize) c_int; + + /// int pthread_attr_getinheritsched(const pthread_attr_t *restrict attr, int *restrict inheritsched); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pthread_attr_getinheritsched.html + // pub extern fn pthread_attr_getinheritsched(noalias __attr: [*c]const pthread_attr_t, noalias __inherit: [*c]c_int) c_int; + + /// int pthread_attr_getschedparam(const pthread_attr_t *restrict attr, struct sched_param *restrict param); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pthread_attr_getschedparam.html + // pub extern fn pthread_attr_getschedparam(noalias __attr: [*c]const pthread_attr_t, noalias __param: [*c]struct_sched_param) c_int; + + /// int pthread_attr_getschedpolicy(const pthread_attr_t *restrict attr, int *restrict policy); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pthread_attr_getschedpolicy.html + // pub extern fn pthread_attr_getschedpolicy(noalias __attr: [*c]const pthread_attr_t, noalias __policy: [*c]c_int) c_int; + + /// int pthread_attr_getscope(const pthread_attr_t *restrict attr, int *restrict contentionscope); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pthread_attr_getscope.html + // pub extern fn pthread_attr_getscope(noalias __attr: [*c]const pthread_attr_t, noalias __scope: [*c]c_int) c_int; + + /// int pthread_attr_getstack(const pthread_attr_t *restrict attr, void **restrict stackaddr, size_t *restrict stacksize); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pthread_attr_getstack.html + // pub extern fn pthread_attr_getstack(noalias __attr: [*c]const pthread_attr_t, noalias __stackaddr: [*c]?*anyopaque, noalias __stacksize: [*c]usize) c_int; + + /// int pthread_attr_getstacksize(const pthread_attr_t *restrict attr, size_t *restrict stacksize); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pthread_attr_getstacksize.html + // pub extern fn pthread_attr_getstacksize(noalias __attr: [*c]const pthread_attr_t, noalias __stacksize: [*c]usize) c_int; + + /// int pthread_attr_init(pthread_attr_t *attr); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pthread_attr_init.html + pub extern fn pthread_attr_init(attr: *pthread_attr_t) c_int; + + /// int pthread_attr_setdetachstate(pthread_attr_t *attr, int detachstate); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pthread_attr_setdetachstate.html + // pub extern fn pthread_attr_setdetachstate(__attr: [*c]pthread_attr_t, __detachstate: c_int) c_int; + + /// int pthread_attr_setguardsize(pthread_attr_t *attr, size_t guardsize); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pthread_attr_setguardsize.html + pub extern fn pthread_attr_setguardsize(attr: *pthread_attr_t, guardsize: usize) c_int; + + /// int pthread_attr_setinheritsched(pthread_attr_t *attr, int inheritsched); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pthread_attr_setinheritsched.html + // pub extern fn pthread_attr_setinheritsched(__attr: [*c]pthread_attr_t, __inherit: c_int) c_int; + + /// int pthread_attr_setschedparam(pthread_attr_t *restrict attr, const struct sched_param *restrict param); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pthread_attr_setschedparam.html + // pub extern fn pthread_attr_setschedparam(noalias __attr: [*c]pthread_attr_t, noalias __param: [*c]const struct_sched_param) c_int; + + /// int pthread_attr_setschedpolicy(pthread_attr_t *attr, int policy); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pthread_attr_setschedpolicy.html + // pub extern fn pthread_attr_setschedpolicy(__attr: [*c]pthread_attr_t, __policy: c_int) c_int; + + /// int pthread_attr_setscope(pthread_attr_t *attr, int contentionscope); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pthread_attr_setscope.html + // pub extern fn pthread_attr_setscope(__attr: [*c]pthread_attr_t, __scope: c_int) c_int; + + /// int pthread_attr_setstack(pthread_attr_t *attr, void *stackaddr, size_t stacksize); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pthread_attr_setstack.html + // pub extern fn pthread_attr_setstack(__attr: [*c]pthread_attr_t, __stackaddr: ?*anyopaque, __stacksize: usize) c_int; + + /// int pthread_attr_setstacksize(pthread_attr_t *attr, size_t stacksize); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pthread_attr_setstacksize.html + pub extern fn pthread_attr_setstacksize(attr: *pthread_attr_t, stacksize: usize) c_int; + + /// int pthread_barrier_destroy(pthread_barrier_t *barrier); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pthread_barrier_destroy.html + // pub extern fn pthread_barrier_destroy(__barrier: [*c]pthread_barrier_t) c_int; + + /// int pthread_barrier_init(pthread_barrier_t *restrict barrier, const pthread_barrierattr_t *restrict attr, unsigned count); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pthread_barrier_init.html + // pub extern fn pthread_barrier_init(noalias __barrier: [*c]pthread_barrier_t, noalias __attr: [*c]const pthread_barrierattr_t, __count: c_uint) c_int; + + /// int pthread_barrier_wait(pthread_barrier_t *barrier); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pthread_barrier_wait.html + // pub extern fn pthread_barrier_wait(__barrier: [*c]pthread_barrier_t) c_int; + + /// int pthread_barrierattr_destroy(pthread_barrierattr_t *attr); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pthread_barrierattr_destroy.html + // pub extern fn pthread_barrierattr_destroy(__attr: [*c]pthread_barrierattr_t) c_int; + + /// int pthread_barrierattr_getpshared(const pthread_barrierattr_t *restrict attr, int *restrict pshared); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pthread_barrierattr_getpshared.html + // pub extern fn pthread_barrierattr_getpshared(noalias __attr: [*c]const pthread_barrierattr_t, noalias __pshared: [*c]c_int) c_int; + + /// int pthread_barrierattr_init(pthread_barrierattr_t *attr); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pthread_barrierattr_init.html + // pub extern fn pthread_barrierattr_init(__attr: [*c]pthread_barrierattr_t) c_int; + + /// int pthread_barrierattr_setpshared(pthread_barrierattr_t *attr, int pshared); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pthread_barrierattr_setpshared.html + // pub extern fn pthread_barrierattr_setpshared(__attr: [*c]pthread_barrierattr_t, __pshared: c_int) c_int; + + /// int pthread_cancel(pthread_t thread); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pthread_cancel.html + pub extern fn pthread_cancel(thread: pthread_t) c_int; + + /// void pthread_cleanup_pop(int execute); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pthread_cleanup_pop.html + pub const pthread_cleanup_pop = @compileError("TODO pthread_cleanup_pop"); + + /// void pthread_cleanup_push(void (*routine)(void*), void *arg); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pthread_cleanup_push.html + pub const pthread_cleanup_push = @compileError("TODO pthread_cleanup_push"); + + /// int pthread_cond_broadcast(pthread_cond_t *cond); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pthread_cond_broadcast.html + pub extern fn pthread_cond_broadcast(cond: *pthread_cond_t) c_int; + + /// int pthread_cond_destroy(pthread_cond_t *cond); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pthread_cond_destroy.html + pub extern fn pthread_cond_destroy(cond: *pthread_cond_t) c_int; + + /// int pthread_cond_init(pthread_cond_t *restrict cond, const pthread_condattr_t *restrict attr); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pthread_cond_init.html + pub extern fn pthread_cond_init(noalias cond: *pthread_cond_t, noalias attr: ?*const pthread_condattr_t) c_int; + + /// int pthread_cond_signal(pthread_cond_t *cond); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pthread_cond_signal.html + pub extern fn pthread_cond_signal(cond: *pthread_cond_t) c_int; + + /// int pthread_cond_timedwait(pthread_cond_t *restrict cond, pthread_mutex_t *restrict mutex, const struct timespec *restrict abstime); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pthread_cond_timedwait.html + pub extern fn pthread_cond_timedwait(noalias cond: *pthread_cond_t, noalias mutex: *pthread_mutex_t, noalias abstime: *const struct_timespec) c_int; + + /// int pthread_cond_wait(pthread_cond_t *restrict cond, pthread_mutex_t *restrict mutex); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pthread_cond_wait.html + pub extern fn pthread_cond_wait(noalias cond: *pthread_cond_t, noalias mutex: *pthread_mutex_t) c_int; + + /// int pthread_condattr_destroy(pthread_condattr_t *attr); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pthread_condattr_destroy.html + pub extern fn pthread_condattr_destroy(attr: *pthread_condattr_t) c_int; + + /// int pthread_condattr_getclock(const pthread_condattr_t *restrict attr, clockid_t *restrict clock_id); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pthread_condattr_getclock.html + // pub extern fn pthread_condattr_getclock(noalias __attr: [*c]const pthread_condattr_t, noalias __clock_id: [*c]__clockid_t) c_int; + + /// int pthread_condattr_getpshared(const pthread_condattr_t *restrict attr, int *restrict pshared); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pthread_condattr_getpshared.html + // pub extern fn pthread_condattr_getpshared(noalias __attr: [*c]const pthread_condattr_t, noalias __pshared: [*c]c_int) c_int; + + /// int pthread_condattr_init(pthread_condattr_t *attr); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pthread_condattr_init.html + pub extern fn pthread_condattr_init(attr: *pthread_condattr_t) c_int; + + /// int pthread_condattr_setclock(pthread_condattr_t *attr, clockid_t clock_id); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pthread_condattr_setclock.html + // pub extern fn pthread_condattr_setclock(__attr: [*c]pthread_condattr_t, __clock_id: __clockid_t) c_int; + + /// int pthread_condattr_setpshared(pthread_condattr_t *attr, int pshared); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pthread_condattr_setpshared.html + // pub extern fn pthread_condattr_setpshared(__attr: [*c]pthread_condattr_t, __pshared: c_int) c_int; + + /// int pthread_create(pthread_t *restrict thread, const pthread_attr_t *restrict attr, void *(*start_routine)(void*), void *restrict arg); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pthread_create.html + pub extern fn pthread_create(noalias newthread: *pthread_t, noalias attr: *const pthread_attr_t, start_routine: *const fn (*anyopaque) callconv(.c) ?*anyopaque, noalias arg: *anyopaque) c_int; + + /// int pthread_detach(pthread_t thread); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pthread_detach.html + pub extern fn pthread_detach(thread: pthread_t) c_int; + + /// int pthread_equal(pthread_t t1, pthread_t t2); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pthread_equal.html + pub extern fn pthread_equal(thread1: pthread_t, thread2: pthread_t) c_int; + + /// void pthread_exit(void *value_ptr); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pthread_exit.html + pub extern fn pthread_exit(__retval: ?*anyopaque) noreturn; + + /// int pthread_getconcurrency(void); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pthread_getconcurrency.html + pub extern fn pthread_getconcurrency() c_int; + + /// int pthread_getcpuclockid(pthread_t thread_id, clockid_t *clock_id); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pthread_getcpuclockid.html + // pub extern fn pthread_getcpuclockid(__thread_id: pthread_t, __clock_id: [*c]__clockid_t) c_int; + + /// int pthread_getschedparam(pthread_t thread, int *restrict policy, struct sched_param *restrict param); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pthread_getschedparam.html + // pub extern fn pthread_getschedparam(__target_thread: pthread_t, noalias __policy: [*c]c_int, noalias __param: [*c]struct_sched_param) c_int; + + /// void *pthread_getspecific(pthread_key_t key); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pthread_getspecific.html + // pub extern fn pthread_getspecific(__key: pthread_key_t) ?*anyopaque; + + /// int pthread_join(pthread_t thread, void **value_ptr); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pthread_join.html + pub extern fn pthread_join(thread: pthread_t, retval: ?*?*anyopaque) c_int; + + /// int pthread_key_create(pthread_key_t *key, void (*destructor)(void*)); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pthread_key_create.html + // pub extern fn pthread_key_create(__key: [*c]pthread_key_t, __destr_function: ?*const fn (?*anyopaque) callconv(.C) void) c_int; + + /// int pthread_key_delete(pthread_key_t key); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pthread_key_delete.html + // pub extern fn pthread_key_delete(__key: pthread_key_t) c_int; + + /// int pthread_kill(pthread_t thread, int sig); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pthread_kill.html + pub extern fn pthread_kill(thread: pthread_t, sig: c_int) c_int; + + /// int pthread_mutex_consistent(pthread_mutex_t *mutex); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pthread_mutex_consistent.html + // pub extern fn pthread_mutex_consistent(__mutex: [*c]pthread_mutex_t) c_int; + + /// int pthread_mutex_destroy(pthread_mutex_t *mutex); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pthread_mutex_destroy.html + pub extern fn pthread_mutex_destroy(mutex: *pthread_mutex_t) c_int; + + /// int pthread_mutex_getprioceiling(const pthread_mutex_t *restrict mutex, int *restrict prioceiling); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pthread_mutex_getprioceiling.html + // pub extern fn pthread_mutex_getprioceiling(noalias __mutex: [*c]const pthread_mutex_t, noalias __prioceiling: [*c]c_int) c_int; + + /// int pthread_mutex_init(pthread_mutex_t *restrict mutex, const pthread_mutexattr_t *restrict attr); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pthread_mutex_init.html + pub extern fn pthread_mutex_init(mutex: *pthread_mutex_t, attr: ?*const pthread_mutexattr_t) c_int; + + /// int pthread_mutex_lock(pthread_mutex_t *mutex); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pthread_mutex_lock.html + pub extern fn pthread_mutex_lock(mutex: *pthread_mutex_t) c_int; + + /// int pthread_mutex_setprioceiling(pthread_mutex_t *restrict mutex, int prioceiling, int *restrict old_ceiling); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pthread_mutex_setprioceiling.html + // pub extern fn pthread_mutex_setprioceiling(noalias __mutex: [*c]pthread_mutex_t, __prioceiling: c_int, noalias __old_ceiling: [*c]c_int) c_int; + + /// int pthread_mutex_timedlock(pthread_mutex_t *restrict mutex, const struct timespec *restrict abstime); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pthread_mutex_timedlock.html + // pub extern fn pthread_mutex_timedlock(noalias __mutex: [*c]pthread_mutex_t, noalias __abstime: [*c]const struct_timespec) c_int; + + /// int pthread_mutex_trylock(pthread_mutex_t *mutex); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pthread_mutex_trylock.html + pub extern fn pthread_mutex_trylock(mutex: *pthread_mutex_t) c_int; + + /// int pthread_mutex_unlock(pthread_mutex_t *mutex); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pthread_mutex_unlock.html + pub extern fn pthread_mutex_unlock(mutex: *pthread_mutex_t) c_int; + + /// int pthread_mutexattr_destroy(pthread_mutexattr_t *attr); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pthread_mutexattr_destroy.html + pub extern fn pthread_mutexattr_destroy(attr: *pthread_mutexattr_t) c_int; + + /// int pthread_mutexattr_getprioceiling(const pthread_mutexattr_t *restrict attr, int *restrict prioceiling); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pthread_mutexattr_getprioceiling.html + // pub extern fn pthread_mutexattr_getprioceiling(noalias __attr: [*c]const pthread_mutexattr_t, noalias __prioceiling: [*c]c_int) c_int; + + /// int pthread_mutexattr_getprotocol(const pthread_mutexattr_t *restrict attr, int *restrict protocol); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pthread_mutexattr_getprotocol.html + // pub extern fn pthread_mutexattr_getprotocol(noalias __attr: [*c]const pthread_mutexattr_t, noalias __protocol: [*c]c_int) c_int; + + /// int pthread_mutexattr_getpshared(const pthread_mutexattr_t *restrict attr, int *restrict pshared); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pthread_mutexattr_getpshared.html + // pub extern fn pthread_mutexattr_getpshared(noalias __attr: [*c]const pthread_mutexattr_t, noalias __pshared: [*c]c_int) c_int; + + /// int pthread_mutexattr_getrobust(const pthread_mutexattr_t *restrict attr, int *restrict robust); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pthread_mutexattr_getrobust.html + // pub extern fn pthread_mutexattr_getrobust(__attr: [*c]const pthread_mutexattr_t, __robustness: [*c]c_int) c_int; + + /// int pthread_mutexattr_gettype(const pthread_mutexattr_t *restrict attr, int *restrict type); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pthread_mutexattr_gettype.html + // pub extern fn pthread_mutexattr_gettype(noalias __attr: [*c]const pthread_mutexattr_t, noalias __kind: [*c]c_int) c_int; + + /// int pthread_mutexattr_init(pthread_mutexattr_t *attr); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pthread_mutexattr_init.html + pub extern fn pthread_mutexattr_init(attr: *pthread_mutexattr_t) c_int; + + /// int pthread_mutexattr_setprioceiling(pthread_mutexattr_t *attr, int prioceiling); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pthread_mutexattr_setprioceiling.html + // pub extern fn pthread_mutexattr_setprioceiling(__attr: [*c]pthread_mutexattr_t, __prioceiling: c_int) c_int; + + /// int pthread_mutexattr_setprotocol(pthread_mutexattr_t *attr, int protocol); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pthread_mutexattr_setprotocol.html + // pub extern fn pthread_mutexattr_setprotocol(__attr: [*c]pthread_mutexattr_t, __protocol: c_int) c_int; + + /// int pthread_mutexattr_setpshared(pthread_mutexattr_t *attr, int pshared); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pthread_mutexattr_setpshared.html + // pub extern fn pthread_mutexattr_setpshared(__attr: [*c]pthread_mutexattr_t, __pshared: c_int) c_int; + + /// int pthread_mutexattr_setrobust(pthread_mutexattr_t *attr, int robust); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pthread_mutexattr_setrobust.html + // pub extern fn pthread_mutexattr_setrobust(__attr: [*c]pthread_mutexattr_t, __robustness: c_int) c_int; + + /// int pthread_mutexattr_settype(pthread_mutexattr_t *attr, int type); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pthread_mutexattr_settype.html + // pub extern fn pthread_mutexattr_settype(__attr: [*c]pthread_mutexattr_t, __kind: c_int) c_int; + + /// int pthread_once(pthread_once_t *once_control, void (*init_routine)(void)); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pthread_once.html + // // pub extern fn pthread_once(__once_control: [*c]pthread_once_t, __init_routine: ?*const fn () callconv(.C) void) c_int; + + /// int pthread_rwlock_destroy(pthread_rwlock_t *rwlock); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pthread_rwlock_destroy.html + pub extern fn pthread_rwlock_destroy(rwlock: *pthread_rwlock_t) c_int; + + /// int pthread_rwlock_init(pthread_rwlock_t *restrict rwlock, const pthread_rwlockattr_t *restrict attr); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pthread_rwlock_init.html + pub extern fn pthread_rwlock_init(noalias rwlock: *pthread_rwlock_t, noalias attr: ?*const pthread_rwlockattr_t) c_int; + + /// int pthread_rwlock_rdlock(pthread_rwlock_t *rwlock); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pthread_rwlock_rdlock.html + pub extern fn pthread_rwlock_rdlock(rwlock: *pthread_rwlock_t) c_int; + + /// int pthread_rwlock_timedrdlock(pthread_rwlock_t *restrict rwlock, const struct timespec *restrict abstime); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pthread_rwlock_timedrdlock.html + pub extern fn pthread_rwlock_timedrdlock(noalias rwlock: *pthread_rwlock_t, noalias abstime: *const struct_timespec) c_int; + + /// int pthread_rwlock_timedwrlock(pthread_rwlock_t *restrict rwlock, const struct timespec *restrict abstime); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pthread_rwlock_timedwrlock.html + pub extern fn pthread_rwlock_timedwrlock(noalias rwlock: *pthread_rwlock_t, noalias abstime: *const struct_timespec) c_int; + + /// int pthread_rwlock_tryrdlock(pthread_rwlock_t *rwlock); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pthread_rwlock_tryrdlock.html + pub extern fn pthread_rwlock_tryrdlock(rwlock: *pthread_rwlock_t) c_int; + + /// int pthread_rwlock_trywrlock(pthread_rwlock_t *rwlock); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pthread_rwlock_trywrlock.html + pub extern fn pthread_rwlock_trywrlock(rwlock: *pthread_rwlock_t) c_int; + + /// int pthread_rwlock_unlock(pthread_rwlock_t *rwlock); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pthread_rwlock_unlock.html + pub extern fn pthread_rwlock_unlock(rwlock: *pthread_rwlock_t) c_int; + + /// int pthread_rwlock_wrlock(pthread_rwlock_t *rwlock); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pthread_rwlock_wrlock.html + pub extern fn pthread_rwlock_wrlock(rwlock: *pthread_rwlock_t) c_int; + + /// int pthread_rwlockattr_destroy(pthread_rwlockattr_t *attr); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pthread_rwlockattr_destroy.html + // pub extern fn pthread_rwlockattr_destroy(__attr: [*c]pthread_rwlockattr_t) c_int; + + /// int pthread_rwlockattr_getpshared(const pthread_rwlockattr_t *restrict attr, int *restrict pshared); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pthread_rwlockattr_getpshared.html + // pub extern fn pthread_rwlockattr_getpshared(noalias __attr: [*c]const pthread_rwlockattr_t, noalias __pshared: [*c]c_int) c_int; + + /// int pthread_rwlockattr_init(pthread_rwlockattr_t *attr); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pthread_rwlockattr_init.html + // pub extern fn pthread_rwlockattr_init(__attr: [*c]pthread_rwlockattr_t) c_int; + + /// int pthread_rwlockattr_setpshared(pthread_rwlockattr_t *attr, int pshared); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pthread_rwlockattr_setpshared.html + // pub extern fn pthread_rwlockattr_setpshared(__attr: [*c]pthread_rwlockattr_t, __pshared: c_int) c_int; + + /// pthread_t pthread_self(void); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pthread_self.html + pub extern fn pthread_self() pthread_t; + + /// int pthread_setcancelstate(int state, int *oldstate); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pthread_setcancelstate.html + pub extern fn pthread_setcancelstate(__state: c_int, __oldstate: [*c]c_int) c_int; + + /// int pthread_setcanceltype(int type, int *oldtype); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pthread_setcanceltype.html + pub extern fn pthread_setcanceltype(__type: c_int, __oldtype: [*c]c_int) c_int; + + /// int pthread_setconcurrency(int new_level); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pthread_setconcurrency.html + pub const pthread_setconcurrency = @compileError("TODO pthread_setconcurrency"); + + /// int pthread_setschedparam(pthread_t thread, int policy, const struct sched_param *param); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pthread_setschedparam.html + // pub extern fn pthread_setschedparam(__target_thread: pthread_t, __policy: c_int, __param: [*c]const struct_sched_param) c_int; + + /// int pthread_setschedprio(pthread_t thread, int prio); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pthread_setschedprio.html + pub extern fn pthread_setschedprio(__target_thread: pthread_t, __prio: c_int) c_int; + + /// int pthread_setspecific(pthread_key_t key, const void *value); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pthread_setspecific.html + // pub extern fn pthread_setspecific(__key: pthread_key_t, __pointer: ?*const anyopaque) c_int; + + /// int pthread_sigmask(int how, const sigset_t *restrict set, sigset_t *restrict oset); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pthread_sigmask.html + // pub extern fn pthread_sigmask(__how: c_int, noalias __newmask: [*c]const __sigset_t, noalias __oldmask: [*c]__sigset_t) c_int; + + /// int pthread_spin_destroy(pthread_spinlock_t *lock); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pthread_spin_destroy.html + // pub extern fn pthread_spin_destroy(__lock: [*c]volatile pthread_spinlock_t) c_int; + + /// int pthread_spin_init(pthread_spinlock_t *lock, int pshared); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pthread_spin_init.html + // pub extern fn pthread_spin_init(__lock: [*c]volatile pthread_spinlock_t, __pshared: c_int) c_int; + + /// int pthread_spin_lock(pthread_spinlock_t *lock); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pthread_spin_lock.html + // pub extern fn pthread_spin_lock(__lock: [*c]volatile pthread_spinlock_t) c_int; + + /// int pthread_spin_trylock(pthread_spinlock_t *lock); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pthread_spin_trylock.html + // pub extern fn pthread_spin_trylock(__lock: [*c]volatile pthread_spinlock_t) c_int; + + /// int pthread_spin_unlock(pthread_spinlock_t *lock); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pthread_spin_unlock.html + // pub extern fn pthread_spin_unlock(__lock: [*c]volatile pthread_spinlock_t) c_int; + + /// void pthread_testcancel(void); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pthread_testcancel.html + pub extern fn pthread_testcancel() void; + + /// char *ptsname(int fildes); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/ptsname.html + pub const ptsname = @compileError("TODO ptsname"); + + /// int putc(int c, FILE *stream); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/putc.html + pub extern fn putc(__c: c_int, __stream: [*c]FILE) c_int; + + /// int putc_unlocked(int c, FILE *stream); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/putc_unlocked.html + pub extern fn putc_unlocked(__c: c_int, __stream: [*c]FILE) c_int; + + /// int putchar(int c); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/putchar.html + pub extern fn putchar(c: c_int) c_int; + + /// int putchar_unlocked(int c); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/putchar_unlocked.html + pub extern fn putchar_unlocked(c: c_int) c_int; + + /// int putenv(char *string); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/putenv.html + pub extern fn putenv(__string: [*c]u8) c_int; + + /// int putmsg(int fildes, const struct strbuf *ctlptr, const struct strbuf *dataptr, int flags); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/putmsg.html + pub const putmsg = @compileError("TODO putmsg"); + + /// int putpmsg(int fildes, const struct strbuf *ctlptr, const struct strbuf *dataptr, int band, int flags); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/putpmsg.html + pub const putpmsg = @compileError("TODO putpmsg"); + + /// int puts(const char *s); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/puts.html + pub extern fn puts(__s: [*c]const u8) c_int; + + /// struct utmpx *pututxline(const struct utmpx *utmpx); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pututxline.html + pub extern fn pututxline(__utmpx: [*c]const struct_utmpx) [*c]struct_utmpx; + + /// wint_t putwc(wchar_t wc, FILE *stream); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/putwc.html + // pub extern fn putwc(__wc: wchar_t, __stream: [*c]__FILE) wint_t; + + /// wint_t putwchar(wchar_t wc); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/putwchar.html + pub extern fn putwchar(wc: wchar_t) wint_t; + + /// ssize_t pwrite(int fildes, const void *buf, size_t nbyte, off_t offset); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pwrite.html + pub extern fn pwrite(__fd: c_int, __buf: ?*const anyopaque, __n: usize, __offset: off_t) isize; + + /// void qsort(void *base, size_t nel, size_t width, int (*compar)(const void *, const void *)); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/qsort.html + // pub extern fn qsort(__base: ?*anyopaque, __nmemb: usize, __size: usize, __compar: __compar_fn_t) void; + + /// int raise(int sig); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/raise.html + pub extern fn raise(sig: c_int) c_int; + + /// int rand(void); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/rand.html + pub extern fn rand() c_int; + + /// int rand_r(unsigned *seed); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/rand_r.html + pub extern fn rand_r(__seed: [*c]c_uint) c_int; + + /// long random(void); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/random.html + pub extern fn random() c_long; + + /// ssize_t read(int fildes, void *buf, size_t nbyte); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/read.html + pub extern fn read(fd: c_int, buf: [*]u8, count: usize) isize; + + /// struct dirent *readdir(DIR *dirp); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/readdir.html + // pub extern fn readdir(__dirp: ?*DIR) [*c]struct_dirent; + + /// int readdir_r(DIR *restrict dirp, struct dirent *restrict entry, struct dirent **restrict result); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/readdir_r.html + // pub extern fn readdir_r(noalias __dirp: ?*DIR, noalias __entry: [*c]struct_dirent, noalias __result: [*c][*c]struct_dirent) c_int; + + /// ssize_t readlink(const char *restrict path, char *restrict buf, size_t bufsize); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/readlink.html + pub extern fn readlink(noalias path: [*:0]const u8, noalias buf: [*]u8, len: usize) isize; + + /// ssize_t readlinkat(int fd, const char *restrict path, char *restrict buf, size_t bufsize); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/readlinkat.html + pub extern fn readlinkat(fd: c_int, noalias path: [*:0]const u8, noalias buf: [*]u8, len: usize) isize; + + /// ssize_t readv(int fildes, const struct iovec *iov, int iovcnt); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/readv.html + pub extern fn readv(fd: c_int, iovec: [*]const struct_iovec, count: c_int) isize; + + /// void *realloc(void *ptr, size_t size); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/realloc.html + pub extern fn realloc(__ptr: ?*anyopaque, __size: c_ulong) ?*anyopaque; + + /// char *realpath(const char *restrict file_name, char *restrict resolved_name); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/realpath.html + pub extern fn realpath(noalias __name: [*c]const u8, noalias __resolved: [*c]u8) [*c]u8; + + /// ssize_t recv(int socket, void *buffer, size_t length, int flags); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/recv.html + pub extern fn recv(fd: c_int, buffer: [*]u8, length: usize, flags: c_int) isize; + + /// ssize_t recvfrom(int socket, void *restrict buffer, size_t length, int flags, struct sockaddr *restrict address, socklen_t *restrict address_len); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/recvfrom.html + pub extern fn recvfrom(__fd: c_int, noalias __buf: ?*anyopaque, __n: usize, __flags: c_int, noalias __addr: [*c]struct_sockaddr, noalias __addr_len: [*c]socklen_t) isize; + + /// ssize_t recvmsg(int socket, struct msghdr *message, int flags); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/recvmsg.html + // pub extern fn recvmsg(__fd: c_int, __message: [*c]struct_msghdr, __flags: c_int) isize; + + /// int regcomp(regex_t *restrict preg, const char *restrict pattern, int cflags); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/regcomp.html + // pub extern fn regcomp(noalias __preg: ?*regex_t, noalias __pattern: [*c]const u8, __cflags: c_int) c_int; + + /// size_t regerror(int errcode, const regex_t *restrict preg, char *restrict errbuf, size_t errbuf_size); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/regerror.html + // pub extern fn regerror(__errcode: c_int, noalias __preg: ?*const regex_t, noalias __errbuf: [*c]u8, __errbuf_size: usize) usize; + + /// int regexec(const regex_t *restrict preg, const char *restrict string, size_t nmatch, regmatch_t pmatch[restrict], int eflags); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/regexec.html + // pub extern fn regexec(noalias __preg: ?*const regex_t, noalias __String: [*c]const u8, __nmatch: usize, noalias __pmatch: [*c]regmatch_t, __eflags: c_int) c_int; + + /// void regfree(regex_t *preg); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/regfree.html + // pub extern fn regfree(__preg: ?*regex_t) void; + + /// double remainder(double x, double y); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/remainder.html + pub extern fn remainder(x: f64, y: f64) f64; + + /// float remainderf(float x, float y); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/remainderf.html + pub extern fn remainderf(x: f32, y: f32) f32; + + /// long double remainderl(long double x, long double y); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/remainderl.html + pub extern fn remainderl(x: c_longdouble, y: c_longdouble) c_longdouble; + + /// int remove(const char *path); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/remove.html + pub extern fn remove(__filename: [*c]const u8) c_int; + + /// void remque(void *element); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/remque.html + pub extern fn remque(__elem: ?*anyopaque) void; + + /// double remquo(double x, double y, int *quo); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/remquo.html + pub extern fn remquo(__x: f64, __y: f64, __quo: [*c]c_int) f64; + + /// float remquof(float x, float y, int *quo); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/remquof.html + pub extern fn remquof(__x: f32, __y: f32, __quo: [*c]c_int) f32; + + /// long double remquol(long double x, long double y, int *quo); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/remquol.html + pub extern fn remquol(__x: c_longdouble, __y: c_longdouble, __quo: [*c]c_int) c_longdouble; + + /// int rename(const char *old, const char *new); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/rename.html + pub extern fn rename(__old: [*c]const u8, __new: [*c]const u8) c_int; + + /// int renameat(int oldfd, const char *old, int newfd, const char *new); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/renameat.html + pub extern fn renameat(oldfd: c_int, old: [*:0]const u8, newfd: c_int, new: [*:0]const u8) c_int; + + /// void rewind(FILE *stream); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/rewind.html + pub extern fn rewind(__stream: [*c]FILE) void; + + /// void rewinddir(DIR *dirp); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/rewinddir.html + pub extern fn rewinddir(__dirp: ?*DIR) void; + + /// double rint(double x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/rint.html + pub extern fn rint(x: f64) f64; + + /// float rintf(float x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/rintf.html + pub extern fn rintf(x: f32) f32; + + /// long double rintl(long double x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/rintl.html + pub extern fn rintl(x: c_longdouble) c_longdouble; + + /// int rmdir(const char *path); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/rmdir.html + pub extern fn rmdir(path: [*:0]const u8) c_int; + + /// double round(double x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/round.html + pub extern fn round(x: f64) f64; + + /// float roundf(float x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/roundf.html + pub extern fn roundf(x: f32) f32; + + /// long double roundl(long double x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/roundl.html + pub extern fn roundl(x: c_longdouble) c_longdouble; + + /// double scalbln(double x, long n); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/scalbln.html + pub extern fn scalbln(x: f64, n: c_long) f64; + + /// float scalblnf(float x, long n); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/scalblnf.html + pub extern fn scalblnf(x: f32, n: c_long) f32; + + /// long double scalblnl(long double x, long n); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/scalblnl.html + pub extern fn scalblnl(x: c_longdouble, n: c_long) c_longdouble; + + /// double scalbn(double x, int n); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/scalbn.html + pub extern fn scalbn(x: f64, n: c_int) f64; + + /// float scalbnf(float x, int n); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/scalbnf.html + pub extern fn scalbnf(x: f32, n: c_int) f32; + + /// long double scalbnl(long double x, int n); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/scalbnl.html + pub extern fn scalbnl(x: c_longdouble, n: c_int) c_longdouble; + + /// int scandir(const char *dir, struct dirent ***namelist, int (*sel)(const struct dirent *), int (*compar)(const struct dirent **, const struct dirent **)); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/scandir.html + // pub extern fn scandir(noalias __dir: [*c]const u8, noalias __namelist: [*c][*c][*c]struct_dirent, __selector: ?*const fn ([*c]const struct_dirent) callconv(.C) c_int, __cmp: ?*const fn ([*c][*c]const struct_dirent, [*c][*c]const struct_dirent) callconv(.C) c_int) c_int; + + /// int scanf(const char *restrict format, ...); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/scanf.html + pub extern fn scanf(noalias __format: [*c]const u8, ...) c_int; + + /// int sched_get_priority_max(int policy); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/sched_get_priority_max.html + pub extern fn sched_get_priority_max(policy: c_int) c_int; + + /// int sched_get_priority_min(int policy); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/sched_get_priority_min.html + pub extern fn sched_get_priority_min(policy: c_int) c_int; + + /// int sched_getparam(pid_t pid, struct sched_param *param); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/sched_getparam.html + // pub extern fn sched_getparam(__pid: __pid_t, __param: [*c]struct_sched_param) c_int; + + /// int sched_getscheduler(pid_t pid); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/sched_getscheduler.html + pub extern fn sched_getscheduler(pid: pid_t) c_int; + + /// int sched_rr_get_interval(pid_t pid, struct timespec *interval); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/sched_rr_get_interval.html + // pub extern fn sched_rr_get_interval(__pid: __pid_t, __t: [*c]struct_timespec) c_int; + + /// int sched_setparam(pid_t pid, const struct sched_param *param); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/sched_setparam.html + // pub extern fn sched_setparam(__pid: __pid_t, __param: [*c]const struct_sched_param) c_int; + + /// int sched_setscheduler(pid_t pid, int policy, const struct sched_param *param); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/sched_setscheduler.html + // pub extern fn sched_setscheduler(__pid: __pid_t, __policy: c_int, __param: [*c]const struct_sched_param) c_int; + + /// int sched_yield(void); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/sched_yield.html + pub extern fn sched_yield() c_int; + + /// unsigned short *seed48(unsigned short seed16v[3]); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/seed48.html + pub extern fn seed48(__seed16v: [*c]c_ushort) [*c]c_ushort; + + /// void seekdir(DIR *dirp, long loc); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/seekdir.html + pub extern fn seekdir(__dirp: ?*DIR, __pos: c_long) void; + + /// int select(int nfds, fd_set *restrict readfds, fd_set *restrict writefds, fd_set *restrict errorfds, struct timeval *restrict timeout); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/select.html + // pub extern fn select(__nfds: c_int, noalias __readfds: [*c]fd_set, noalias __writefds: [*c]fd_set, noalias __exceptfds: [*c]fd_set, noalias __timeout: [*c]struct_timeval) c_int; + + /// int sem_close(sem_t *sem); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/sem_close.html + // pub extern fn sem_close(__sem: [*c]sem_t) c_int; + + /// int sem_destroy(sem_t *sem); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/sem_destroy.html + // pub extern fn sem_destroy(__sem: [*c]sem_t) c_int; + + /// int sem_getvalue(sem_t *restrict sem, int *restrict sval); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/sem_getvalue.html + // pub extern fn sem_getvalue(noalias __sem: [*c]sem_t, noalias __sval: [*c]c_int) c_int; + + /// int sem_init(sem_t *sem, int pshared, unsigned value); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/sem_init.html + // pub extern fn sem_init(__sem: [*c]sem_t, __pshared: c_int, __value: c_uint) c_int; + + /// sem_t *sem_open(const char *name, int oflag, ...); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/sem_open.html + // pub extern fn sem_open(__name: [*c]const u8, __oflag: c_int, ...) [*c]sem_t; + + /// int sem_post(sem_t *sem); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/sem_post.html + // pub extern fn sem_post(__sem: [*c]sem_t) c_int; + + /// int sem_timedwait(sem_t *restrict sem, const struct timespec *restrict abstime); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/sem_timedwait.html + // pub extern fn sem_timedwait(noalias __sem: [*c]sem_t, noalias __abstime: [*c]const struct_timespec) c_int; + + /// int sem_trywait(sem_t *sem); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/sem_trywait.html + // pub extern fn sem_trywait(__sem: [*c]sem_t) c_int; + + /// int sem_unlink(const char *name); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/sem_unlink.html + pub extern fn sem_unlink(name: [*:0]const u8) c_int; + + /// int sem_wait(sem_t *sem); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/sem_wait.html + // pub extern fn sem_wait(__sem: [*c]sem_t) c_int; + + /// int semctl(int semid, int semnum, int cmd, ...); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/semctl.html + pub extern fn semctl(semid: c_int, semnum: c_int, cmd: c_int, ...) c_int; + + /// int semget(key_t key, int nsems, int semflg); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/semget.html + // pub extern fn semget(__key: key_t, __nsems: c_int, __semflg: c_int) c_int; + + /// int semop(int semid, struct sembuf *sops, size_t nsops); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/semop.html + // pub extern fn semop(__semid: c_int, __sops: [*c]struct_sembuf, __nsops: usize) c_int; + + /// ssize_t send(int socket, const void *buffer, size_t length, int flags); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/send.html + pub extern fn send(fd: c_int, buffer: [*]const u8, length: usize, flags: c_int) isize; + + /// ssize_t sendmsg(int socket, const struct msghdr *message, int flags); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/sendmsg.html + // pub extern fn sendmsg(__fd: c_int, __message: [*c]const struct_msghdr, __flags: c_int) isize; + + /// ssize_t sendto(int socket, const void *message, size_t length, int flags, const struct sockaddr *dest_addr, socklen_t dest_len); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/sendto.html + pub extern fn sendto(__fd: c_int, __buf: ?*const anyopaque, __n: usize, __flags: c_int, __addr: [*c]const struct_sockaddr, __addr_len: socklen_t) isize; + + /// void setbuf(FILE *restrict stream, char *restrict buf); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/setbuf.html + pub extern fn setbuf(noalias __stream: [*c]FILE, noalias __buf: [*c]u8) void; + + /// int setegid(gid_t gid); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/setegid.html + pub extern fn setegid(gid: gid_t) c_int; + + /// int setenv(const char *envname, const char *envval, int overwrite); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/setenv.html + pub extern fn setenv(__name: [*c]const u8, __value: [*c]const u8, __replace: c_int) c_int; + + /// int seteuid(uid_t uid); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/seteuid.html + pub extern fn seteuid(uid: uid_t) c_int; + + /// int setgid(gid_t gid); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/setgid.html + pub extern fn setgid(gid: gid_t) c_int; + + /// void setgrent(void); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/setgrent.html + pub extern fn setgrent() void; + + /// void sethostent(int stayopen); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/sethostent.html + pub extern fn sethostent(stayopen: c_int) void; + + /// int setitimer(int which, const struct itimerval *restrict value, struct itimerval *restrict ovalue); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/setitimer.html + // pub extern fn setitimer(__which: __itimer_which_t, noalias __new: [*c]const struct_itimerval, noalias __old: [*c]struct_itimerval) c_int; + + /// void setkey(const char *key); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/setkey.html + pub const setkey = @compileError("TODO setkey"); + + /// char *setlocale(int category, const char *locale); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/setlocale.html + pub extern fn setlocale(category: c_int, locale: [*:0]const u8) [*c]u8; + + /// int setlogmask(int maskpri); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/setlogmask.html + pub extern fn setlogmask(maskpri: c_int) c_int; + + /// void setnetent(int stayopen); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/setnetent.html + pub extern fn setnetent(stayopen: c_int) void; + + /// int setpgid(pid_t pid, pid_t pgid); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/setpgid.html + // pub extern fn setpgid(__pid: __pid_t, __pgid: __pid_t) c_int; + + /// pid_t setpgrp(void); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/setpgrp.html + pub extern fn setpgrp() pid_t; + + /// int setpriority(int which, id_t who, int value); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/setpriority.html + // pub extern fn setpriority(__which: __priority_which_t, __who: id_t, __prio: c_int) c_int; + + /// void setprotoent(int stayopen); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/setprotoent.html + pub extern fn setprotoent(stayopen: c_int) void; + + /// void setpwent(void); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/setpwent.html + pub extern fn setpwent() void; + + /// int setregid(gid_t rgid, gid_t egid); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/setregid.html + pub extern fn setregid(rgid: gid_t, egid: gid_t) c_int; + + /// int setreuid(uid_t ruid, uid_t euid); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/setreuid.html + pub extern fn setreuid(ruid: uid_t, euid: uid_t) c_int; + + /// int setrlimit(int resource, const struct rlimit *rlp); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/setrlimit.html + // pub extern fn setrlimit(__resource: __rlimit_resource_t, __rlimits: [*c]const struct_rlimit) c_int; + + /// void setservent(int stayopen); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/setservent.html + pub extern fn setservent(stayopen: c_int) void; + + /// pid_t setsid(void); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/setsid.html + pub extern fn setsid() pid_t; + + /// int setsockopt(int socket, int level, int option_name, const void *option_value, socklen_t option_len); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/setsockopt.html + pub extern fn setsockopt(fd: c_int, level: c_int, optname: c_int, optval: *const anyopaque, optlen: socklen_t) c_int; + + /// char *setstate(char *state); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/setstate.html + pub extern fn setstate(__statebuf: [*c]u8) [*c]u8; + + /// int setuid(uid_t uid); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/setuid.html + pub extern fn setuid(uid: uid_t) c_int; + + /// void setutxent(void); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/setutxent.html + pub extern fn setutxent() void; + + /// int setvbuf(FILE *restrict stream, char *restrict buf, int type, size_t size); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/setvbuf.html + pub extern fn setvbuf(noalias __stream: [*c]FILE, noalias __buf: [*c]u8, __modes: c_int, __n: usize) c_int; + + /// int shm_open(const char *name, int oflag, mode_t mode); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/shm_open.html + pub extern fn shm_open(__name: [*c]const u8, __oflag: c_int, __mode: mode_t) c_int; + + /// int shm_unlink(const char *name); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/shm_unlink.html + pub extern fn shm_unlink(name: [*:0]const u8) c_int; + + /// void *shmat(int shmid, const void *shmaddr, int shmflg); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/shmat.html + pub extern fn shmat(__shmid: c_int, __shmaddr: ?*const anyopaque, __shmflg: c_int) ?*anyopaque; + + /// int shmctl(int shmid, int cmd, struct shmid_ds *buf); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/shmctl.html + // pub extern fn shmctl(__shmid: c_int, __cmd: c_int, __buf: [*c]struct_shmid_ds) c_int; + + /// int shmdt(const void *shmaddr); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/shmdt.html + pub extern fn shmdt(__shmaddr: ?*const anyopaque) c_int; + + /// int shmget(key_t key, size_t size, int shmflg); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/shmget.html + // pub extern fn shmget(__key: key_t, __size: usize, __shmflg: c_int) c_int; + + /// int shutdown(int socket, int how); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/shutdown.html + pub extern fn shutdown(socket: c_int, how: c_int) c_int; + + /// int sigaction(int sig, const struct sigaction *restrict act, struct sigaction *restrict oact); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/sigaction.html + // pub extern fn sigaction(__sig: c_int, noalias __act: [*c]const struct_sigaction, noalias __oact: [*c]struct_sigaction) c_int; + + /// int sigaddset(sigset_t *set, int signo); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/sigaddset.html + // pub extern fn sigaddset(__set: [*c]sigset_t, __signo: c_int) c_int; + + /// int sigaltstack(const stack_t *restrict ss, stack_t *restrict oss); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/sigaltstack.html + // pub extern fn sigaltstack(noalias __ss: [*c]const stack_t, noalias __oss: [*c]stack_t) c_int; + + /// int sigdelset(sigset_t *set, int signo); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/sigdelset.html + // pub extern fn sigdelset(__set: [*c]sigset_t, __signo: c_int) c_int; + + /// int sigemptyset(sigset_t *set); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/sigemptyset.html + // pub extern fn sigemptyset(__set: [*c]sigset_t) c_int; + + /// int sigfillset(sigset_t *set); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/sigfillset.html + // pub extern fn sigfillset(__set: [*c]sigset_t) c_int; + + /// int sighold(int sig); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/sighold.html + pub extern fn sighold(sig: c_int) c_int; + + /// int sigignore(int sig); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/sigignore.html + pub extern fn sigignore(sig: c_int) c_int; + + /// int siginterrupt(int sig, int flag); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/siginterrupt.html + pub extern fn siginterrupt(sig: c_int, flag: c_int) c_int; + + /// int sigismember(const sigset_t *set, int signo); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/sigismember.html + // pub extern fn sigismember(__set: [*c]const sigset_t, __signo: c_int) c_int; + + /// void (*signal(int sig, void (*func)(int)))(int); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/signal.html + // pub extern fn signal(__sig: c_int, __handler: __sighandler_t) __sighandler_t; + + /// int sigpause(int sig); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/sigpause.html + pub extern fn sigpause(sig: c_int) c_int; + + /// int sigpending(sigset_t *set); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/sigpending.html + // pub extern fn sigpending(__set: [*c]sigset_t) c_int; + + /// int sigprocmask(int how, const sigset_t *restrict set, sigset_t *restrict oset); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/sigprocmask.html + // pub extern fn sigprocmask(__how: c_int, noalias __set: [*c]const sigset_t, noalias __oset: [*c]sigset_t) c_int; + + /// int sigqueue(pid_t pid, int signo, const union sigval value); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/sigqueue.html + // pub extern fn sigqueue(__pid: __pid_t, __sig: c_int, __val: union_sigval) c_int; + + /// int sigrelse(int sig); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/sigrelse.html + pub extern fn sigrelse(sig: c_int) c_int; + + /// void (*sigset(int sig, void (*disp)(int)))(int); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/sigset.html + pub const sigset = @compileError("TODO sigset"); + + /// int sigsuspend(const sigset_t *sigmask); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/sigsuspend.html + // pub extern fn sigsuspend(__set: [*c]const sigset_t) c_int; + + /// int sigtimedwait(const sigset_t *restrict set, siginfo_t *restrict info, const struct timespec *restrict timeout); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/sigtimedwait.html + // pub extern fn sigtimedwait(noalias __set: [*c]const sigset_t, noalias __info: [*c]siginfo_t, noalias __timeout: [*c]const struct_timespec) c_int; + + /// int sigwait(const sigset_t *restrict set, int *restrict sig); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/sigwait.html + // pub extern fn sigwait(noalias __set: [*c]const sigset_t, noalias __sig: [*c]c_int) c_int; + + /// int sigwaitinfo(const sigset_t *restrict set, siginfo_t *restrict info); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/sigwaitinfo.html + // pub extern fn sigwaitinfo(noalias __set: [*c]const sigset_t, noalias __info: [*c]siginfo_t) c_int; + + /// double sin(double x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/sin.html + pub extern fn sin(x: f64) f64; + + /// float sinf(float x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/sinf.html + pub extern fn sinf(x: f32) f32; + + /// double sinh(double x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/sinh.html + pub extern fn sinh(x: f64) f64; + + /// float sinhf(float x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/sinhf.html + pub extern fn sinhf(x: f32) f32; + + /// long double sinhl(long double x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/sinhl.html + pub extern fn sinhl(x: c_longdouble) c_longdouble; + + /// long double sinl(long double x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/sinl.html + pub extern fn sinl(x: c_longdouble) c_longdouble; + + /// unsigned sleep(unsigned seconds); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/sleep.html + pub extern fn sleep(seconds: c_uint) c_uint; + + /// int snprintf(char *restrict s, size_t n, const char *restrict format, ...); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/snprintf.html + pub extern fn snprintf(__s: [*c]u8, __maxlen: c_ulong, __format: [*c]const u8, ...) c_int; + + /// int sockatmark(int s); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/sockatmark.html + pub extern fn sockatmark(s: c_int) c_int; + + /// int socket(int domain, int type, int protocol); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/socket.html + pub extern fn socket(domain: c_int, type: c_int, protocol: c_int) c_int; + + /// int socketpair(int domain, int type, int protocol, int socket_vector[2]); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/socketpair.html + pub extern fn socketpair(domain: c_int, type: c_int, protocol: c_int, fds: *[2]c_int) c_int; + + /// int sprintf(char *restrict s, const char *restrict format, ...); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/sprintf.html + pub extern fn sprintf(__s: [*c]u8, __format: [*c]const u8, ...) c_int; + + /// double sqrt(double x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/sqrt.html + pub extern fn sqrt(x: f64) f64; + + /// float sqrtf(float x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/sqrtf.html + pub extern fn sqrtf(x: f32) f32; + + /// long double sqrtl(long double x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/sqrtl.html + pub extern fn sqrtl(x: c_longdouble) c_longdouble; + + /// void srand(unsigned seed); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/srand.html + pub extern fn srand(seed: c_uint) void; + + /// void srand48(long seedval); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/srand48.html + pub extern fn srand48(seedval: c_long) void; + + /// void srandom(unsigned seed); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/srandom.html + pub extern fn srandom(seed: c_uint) void; + + /// int sscanf(const char *restrict s, const char *restrict format, ...); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/sscanf.html + pub extern fn sscanf(noalias __s: [*c]const u8, noalias __format: [*c]const u8, ...) c_int; + + /// int stat(const char *restrict path, struct stat *restrict buf); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/stat.html + // pub extern fn stat(noalias __file: [*c]const u8, noalias __buf: [*c]struct_stat) c_int; + + /// int statvfs(const char *restrict path, struct statvfs *restrict buf); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/statvfs.html + // pub extern fn statvfs(noalias __file: [*c]const u8, noalias __buf: [*c]struct_statvfs) c_int; + + /// char *stpcpy(char *restrict s1, const char *restrict s2); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/stpcpy.html + pub extern fn stpcpy(__dest: [*c]u8, __src: [*c]const u8) [*c]u8; + + /// char *stpncpy(char *restrict s1, const char *restrict s2, size_t n); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/stpncpy.html + pub extern fn stpncpy(__dest: [*c]u8, __src: [*c]const u8, __n: c_ulong) [*c]u8; + + /// int strcasecmp(const char *s1, const char *s2); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/strcasecmp.html + pub extern fn strcasecmp(__s1: [*c]const u8, __s2: [*c]const u8) c_int; + + /// int strcasecmp_l(const char *s1, const char *s2, locale_t locale); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/strcasecmp_l.html + pub extern fn strcasecmp_l(__s1: [*c]const u8, __s2: [*c]const u8, __loc: locale_t) c_int; + + /// char *strcat(char *restrict s1, const char *restrict s2); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/strcat.html + pub extern fn strcat(__dest: [*c]u8, __src: [*c]const u8) [*c]u8; + + /// char *strchr(const char *s, int c); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/strchr.html + pub extern fn strchr(__s: [*c]const u8, __c: c_int) [*c]u8; + + /// int strcmp(const char *s1, const char *s2); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/strcmp.html + pub extern fn strcmp(__s1: [*c]const u8, __s2: [*c]const u8) c_int; + + /// int strcoll(const char *s1, const char *s2); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/strcoll.html + pub extern fn strcoll(__s1: [*c]const u8, __s2: [*c]const u8) c_int; + + /// int strcoll_l(const char *s1, const char *s2, locale_t locale); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/strcoll_l.html + pub extern fn strcoll_l(__s1: [*c]const u8, __s2: [*c]const u8, __l: locale_t) c_int; + + /// char *strcpy(char *restrict s1, const char *restrict s2); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/strcpy.html + pub extern fn strcpy(__dest: [*c]u8, __src: [*c]const u8) [*c]u8; + + /// size_t strcspn(const char *s1, const char *s2); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/strcspn.html + pub extern fn strcspn(__s: [*c]const u8, __reject: [*c]const u8) c_ulong; + + /// char *strdup(const char *s); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/strdup.html + pub extern fn strdup(__s: [*c]const u8) [*c]u8; + + /// char *strerror(int errnum); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/strerror.html + pub extern fn strerror(__errnum: c_int) [*c]u8; + + /// char *strerror_l(int errnum, locale_t locale); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/strerror_l.html + pub extern fn strerror_l(__errnum: c_int, __l: locale_t) [*c]u8; + + /// int strerror_r(int errnum, char *strerrbuf, size_t buflen); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/strerror_r.html + pub extern fn strerror_r(__errnum: c_int, __buf: [*c]u8, __buflen: usize) c_int; + + /// ssize_t strfmon(char *restrict s, size_t maxsize, const char *restrict format, ...); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/strfmon.html + pub extern fn strfmon(noalias __s: [*c]u8, __maxsize: usize, noalias __format: [*c]const u8, ...) isize; + + /// ssize_t strfmon_l(char *restrict s, size_t maxsize, locale_t locale, const char *restrict format, ...); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/strfmon_l.html + pub extern fn strfmon_l(noalias __s: [*c]u8, __maxsize: usize, __loc: locale_t, noalias __format: [*c]const u8, ...) isize; + + /// size_t strftime(char *restrict s, size_t maxsize, const char *restrict format, const struct tm *restrict timeptr); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/strftime.html + // pub extern fn strftime(noalias __s: [*c]u8, __maxsize: usize, noalias __format: [*c]const u8, noalias __tp: [*c]const struct_tm) usize; + + /// size_t strftime_l(char *restrict s, size_t maxsize, const char *restrict format, const struct tm *restrict timeptr, locale_t locale); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/strftime_l.html + // pub extern fn strftime_l(noalias __s: [*c]u8, __maxsize: usize, noalias __format: [*c]const u8, noalias __tp: [*c]const struct_tm, __loc: locale_t) usize; + + /// size_t strlen(const char *s); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/strlen.html + pub extern fn strlen(s: [*:0]const u8) c_ulong; + + /// int strncasecmp(const char *s1, const char *s2, size_t n); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/strncasecmp.html + pub extern fn strncasecmp(__s1: [*c]const u8, __s2: [*c]const u8, __n: c_ulong) c_int; + + /// int strncasecmp_l(const char *s1, const char *s2, size_t n, locale_t locale); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/strncasecmp_l.html + pub extern fn strncasecmp_l(__s1: [*c]const u8, __s2: [*c]const u8, __n: usize, __loc: locale_t) c_int; + + /// char *strncat(char *restrict s1, const char *restrict s2, size_t n); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/strncat.html + pub extern fn strncat(__dest: [*c]u8, __src: [*c]const u8, __n: c_ulong) [*c]u8; + + /// int strncmp(const char *s1, const char *s2, size_t n); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/strncmp.html + pub extern fn strncmp(__s1: [*c]const u8, __s2: [*c]const u8, __n: c_ulong) c_int; + + /// char *strncpy(char *restrict s1, const char *restrict s2, size_t n); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/strncpy.html + pub extern fn strncpy(__dest: [*c]u8, __src: [*c]const u8, __n: c_ulong) [*c]u8; + + /// char *strndup(const char *s, size_t size); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/strndup.html + pub extern fn strndup(__string: [*c]const u8, __n: c_ulong) [*c]u8; + + /// size_t strnlen(const char *s, size_t maxlen); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/strnlen.html + pub extern fn strnlen(__string: [*c]const u8, __maxlen: usize) usize; + + /// char *strpbrk(const char *s1, const char *s2); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/strpbrk.html + pub extern fn strpbrk(__s: [*c]const u8, __accept: [*c]const u8) [*c]u8; + + /// char *strptime(const char *restrict buf, const char *restrict format, struct tm *restrict tm); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/strptime.html + pub const strptime = @compileError("TODO strptime"); + + /// char *strrchr(const char *s, int c); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/strrchr.html + pub extern fn strrchr(__s: [*c]const u8, __c: c_int) [*c]u8; + + /// char *strsignal(int signum); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/strsignal.html + pub extern fn strsignal(__sig: c_int) [*c]u8; + + /// size_t strspn(const char *s1, const char *s2); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/strspn.html + pub extern fn strspn(__s: [*c]const u8, __accept: [*c]const u8) c_ulong; + + /// char *strstr(const char *s1, const char *s2); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/strstr.html + pub extern fn strstr(__haystack: [*c]const u8, __needle: [*c]const u8) [*c]u8; + + /// double strtod(const char *restrict nptr, char **restrict endptr); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/strtod.html + pub extern fn strtod(__nptr: [*c]const u8, __endptr: [*c][*c]u8) f64; + + /// float strtof(const char *restrict nptr, char **restrict endptr); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/strtof.html + pub extern fn strtof(__nptr: [*c]const u8, __endptr: [*c][*c]u8) f32; + + /// intmax_t strtoimax(const char *restrict nptr, char **restrict endptr, int base); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/strtoimax.html + pub extern fn strtoimax(noalias __nptr: [*c]const u8, noalias __endptr: [*c][*c]u8, __base: c_int) intmax_t; + + /// char *strtok(char *restrict s1, const char *restrict s2); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/strtok.html + pub extern fn strtok(__s: [*c]u8, __delim: [*c]const u8) [*c]u8; + + /// char *strtok_r(char *restrict s, const char *restrict sep, char **restrict lasts); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/strtok_r.html + pub extern fn strtok_r(noalias __s: [*c]u8, noalias __delim: [*c]const u8, noalias __save_ptr: [*c][*c]u8) [*c]u8; + + /// long strtol(const char *restrict str, char **restrict endptr, int base); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/strtol.html + pub extern fn strtol(__nptr: [*c]const u8, __endptr: [*c][*c]u8, __base: c_int) c_long; + + /// long double strtold(const char *restrict nptr, char **restrict endptr); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/strtold.html + pub extern fn strtold(__nptr: [*c]const u8, __endptr: [*c][*c]u8) c_longdouble; + + /// long long strtoll(const char *restrict str, char **restrict endptr, int base) + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/strtoll.html + pub extern fn strtoll(__nptr: [*c]const u8, __endptr: [*c][*c]u8, __base: c_int) c_longlong; + + /// unsigned long strtoul(const char *restrict str, char **restrict endptr, int base); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/strtoul.html + pub extern fn strtoul(__nptr: [*c]const u8, __endptr: [*c][*c]u8, __base: c_int) c_ulong; + + /// unsigned long long strtoull(const char *restrict str, char **restrict endptr, int base); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/strtoull.html + pub extern fn strtoull(__nptr: [*c]const u8, __endptr: [*c][*c]u8, __base: c_int) c_ulonglong; + + /// uintmax_t strtoumax(const char *restrict nptr, char **restrict endptr, int base); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/strtoumax.html + // pub extern fn strtoumax(noalias __nptr: [*c]const u8, noalias __endptr: [*c][*c]u8, __base: c_int) uintmax_t; + + /// size_t strxfrm(char *restrict s1, const char *restrict s2, size_t n); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/strxfrm.html + pub extern fn strxfrm(__dest: [*c]u8, __src: [*c]const u8, __n: c_ulong) c_ulong; + + /// size_t strxfrm_l(char *restrict s1, const char *restrict s2, size_t n, locale_t locale); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/strxfrm_l.html + pub extern fn strxfrm_l(__dest: [*c]u8, __src: [*c]const u8, __n: usize, __l: locale_t) usize; + + /// void swab(const void *restrict src, void *restrict dest, ssize_t nbytes); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/swab.html + pub const swab = @compileError("TODO swab"); + + /// int swprintf(wchar_t *restrict ws, size_t n, const wchar_t *restrict format, ...); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/swprintf.html + pub extern fn swprintf(noalias __s: [*c]wchar_t, __n: usize, noalias __format: [*c]const wchar_t, ...) c_int; + + /// int swscanf(const wchar_t *restrict ws, const wchar_t *restrict format, ...); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/swscanf.html + pub extern fn swscanf(noalias __s: [*c]const wchar_t, noalias __format: [*c]const wchar_t, ...) c_int; + + /// int symlink(const char *path1, const char *path2); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/symlink.html + pub extern fn symlink(__from: [*c]const u8, __to: [*c]const u8) c_int; + + /// int symlinkat(const char *path1, int fd, const char *path2); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/symlinkat.html + pub extern fn symlinkat(__from: [*c]const u8, __tofd: c_int, __to: [*c]const u8) c_int; + + /// void sync(void); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/sync.html + pub extern fn sync() void; + + /// long sysconf(int name); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/sysconf.html + pub extern fn sysconf(name: c_int) c_long; + + /// void syslog(int priority, const char *message, ... /* arguments */); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/syslog.html + pub extern fn syslog(__pri: c_int, __fmt: [*c]const u8, ...) void; + + /// int system(const char *command); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/system.html + pub extern fn system(__command: [*c]const u8) c_int; + + /// double tan(double x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/tan.html + pub extern fn tan(x: f64) f64; + + /// float tanf(float x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/tanf.html + pub extern fn tanf(x: f32) f32; + + /// double tanh(double x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/tanh.html + pub extern fn tanh(x: f64) f64; + + /// float tanhf(float x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/tanhf.html + pub extern fn tanhf(x: f32) f32; + + /// long double tanhl(long double x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/tanhl.html + pub extern fn tanhl(x: c_longdouble) c_longdouble; + + /// long double tanl(long double x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/tanl.html + pub extern fn tanl(x: c_longdouble) c_longdouble; + + /// int tcdrain(int fildes); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/tcdrain.html + pub extern fn tcdrain(fd: c_int) c_int; + + /// int tcflow(int fildes, int action); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/tcflow.html + pub extern fn tcflow(fd: c_int, action: c_int) c_int; + + /// int tcflush(int fildes, int queue_selector); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/tcflush.html + pub extern fn tcflush(fd: c_int, queue_selector: c_int) c_int; + + /// int tcgetattr(int fildes, struct termios *termios_p); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/tcgetattr.html + pub extern fn tcgetattr(fd: c_int, termios_p: *struct_termios) c_int; + + /// pid_t tcgetpgrp(int fildes); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/tcgetpgrp.html + pub extern fn tcgetpgrp(fd: c_int) pid_t; + + /// pid_t tcgetsid(int fildes); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/tcgetsid.html + pub extern fn tcgetsid(fd: c_int) pid_t; + + /// int tcsendbreak(int fildes, int duration); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/tcsendbreak.html + pub extern fn tcsendbreak(fd: c_int, duration: c_int) c_int; + + /// int tcsetattr(int fildes, int optional_actions, const struct termios *termios_p); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/tcsetattr.html + pub extern fn tcsetattr(fd: c_int, optional_actions: c_int, termios_p: *const struct_termios) c_int; + + /// int tcsetpgrp(int fildes, pid_t pgid_id); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/tcsetpgrp.html + // pub extern fn tcsetpgrp(__fd: c_int, __pgrp_id: __pid_t) c_int; + + /// void *tdelete(const void *restrict key, void **restrict rootp, int(*compar)(const void *, const void *)); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/tdelete.html + // pub extern fn tdelete(noalias __key: ?*const anyopaque, noalias __rootp: [*c]?*anyopaque, __compar: __compar_fn_t) ?*anyopaque; + + /// long telldir(DIR *dirp); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/telldir.html + pub extern fn telldir(__dirp: ?*DIR) c_long; + + /// char *tempnam(const char *dir, const char *pfx); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/tempnam.html + pub extern fn tempnam(__dir: [*c]const u8, __pfx: [*c]const u8) [*c]u8; + + /// void *tfind(const void *key, void *const *rootp, int(*compar)(const void *, const void *)); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/tfind.html + // pub extern fn tfind(__key: ?*const anyopaque, __rootp: [*c]const ?*anyopaque, __compar: __compar_fn_t) ?*anyopaque; + + /// double tgamma(double x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/tgamma.html + pub extern fn tgamma(x: f64) f64; + + /// float tgammaf(float x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/tgammaf.html + pub extern fn tgammaf(x: f32) f32; + + /// long double tgammal(long double x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/tgammal.html + pub extern fn tgammal(x: c_longdouble) c_longdouble; + + /// time_t time(time_t *tloc); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/time.html + pub extern fn time(__timer: [*c]time_t) time_t; + + /// int timer_create(clockid_t clockid, struct sigevent *restrict evp, timer_t *restrict timerid); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/timer_create.html + // pub extern fn timer_create(__clock_id: clockid_t, noalias __evp: [*c]struct_sigevent, noalias __timerid: [*c]timer_t) c_int; + + /// int timer_delete(timer_t timerid); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/timer_delete.html + // pub extern fn timer_delete(__timerid: timer_t) c_int; + + /// int timer_getoverrun(timer_t timerid); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/timer_getoverrun.html + // pub extern fn timer_getoverrun(__timerid: timer_t) c_int; + + /// int timer_gettime(timer_t timerid, struct itimerspec *value); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/timer_gettime.html + // pub extern fn timer_gettime(__timerid: timer_t, __value: [*c]struct_itimerspec) c_int; + + /// int timer_settime(timer_t timerid, int flags, const struct itimerspec *restrict value, struct itimerspec *restrict ovalue); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/timer_settime.html + // pub extern fn timer_settime(__timerid: timer_t, __flags: c_int, noalias __value: [*c]const struct_itimerspec, noalias __ovalue: [*c]struct_itimerspec) c_int; + + /// clock_t times(struct tms *buffer); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/times.html + // pub extern fn times(__buffer: [*c]struct_tms) clock_t; + + /// FILE *tmpfile(void); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/tmpfile.html + pub extern fn tmpfile() ?*FILE; + + /// char *tmpnam(char *s); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/tmpnam.html + pub extern fn tmpnam(s: [*c]u8) [*c]u8; + + /// int toascii(int c); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/toascii.html + pub extern fn toascii(c: c_int) c_int; + + /// int tolower(int c); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/tolower.html + pub extern fn tolower(c: c_int) c_int; + + /// int tolower_l(int c, locale_t locale); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/tolower_l.html + pub extern fn tolower_l(c: c_int, locale: locale_t) c_int; + + /// int toupper(int c); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/toupper.html + pub extern fn toupper(c: c_int) c_int; + + /// int toupper_l(int c, locale_t locale); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/toupper_l.html + pub extern fn toupper_l(c: c_int, locale: locale_t) c_int; + + /// wint_t towctrans(wint_t wc, wctrans_t desc); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/towctrans.html + // pub extern fn towctrans(__wc: wint_t, __desc: wctrans_t) wint_t; + + /// wint_t towctrans_l(wint_t wc, wctrans_t desc, locale_t locale); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/towctrans_l.html + // pub extern fn towctrans_l(__wc: wint_t, __desc: wctrans_t, __locale: locale_t) wint_t; + + /// wint_t towlower(wint_t wc); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/towlower.html + pub extern fn towlower(wc: wint_t) wint_t; + + /// wint_t towlower_l(wint_t wc, locale_t locale); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/towlower_l.html + pub extern fn towlower_l(wc: wint_t, locale: locale_t) wint_t; + + /// wint_t towupper(wint_t wc); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/towupper.html + pub extern fn towupper(wc: wint_t) wint_t; + + /// wint_t towupper_l(wint_t wc, locale_t locale); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/towupper_l.html + pub extern fn towupper_l(wc: wint_t, locale: locale_t) wint_t; + + /// double trunc(double x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/trunc.html + pub extern fn trunc(x: f64) f64; + + /// int truncate(const char *path, off_t length); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/truncate.html + pub extern fn truncate(__file: [*c]const u8, __length: off_t) c_int; + + /// float truncf(float x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/truncf.html + pub extern fn truncf(x: f32) f32; + + /// long double truncl(long double x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/truncl.html + pub extern fn truncl(x: c_longdouble) c_longdouble; + + /// void *tsearch(const void *key, void **rootp, int (*compar)(const void *, const void *)); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/tsearch.html + // pub extern fn tsearch(__key: ?*const anyopaque, __rootp: [*c]?*anyopaque, __compar: __compar_fn_t) ?*anyopaque; + + /// char *ttyname(int fildes); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/ttyname.html + pub extern fn ttyname(__fd: c_int) [*c]u8; + + /// int ttyname_r(int fildes, char *name, size_t namesize); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/ttyname_r.html + pub extern fn ttyname_r(__fd: c_int, __buf: [*c]u8, __buflen: usize) c_int; + + /// void twalk(const void *root, void (*action)(const void *, VISIT, int)); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/twalk.html + // pub extern fn twalk(__root: ?*const anyopaque, __action: __action_fn_t) void; + + /// void tzset(void); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/tzset.html + pub extern fn tzset() void; + + /// long ulimit(int cmd, ...); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/ulimit.html + pub extern fn ulimit(cmd: c_int, ...) c_long; + + /// mode_t umask(mode_t cmask); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/umask.html + pub extern fn umask(cmask: mode_t) mode_t; + + /// int uname(struct utsname *name); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/uname.html + // pub extern fn uname(__name: [*c]struct_utsname) c_int; + + /// int ungetc(int c, FILE *stream); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/ungetc.html + pub extern fn ungetc(__c: c_int, __stream: [*c]FILE) c_int; + + /// wint_t ungetwc(wint_t wc, FILE *stream); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/ungetwc.html + // pub extern fn ungetwc(__wc: wint_t, __stream: [*c]__FILE) wint_t; + + /// int unlink(const char *path); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/unlink.html + pub extern fn unlink(__name: [*c]const u8) c_int; + + /// int unlinkat(int fd, const char *path, int flag); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/unlinkat.html + pub extern fn unlinkat(fd: c_int, name: [*:0]const u8, flag: c_int) c_int; + + /// int unlockpt(int fildes); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/unlockpt.html + pub extern fn unlockpt(fd: c_int) c_int; + + /// int unsetenv(const char *name); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/unsetenv.html + pub extern fn unsetenv(__name: [*c]const u8) c_int; + + /// locale_t uselocale(locale_t newloc); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/uselocale.html + pub extern fn uselocale(newloc: locale_t) locale_t; + + /// int utime(const char *path, const struct utimbuf *times); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/utime.html + // pub extern fn utime(__file: [*c]const u8, __file_times: [*c]const struct_utimbuf) c_int; + + /// int utimensat(int fd, const char *path, const struct timespec times[2], int flag); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/utimensat.html + pub extern fn utimensat(__fd: c_int, __path: [*c]const u8, __times: [*c]const struct_timespec, __flags: c_int) c_int; + + /// int utimes(const char *path, const struct timeval times[2]); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/utimes.html + // pub extern fn utimes(__file: [*c]const u8, __tvp: [*c]const struct_timeval) c_int; + + /// type va_arg(va_list ap, type); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/va_arg.html + pub const va_arg = @compileError("TODO va_arg"); + + /// void va_copy(va_list dest, va_list src); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/va_copy.html + pub const va_copy = @compileError("TODO va_copy"); + + /// void va_end(va_list ap); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/va_end.html + pub const va_end = @compileError("TODO va_end"); + + /// void va_start(va_list ap, argN); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/va_start.html + pub const va_start = @compileError("TODO va_start"); + + /// int vdprintf(int fildes, const char *restrict format, va_list ap); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/vdprintf.html + // pub extern fn vdprintf(__fd: c_int, noalias __fmt: [*c]const u8, __arg: [*c]struct___va_list_tag_37) c_int; + + /// int vfprintf(FILE *restrict stream, const char *restrict format, va_list ap); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/vfprintf.html + // pub extern fn vfprintf(__s: [*c]FILE, __format: [*c]const u8, __arg: [*c]struct___va_list_tag_37) c_int; + + /// int vfscanf(FILE *restrict stream, const char *restrict format, va_list arg); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/vfscanf.html + // pub extern fn vfscanf(noalias __s: [*c]FILE, noalias __format: [*c]const u8, __arg: [*c]struct___va_list_tag_37) c_int; + + /// int vfwprintf(FILE *restrict stream, const wchar_t *restrict format, va_list arg); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/vfwprintf.html + // pub extern fn vfwprintf(noalias __s: [*c]__FILE, noalias __format: [*c]const wchar_t, __arg: [*c]struct___va_list_tag_37) c_int; + + /// int vfwscanf(FILE *restrict stream, const wchar_t *restrict format, va_list arg); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/vfwscanf.html + // pub extern fn vfwscanf(noalias __s: [*c]__FILE, noalias __format: [*c]const wchar_t, __arg: [*c]struct___va_list_tag_37) c_int; + + /// int vprintf(const char *restrict format, va_list ap); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/vprintf.html + // pub extern fn vprintf(__format: [*c]const u8, __arg: [*c]struct___va_list_tag_37) c_int; + + /// int vscanf(const char *restrict format, va_list arg); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/vscanf.html + // pub extern fn vscanf(noalias __format: [*c]const u8, __arg: [*c]struct___va_list_tag_37) c_int; + + /// int vsnprintf(char *restrict s, size_t n, const char *restrict format, va_list ap); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/vsnprintf.html + // pub extern fn vsnprintf(__s: [*c]u8, __maxlen: c_ulong, __format: [*c]const u8, __arg: [*c]struct___va_list_tag_37) c_int; + + /// int vsprintf(char *restrict s, const char *restrict format, va_list ap); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/vsprintf.html + // pub extern fn vsprintf(__s: [*c]u8, __format: [*c]const u8, __arg: [*c]struct___va_list_tag_37) c_int; + + /// int vsscanf(const char *restrict s, const char *restrict format, va_list arg); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/vsscanf.html + // pub extern fn vsscanf(noalias __s: [*c]const u8, noalias __format: [*c]const u8, __arg: [*c]struct___va_list_tag_37) c_int; + + /// int vswprintf(wchar_t *restrict ws, size_t n, const wchar_t *restrict format, va_list arg); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/vswprintf.html + // pub extern fn vswprintf(noalias __s: [*c]wchar_t, __n: usize, noalias __format: [*c]const wchar_t, __arg: [*c]struct___va_list_tag_37) c_int; + + /// int vswscanf(const wchar_t *restrict ws, const wchar_t *restrict format, va_list arg); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/vswscanf.html + // pub extern fn vswscanf(noalias __s: [*c]const wchar_t, noalias __format: [*c]const wchar_t, __arg: [*c]struct___va_list_tag_37) c_int; + + /// int vwprintf(const wchar_t *restrict format, va_list arg); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/vwprintf.html + // pub extern fn vwprintf(noalias __format: [*c]const wchar_t, __arg: [*c]struct___va_list_tag_37) c_int; + + /// int vwscanf(const wchar_t *restrict format, va_list arg); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/vwscanf.html + // pub extern fn vwscanf(noalias __format: [*c]const wchar_t, __arg: [*c]struct___va_list_tag_37) c_int; + + /// pid_t wait(int *stat_loc); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/wait.html + // pub extern fn wait(__stat_loc: [*c]c_int) __pid_t; + + /// int waitid(idtype_t idtype, id_t id, siginfo_t *infop, int options); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/waitid.html + // pub extern fn waitid(__idtype: idtype_t, __id: __id_t, __infop: [*c]siginfo_t, __options: c_int) c_int; + + /// pid_t waitpid(pid_t pid, int *stat_loc, int options); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/waitpid.html + pub extern fn waitpid(pid: pid_t, stat_loc: ?*c_int, options: c_int) pid_t; + + /// wchar_t *wcpcpy(wchar_t *restrict ws1, const wchar_t *restrict ws2); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/wcpcpy.html + pub extern fn wcpcpy(noalias __dest: [*c]wchar_t, noalias __src: [*c]const wchar_t) [*c]wchar_t; + + /// wchar_t *wcpncpy(wchar_t restrict *ws1, const wchar_t *restrict ws2, size_t n); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/wcpncpy.html + pub extern fn wcpncpy(noalias __dest: [*c]wchar_t, noalias __src: [*c]const wchar_t, __n: usize) [*c]wchar_t; + + /// size_t wcrtomb(char *restrict s, wchar_t wc, mbstate_t *restrict ps); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/wcrtomb.html + // pub extern fn wcrtomb(noalias __s: [*c]u8, __wc: wchar_t, noalias __ps: [*c]mbstate_t) usize; + + /// int wcscasecmp(const wchar_t *ws1, const wchar_t *ws2); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/wcscasecmp.html + pub extern fn wcscasecmp(__s1: [*c]const wchar_t, __s2: [*c]const wchar_t) c_int; + + /// int wcscasecmp_l(const wchar_t *ws1, const wchar_t *ws2, locale_t locale); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/wcscasecmp_l.html + pub extern fn wcscasecmp_l(__s1: [*c]const wchar_t, __s2: [*c]const wchar_t, __loc: locale_t) c_int; + + /// wchar_t *wcscat(wchar_t *restrict ws1, const wchar_t *restrict ws2); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/wcscat.html + pub extern fn wcscat(noalias __dest: [*c]wchar_t, noalias __src: [*c]const wchar_t) [*c]wchar_t; + + /// wchar_t *wcschr(const wchar_t *ws, wchar_t wc); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/wcschr.html + pub extern fn wcschr(__wcs: [*c]const c_int, __wc: c_int) [*c]c_int; + + /// int wcscmp(const wchar_t *ws1, const wchar_t *ws2); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/wcscmp.html + pub extern fn wcscmp(__s1: [*c]const c_int, __s2: [*c]const c_int) c_int; + + /// int wcscoll(const wchar_t *ws1, const wchar_t *ws2); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/wcscoll.html + pub extern fn wcscoll(__s1: [*c]const wchar_t, __s2: [*c]const wchar_t) c_int; + + /// int wcscoll_l(const wchar_t *ws1, const wchar_t *ws2, locale_t locale); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/wcscoll_l.html + pub extern fn wcscoll_l(__s1: [*c]const wchar_t, __s2: [*c]const wchar_t, __loc: locale_t) c_int; + + /// wchar_t *wcscpy(wchar_t *restrict ws1, const wchar_t *restrict ws2); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/wcscpy.html + pub extern fn wcscpy(noalias __dest: [*c]wchar_t, noalias __src: [*c]const wchar_t) [*c]wchar_t; + + /// size_t wcscspn(const wchar_t *ws1, const wchar_t *ws2); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/wcscspn.html + pub extern fn wcscspn(__wcs: [*c]const wchar_t, __reject: [*c]const wchar_t) usize; + + /// wchar_t *wcsdup(const wchar_t *string); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/wcsdup.html + pub extern fn wcsdup(__s: [*c]const wchar_t) [*c]wchar_t; + + /// size_t wcsftime(wchar_t *restrict wcs, size_t maxsize, const wchar_t *restrict format, const struct tm *restrict timeptr); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/wcsftime.html + // pub extern fn wcsftime(noalias __s: [*c]wchar_t, __maxsize: usize, noalias __format: [*c]const wchar_t, noalias __tp: [*c]const struct_tm) usize; + + /// size_t wcslen(const wchar_t *ws); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/wcslen.html + pub extern fn wcslen(__s: [*c]const c_int) c_ulong; + + /// int wcsncasecmp(const wchar_t *ws1, const wchar_t *ws2, size_t n); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/wcsncasecmp.html + pub extern fn wcsncasecmp(__s1: [*c]const wchar_t, __s2: [*c]const wchar_t, __n: usize) c_int; + + /// int wcsncasecmp_l(const wchar_t *ws1, const wchar_t *ws2, size_t n, locale_t locale); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/wcsncasecmp_l.html + pub extern fn wcsncasecmp_l(__s1: [*c]const wchar_t, __s2: [*c]const wchar_t, __n: usize, __loc: locale_t) c_int; + + /// wchar_t *wcsncat(wchar_t *restrict ws1, const wchar_t *restrict ws2, size_t n); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/wcsncat.html + pub extern fn wcsncat(noalias __dest: [*c]wchar_t, noalias __src: [*c]const wchar_t, __n: usize) [*c]wchar_t; + + /// int wcsncmp(const wchar_t *ws1, const wchar_t *ws2, size_t n); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/wcsncmp.html + pub extern fn wcsncmp(__s1: [*c]const c_int, __s2: [*c]const c_int, __n: c_ulong) c_int; + + /// wchar_t *wcsncpy(wchar_t *restrict ws1, const wchar_t *restrict ws2, size_t n); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/wcsncpy.html + pub extern fn wcsncpy(noalias __dest: [*c]wchar_t, noalias __src: [*c]const wchar_t, __n: usize) [*c]wchar_t; + + /// size_t wcsnlen(const wchar_t *ws, size_t maxlen); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/wcsnlen.html + pub extern fn wcsnlen(__s: [*c]const wchar_t, __maxlen: usize) usize; + + /// size_t wcsnrtombs(char *restrict dst, const wchar_t **restrict src, size_t nwc, size_t len, mbstate_t *restrict ps); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/wcsnrtombs.html + // pub extern fn wcsnrtombs(noalias __dst: [*c]u8, noalias __src: [*c][*c]const wchar_t, __nwc: usize, __len: usize, noalias __ps: [*c]mbstate_t) usize; + + /// wchar_t *wcspbrk(const wchar_t *ws1, const wchar_t *ws2); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/wcspbrk.html + pub extern fn wcspbrk(__wcs: [*c]const wchar_t, __accept: [*c]const wchar_t) [*c]wchar_t; + + /// wchar_t *wcsrchr(const wchar_t *ws, wchar_t wc); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/wcsrchr.html + pub extern fn wcsrchr(__wcs: [*c]const wchar_t, __wc: wchar_t) [*c]wchar_t; + + /// size_t wcsrtombs(char *restrict dst, const wchar_t **restrict src, size_t len, mbstate_t *restrict ps); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/wcsrtombs.html + // pub extern fn wcsrtombs(noalias __dst: [*c]u8, noalias __src: [*c][*c]const wchar_t, __len: usize, noalias __ps: [*c]mbstate_t) usize; + + /// size_t wcsspn(const wchar_t *ws1, const wchar_t *ws2); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/wcsspn.html + pub extern fn wcsspn(__wcs: [*c]const wchar_t, __accept: [*c]const wchar_t) usize; + + /// wchar_t *wcsstr(const wchar_t *restrict ws1, const wchar_t *restrict ws2); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/wcsstr.html + pub extern fn wcsstr(__haystack: [*c]const wchar_t, __needle: [*c]const wchar_t) [*c]wchar_t; + + /// double wcstod(const wchar_t *restrict nptr, wchar_t **restrict endptr); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/wcstod.html + pub extern fn wcstod(noalias __nptr: [*c]const wchar_t, noalias __endptr: [*c][*c]wchar_t) f64; + + /// float wcstof(const wchar_t *restrict nptr, wchar_t **restrict endptr); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/wcstof.html + pub extern fn wcstof(noalias __nptr: [*c]const wchar_t, noalias __endptr: [*c][*c]wchar_t) f32; + + /// intmax_t wcstoimax(const wchar_t *restrict nptr, wchar_t **restrict endptr, int base); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/wcstoimax.html + // pub extern fn wcstoimax(noalias __nptr: [*c]const __gwchar_t, noalias __endptr: [*c][*c]__gwchar_t, __base: c_int) intmax_t; + + /// wchar_t *wcstok(wchar_t *restrict ws1, const wchar_t *restrict ws2, wchar_t **restrict ptr); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/wcstok.html + pub extern fn wcstok(noalias __s: [*c]wchar_t, noalias __delim: [*c]const wchar_t, noalias __ptr: [*c][*c]wchar_t) [*c]wchar_t; + + /// long wcstol(const wchar_t *restrict nptr, wchar_t **restrict endptr, int base); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/wcstol.html + pub extern fn wcstol(noalias __nptr: [*c]const wchar_t, noalias __endptr: [*c][*c]wchar_t, __base: c_int) c_long; + + /// long double wcstold(const wchar_t *restrict nptr, wchar_t **restrict endptr); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/wcstold.html + pub extern fn wcstold(noalias __nptr: [*c]const wchar_t, noalias __endptr: [*c][*c]wchar_t) c_longdouble; + + /// long long wcstoll(const wchar_t *restrict nptr, wchar_t **restrict endptr, int base); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/wcstoll.html + pub extern fn wcstoll(noalias __nptr: [*c]const wchar_t, noalias __endptr: [*c][*c]wchar_t, __base: c_int) c_longlong; + + /// size_t wcstombs(char *restrict s, const wchar_t *restrict pwcs, size_t n); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/wcstombs.html + pub extern fn wcstombs(noalias __s: [*c]u8, noalias __pwcs: [*c]const wchar_t, __n: usize) usize; + + /// unsigned long wcstoul(const wchar_t *restrict nptr, wchar_t **restrict endptr, int base); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/wcstoul.html + pub extern fn wcstoul(noalias __nptr: [*c]const wchar_t, noalias __endptr: [*c][*c]wchar_t, __base: c_int) c_ulong; + + /// unsigned long long wcstoull(const wchar_t *restrict nptr, wchar_t **restrict endptr, int base); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/wcstoull.html + pub extern fn wcstoull(noalias __nptr: [*c]const wchar_t, noalias __endptr: [*c][*c]wchar_t, __base: c_int) c_ulonglong; + + /// uintmax_t wcstoumax(const wchar_t *restrict nptr, wchar_t **restrict endptr, int base); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/wcstoumax.html + // pub extern fn wcstoumax(noalias __nptr: [*c]const __gwchar_t, noalias __endptr: [*c][*c]__gwchar_t, __base: c_int) uintmax_t; + + /// int wcswidth(const wchar_t *pwcs, size_t n); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/wcswidth.html + pub const wcswidth = @compileError("TODO wcswidth"); + + /// size_t wcsxfrm(wchar_t *restrict ws1, const wchar_t *restrict ws2, size_t n); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/wcsxfrm.html + pub extern fn wcsxfrm(noalias __s1: [*c]wchar_t, noalias __s2: [*c]const wchar_t, __n: usize) usize; + + /// size_t wcsxfrm_l(wchar_t *restrict ws1, const wchar_t *restrict ws2, size_t n, locale_t locale); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/wcsxfrm_l.html + pub extern fn wcsxfrm_l(__s1: [*c]wchar_t, __s2: [*c]const wchar_t, __n: usize, __loc: locale_t) usize; + + /// int wctob(wint_t c); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/wctob.html + pub extern fn wctob(c: wint_t) c_int; + + /// int wctomb(char *s, wchar_t wchar); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/wctomb.html + pub extern fn wctomb(__s: [*c]u8, __wchar: wchar_t) c_int; + + /// wctrans_t wctrans(const char *charclass); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/wctrans.html + // pub extern fn wctrans(__property: [*c]const u8) wctrans_t; + + /// wctrans_t wctrans_l(const char *charclass, locale_t locale); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/wctrans_l.html + // pub extern fn wctrans_l(__property: [*c]const u8, __locale: locale_t) wctrans_t; + + /// wctype_t wctype(const char *property); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/wctype.html + // pub extern fn wctype(__property: [*c]const u8) wctype_t; + + /// wctype_t wctype_l(const char *property, locale_t locale); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/wctype_l.html + // pub extern fn wctype_l(__property: [*c]const u8, __locale: locale_t) wctype_t; + + /// int wcwidth(wchar_t wc); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/wcwidth.html + pub extern fn wcwidth(wc: wchar_t) c_int; + + /// wchar_t *wmemchr(const wchar_t *ws, wchar_t wc, size_t n); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/wmemchr.html + pub extern fn wmemchr(__s: [*c]const c_int, __c: c_int, __n: c_ulong) [*c]c_int; + + /// int wmemcmp(const wchar_t *ws1, const wchar_t *ws2, size_t n); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/wmemcmp.html + pub extern fn wmemcmp(__s1: [*c]const c_int, __s2: [*c]const c_int, __n: c_ulong) c_int; + + /// wchar_t *wmemcpy(wchar_t *restrict ws1, const wchar_t *restrict ws2, size_t n); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/wmemcpy.html + pub extern fn wmemcpy(__s1: [*c]c_int, __s2: [*c]const c_int, __n: c_ulong) [*c]c_int; + + /// wchar_t *wmemmove(wchar_t *ws1, const wchar_t *ws2, size_t n); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/wmemmove.html + pub extern fn wmemmove(__s1: [*c]c_int, __s2: [*c]const c_int, __n: c_ulong) [*c]c_int; + + /// wchar_t *wmemset(wchar_t *ws, wchar_t wc, size_t n); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/wmemset.html + pub extern fn wmemset(__s: [*c]wchar_t, __c: wchar_t, __n: usize) [*c]wchar_t; + + /// int wordexp(const char *restrict words, wordexp_t *restrict pwordexp, int flags); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/wordexp.html + // pub extern fn wordexp(noalias __words: [*c]const u8, noalias __pwordexp: [*c]wordexp_t, __flags: c_int) c_int; + + /// void wordfree(wordexp_t *pwordexp); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/wordfree.html + // pub extern fn wordfree(__wordexp: [*c]wordexp_t) void; + + /// int wprintf(const wchar_t *restrict format, ...); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/wprintf.html + pub extern fn wprintf(noalias __format: [*c]const wchar_t, ...) c_int; + + /// ssize_t write(int fildes, const void *buf, size_t nbyte); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/write.html + pub extern fn write(fd: c_int, buf: *const anyopaque, n: usize) isize; + + /// ssize_t writev(int fildes, const struct iovec *iov, int iovcnt); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/writev.html + pub extern fn writev(fd: c_int, iovec: [*]const struct_iovec, count: c_int) isize; + + /// int wscanf(const wchar_t *restrict format, ...); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/wscanf.html + pub extern fn wscanf(noalias __format: [*c]const wchar_t, ...) c_int; + + /// double y0(double x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/y0.html + pub extern fn y0(x: f64) f64; + + /// double y1(double x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/y1.html + pub extern fn y1(x: f64) f64; + + /// double yn(int n, double x); + /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/yn.html + pub extern fn yn(n: c_int, x: f64) f64; + + // + // + + pub extern fn __errno_location() *c_int; + pub extern fn gettid() pid_t; + pub extern fn accept4(socket: c_int, noalias address: ?*struct_sockaddr, noalias address_len: *socklen_t, flags: c_int) c_int; + pub extern fn memfd_create(name: [*:0]const u8, flags: c_uint) c_int; + pub extern fn sendfile(out_fd: c_int, in_fd: c_int, offset: ?*const off_t, count: usize) isize; + pub extern fn getdents(dirfd: c_int, buf: [*]u8, nbytes: usize) c_int; + pub extern fn sched_getaffinity(pid: pid_t, cpusetsize: usize, mask: *cpu_set_t) c_int; + pub extern fn getrandom(buf: [*]u8, size: usize, flags: c_uint) isize; + pub extern fn flock(fd: c_int, op: c_int) c_int; + pub extern fn copy_file_range(fd_int: c_int, off_in: ?*off_t, fd_out: c_int, off_out: ?*off_t, size: usize, flags: c_uint) isize; + pub extern fn arc4random_buf(buf: [*]u8, n: usize) void; +}; + +comptime { + const C = struct { + fn getdents(dirfd: c_int, buf: [*]u8, nbytes: usize) callconv(.c) c_int { + const rc = std.os.linux.syscall3(.getdents64, @intCast(dirfd), @intFromPtr(buf), nbytes); + const signed_r: isize = @bitCast(rc); + if (signed_r < 0 and signed_r > -4096) { + libc.__errno_location().* = @intCast(-signed_r); + return -1; + } + return @intCast(rc); + } + }; + if (builtin.abi.isGnu()) @export(&C.getdents, .{ .name = "getdents", .linkage = .weak }); // glibc chooses to only expose this as getdents64 +} + +pub const clock_t = c_long; +pub const pid_t = c_int; +pub const gid_t = c_uint; +pub const uid_t = c_uint; +pub const struct_group = opaque {}; +pub const struct_hostent = opaque {}; +pub const struct_netent = opaque {}; +pub const struct_protoent = opaque {}; +pub const struct_passwd = opaque {}; +pub const struct_servent = opaque {}; +pub const struct_utmpx = opaque {}; +pub const wint_t = c_uint; +pub const struct_if_nameindex = opaque {}; +pub const struct_lconv = opaque {}; +pub const FILE = opaque {}; +pub const locale_t = *const opaque {}; +pub const nl_catd = *const opaque {}; +pub const intmax_t = i64; +pub const wchar_t = c_int; +pub const mode_t = c_uint; +pub const socklen_t = c_uint; +pub const clockid_t = c_int; +pub const struct_timespec = extern struct { sec: isize, nsec: isize }; +pub const struct_timeval = linux.timeval; +pub const DIR = opaque {}; +pub const time_t = i64; +pub const div_t = extern struct { quot: c_int, rem: c_int }; +pub const off_t = i64; +pub const ino_t = u64; +pub const dev_t = u64; +pub const nlink_t = c_ulong; +pub const blksize_t = c_long; +pub const blkcnt_t = i64; +pub const struct_stat = switch (arch) { + .mips64, .mips64el => extern struct { dev: dev_t, __pad1: [3]c_int, ino: ino_t, mode: mode_t, nlink: nlink_t, uid: uid_t, gid: gid_t, rdev: dev_t, __pad2: [2]c_uint, size: off_t, __pad3: c_int, atim: struct_timespec, mtim: struct_timespec, ctim: struct_timespec, blksize: blksize_t, __pad4: c_uint, blocks: blkcnt_t, __pad5: [14]c_int }, + .powerpc64, .powerpc64le => extern struct { dev: dev_t, ino: ino_t, nlink: nlink_t, mode: mode_t, uid: uid_t, gid: gid_t, rdev: dev_t, size: off_t, blksize: blksize_t, blocks: blkcnt_t, atim: struct_timespec, mtim: struct_timespec, ctim: struct_timespec, __unused: [3]c_ulong }, + .s390x => extern struct { dev: dev_t, ino: ino_t, nlink: nlink_t, mode: mode_t, uid: uid_t, gid: gid_t, rdev: dev_t, size: off_t, atim: struct_timespec, mtim: struct_timespec, ctim: struct_timespec, blksize: blksize_t, blocks: blkcnt_t, __unused: [3]c_ulong }, + .x86_64 => extern struct { dev: dev_t, ino: ino_t, nlink: nlink_t, mode: mode_t, uid: uid_t, gid: gid_t, __pad0: c_uint, rdev: dev_t, size: off_t, blksize: blksize_t, blocks: blkcnt_t, atim: struct_timespec, mtim: struct_timespec, ctim: struct_timespec, __unused: [3]c_long }, + // generic + .aarch64, + .riscv64, + => extern struct { dev: dev_t, ino: ino_t, mode: mode_t, nlink: nlink_t, uid: uid_t, gid: gid_t, rdev: dev_t, __pad: c_ulonglong, size: off_t, blksize: blksize_t, __pad2: c_int, blocks: blkcnt_t, atim: struct_timespec, mtim: struct_timespec, ctim: struct_timespec, __unused: [2]c_uint }, + else => unreachable, +}; +pub const struct_iovec = extern struct { base: [*]u8, len: usize }; +pub const in_addr_t = u32; +pub const in_port_t = u16; +pub const sa_family_t = c_ushort; +pub const struct_in_addr = extern struct { addr: in_addr_t }; +pub const struct_in6_addr = extern struct { addr: [16]u8 }; +pub const struct_sockaddr = extern struct { family: AF, data: [14]u8 }; +pub const struct_sockaddr_in = extern struct { family: AF = .INET, port: in_port_t, addr: struct_in_addr, zero: [8]u8 = @splat(0) }; +pub const struct_sockaddr_in6 = extern struct { family: AF = .INET6, port: in_port_t, flowinfo: u32, addr: struct_in6_addr, scope_id: u32 }; +pub const struct_sockaddr_un = extern struct { family: AF = .UNIX, path: [108]u8 }; +pub const struct_addrinfo = extern struct { flags: c_int, family: c_int, socktype: c_int, protocol: c_int, addrlen: socklen_t, addr: ?*struct_sockaddr, canonname: ?[*:0]u8, next: ?*struct_addrinfo }; +pub const struct_dirent = extern struct { ino: ino_t, off: off_t, reclen: c_ushort, type: DT, name: [NAME_MAX + 1]u8 }; +pub const cpu_set_t = [1024 / 8 / @sizeOf(c_ulong)]c_ulong; +pub const nfds_t = c_ulong; +pub const struct_pollfd = extern struct { fd: c_int, events: c_short, revents: c_short }; +pub const struct_tm = extern struct { sec: c_int, min: c_int, hour: c_int, mday: c_int, mon: c_int, year: c_int, wday: c_int, yday: c_int, isdst: c_int, gmtoff: c_long, zone: [*:0]const u8 }; + +const impdef = @cImport({ + @cInclude("pthread.h"); + @cInclude("termios.h"); +}); +pub const pthread_t = impdef.pthread_t; +pub const pthread_attr_t = impdef.pthread_attr_t; +pub const pthread_mutexattr_t = impdef.pthread_mutexattr_t; +pub const pthread_mutex_t = impdef.pthread_mutex_t; +pub const pthread_condattr_t = impdef.pthread_condattr_t; +pub const pthread_cond_t = impdef.pthread_cond_t; +pub const pthread_rwlockattr_t = impdef.pthread_rwlockattr_t; +pub const pthread_rwlock_t = impdef.pthread_rwlock_t; +pub const struct_termios = impdef.struct_termios; + +pub const AT = struct { + pub const FDCWD = -100; + pub const SYMLINK_NOFOLLOW = 0x100; + pub const REMOVEDIR = 0x200; + pub const SYMLINK_FOLLOW = 0x400; + pub const EACCESS = 0x200; +}; + +pub const O = struct { + pub const CREAT = if (arch != .mips64el) 0o100 else 0o400; + pub const EXCL = if (arch != .mips64el) 0o200 else 0o2000; + pub const NOCTTY = if (arch != .mips64el) 0o400 else 0o4000; + pub const TRUNC = 0o1000; + pub const APPEND = if (arch != .mips64el) 0o2000 else 0o010; + pub const NONBLOCK = if (arch != .mips64el) 0o4000 else 0o200; + pub const DSYNC = if (arch != .mips64el) 0o10000 else 0o020; + pub const SYNC = if (arch != .mips64el) 0o4010000 else 0o40020; + pub const RSYNC = if (arch != .mips64el) 0o4010000 else 0o40020; + pub const DIRECTORY = if (arch == .aarch64 or arch == .powerpc64le) 0o40000 else 0o200000; + pub const NOFOLLOW = if (arch == .aarch64 or arch == .powerpc64le) 0o100000 else 0o400000; + pub const CLOEXEC = 0o2000000; + pub const ASYNC = if (arch != .mips64el) 0o20000 else 0o10000; + pub const DIRECT = switch (arch) { + .x86_64, .riscv64 => 0o40000, // generic + .aarch64 => 0o200000, + .powerpc64le => 0o400000, + .mips64el => 0o100000, + else => @compileError("TODO"), + }; + pub const LARGEFILE = switch (arch) { + .x86_64, .riscv64 => 0o100000, // generic + .aarch64 => 0o400000, + .powerpc64le => 0o200000, + .mips64el => 0o20000, + else => @compileError("TODO"), + }; + pub const NOATIME = 0o1000000; + pub const PATH = 0o10000000; + pub const TMPFILE = if (arch == .aarch64 or arch == .powerpc64le) 0o20040000 else 0o20200000; + pub const NDELAY = O.NONBLOCK; + pub const SEARCH = O.PATH; + pub const EXEC = O.PATH; + pub const TTY_INIT = 0; + pub const ACCMODE = (3 | O.SEARCH); + pub const RDONLY = 0; + pub const WRONLY = 1; + pub const RDWR = 2; +}; + +pub const S = struct { + pub const IFMT = 0o170000; + pub const IFDIR = 0o040000; + pub const IFCHR = 0o020000; + pub const IFBLK = 0o060000; + pub const IFREG = 0o100000; + pub const IFIFO = 0o010000; + pub const IFLNK = 0o120000; + pub const IFSOCK = 0o140000; + pub const IFWHT = 0o160000; //unused + + pub const ISUID = 0o4000; + pub const ISGID = 0o2000; + pub const ISVTX = 0o1000; + pub const IRUSR = 0o400; + pub const IWUSR = 0o200; + pub const IXUSR = 0o100; + pub const IRWXU = 0o700; + pub const IRGRP = 0o040; + pub const IWGRP = 0o020; + pub const IXGRP = 0o010; + pub const IRWXG = 0o070; + pub const IROTH = 0o004; + pub const IWOTH = 0o002; + pub const IXOTH = 0o001; + pub const IRWXO = 0o007; +}; + +pub const CLOCK = struct { + pub const REALTIME = 0; + pub const MONOTONIC = 1; + pub const PROCESS_CPUTIME_ID = 2; + pub const THREAD_CPUTIME_ID = 3; + pub const MONOTONIC_RAW = 4; + pub const REALTIME_COARSE = 5; + pub const MONOTONIC_COARSE = 6; + pub const BOOTTIME = 7; + pub const REALTIME_ALARM = 8; + pub const BOOTTIME_ALARM = 9; + pub const SGI_CYCLE = 10; + pub const TAI = 11; +}; + +pub const MAP = struct { + pub const FAILED = -1; + + pub const SHARED = 0x01; + pub const PRIVATE = 0x02; + pub const SHARED_VALIDATE = 0x03; + pub const TYPE = 0x0f; + pub const FIXED = 0x10; + pub const ANON = 0x20; + pub const ANONYMOUS = ANON; + pub const NORESERVE = 0x4000; + pub const GROWSDOWN = 0x0100; + pub const DENYWRITE = 0x0800; + pub const EXECUTABLE = 0x1000; + pub const LOCKED = 0x2000; + pub const POPULATE = 0x8000; + pub const NONBLOCK = 0x10000; + pub const STACK = 0x20000; + pub const HUGETLB = 0x40000; + pub const SYNC = 0x80000; + pub const FIXED_NOREPLACE = 0x100000; + pub const FILE = 0; + + pub const MAP_HUGE_SHIFT = 26; + pub const MAP_HUGE_MASK = 0x3f; + pub const MAP_HUGE_16KB = 14 << 26; + pub const MAP_HUGE_64KB = 16 << 26; + pub const MAP_HUGE_512KB = 19 << 26; + pub const MAP_HUGE_1MB = 20 << 26; + pub const MAP_HUGE_2MB = 21 << 26; + pub const MAP_HUGE_8MB = 23 << 26; + pub const MAP_HUGE_16MB = 24 << 26; + pub const MAP_HUGE_32MB = 25 << 26; + pub const MAP_HUGE_256MB = 28 << 26; + pub const MAP_HUGE_512MB = 29 << 26; + pub const MAP_HUGE_1GB = 30 << 26; + pub const MAP_HUGE_2GB = 31 << 26; + pub const MAP_HUGE_16GB = 34 << 26; +}; + +pub const PROT = struct { + pub const NONE = 0; + pub const READ = 1; + pub const WRITE = 2; + pub const EXEC = 4; + pub const GROWSDOWN = 0x01000000; + pub const GROWSUP = 0x02000000; +}; + +pub const NAME_MAX = 255; +pub const PATH_MAX = 4096; +pub const NGROUPS_MAX = 32; +pub const ARG_MAX = 131072; +pub const IOV_MAX = 1024; +pub const SYMLOOP_MAX = 40; +pub const TZNAME_MAX = 6; +pub const TTY_NAME_MAX = 32; +pub const HOST_NAME_MAX = 255; + +pub const AF = enum(sa_family_t) { + UNSPEC = 0, + LOCAL = 1, + INET = 2, + AX25 = 3, + IPX = 4, + APPLETALK = 5, + NETROM = 6, + BRIDGE = 7, + ATMPVC = 8, + X25 = 9, + INET6 = 10, + ROSE = 11, + DECnet = 12, + NETBEUI = 13, + SECURITY = 14, + KEY = 15, + NETLINK = 16, + PACKET = 17, + ASH = 18, + ECONET = 19, + ATMSVC = 20, + RDS = 21, + SNA = 22, + IRDA = 23, + PPPOX = 24, + WANPIPE = 25, + LLC = 26, + IB = 27, + MPLS = 28, + CAN = 29, + TIPC = 30, + BLUETOOTH = 31, + IUCV = 32, + RXRPC = 33, + ISDN = 34, + PHONET = 35, + IEEE802154 = 36, + CAIF = 37, + ALG = 38, + NFC = 39, + VSOCK = 40, + KCM = 41, + QIPCRTR = 42, + SMC = 43, + XDP = 44, + + pub const UNIX: AF = .LOCAL; + pub const FILE: AF = .LOCAL; + pub const ROUTE: AF = .NETLINK; +}; + +pub const SOCK = struct { + pub const STREAM = 1; + pub const DGRAM = 2; + pub const RAW = 3; + pub const RDM = 4; + pub const SEQPACKET = 5; + pub const DCCP = 6; + pub const PACKET = 10; + pub const CLOEXEC = 0o2000000; + pub const NONBLOCK = 0o4000; +}; + +pub const SHUT = enum(c_int) { + RD = 0, + WR = 1, + RDWR = 2, +}; + +pub const IPPROTO = struct { + pub const IP = 0; + pub const HOPOPTS = 0; + pub const ICMP = 1; + pub const IGMP = 2; + pub const IPIP = 4; + pub const TCP = 6; + pub const EGP = 8; + pub const PUP = 12; + pub const UDP = 17; + pub const IDP = 22; + pub const TP = 29; + pub const DCCP = 33; + pub const IPV6 = 41; + pub const ROUTING = 43; + pub const FRAGMENT = 44; + pub const RSVP = 46; + pub const GRE = 47; + pub const ESP = 50; + pub const AH = 51; + pub const ICMPV6 = 58; + pub const NONE = 59; + pub const DSTOPTS = 60; + pub const MTP = 92; + pub const BEETPH = 94; + pub const ENCAP = 98; + pub const PIM = 103; + pub const COMP = 108; + pub const SCTP = 132; + pub const MH = 135; + pub const UDPLITE = 136; + pub const MPLS = 137; + pub const ETHERNET = 143; + pub const RAW = 255; + pub const MPTCP = 262; +}; + +pub const SOL = struct { + pub const SOCKET = 1; + pub const IP = 0; + pub const IPV6 = 41; + pub const ICMPV6 = 58; + pub const RAW = 255; + pub const DECNET = 261; + pub const X25 = 262; + pub const PACKET = 263; + pub const ATM = 264; + pub const AAL = 265; + pub const IRDA = 266; + pub const NETBEUI = 267; + pub const LLC = 268; + pub const DCCP = 269; + pub const NETLINK = 270; + pub const TIPC = 271; + pub const RXRPC = 272; + pub const PPPOL2TP = 273; + pub const BLUETOOTH = 274; + pub const PNPIPE = 275; + pub const RDS = 276; + pub const IUCV = 277; + pub const CAIF = 278; + pub const ALG = 279; + pub const NFC = 280; + pub const KCM = 281; + pub const TLS = 282; + pub const XDP = 283; +}; + +pub const SO = struct { + pub const DEBUG = 1; + pub const REUSEADDR = 2; + pub const TYPE = 3; + pub const ERROR = 4; + pub const DONTROUTE = 5; + pub const BROADCAST = 6; + pub const SNDBUF = 7; + pub const RCVBUF = 8; + pub const KEEPALIVE = 9; + pub const OOBINLINE = 10; + pub const NO_CHECK = 11; + pub const PRIORITY = 12; + pub const LINGER = 13; + pub const BSDCOMPAT = 14; + pub const REUSEPORT = 15; + pub const PASSCRED = 16; + pub const PEERCRED = 17; + pub const RCVLOWAT = 18; + pub const SNDLOWAT = 19; + + pub const RCVTIMEO = 20; + pub const SNDTIMEO = 21; + + pub const ACCEPTCONN = 30; + pub const PEERSEC = 31; + pub const SNDBUFFORCE = 32; + pub const RCVBUFFORCE = 33; + pub const PROTOCOL = 38; + pub const DOMAIN = 39; +}; + +pub const DT = enum(u8) { + UNKNOWN = 0, + FIFO = 1, + CHR = 2, + DIR = 4, + BLK = 6, + REG = 8, + LNK = 10, + SOCK = 12, + WHT = 14, +}; + +pub const GRND = struct { + pub const NONBLOCK = 0x0001; + pub const RANDOM = 0x0002; + pub const INSECURE = 0x0004; +}; + +pub const LOCK = struct { + pub const SH = 1; + pub const EX = 2; + pub const NB = 4; + pub const UN = 8; +}; + +pub const SIG = struct { + pub const HUP = 1; + pub const INT = 2; + pub const QUIT = 3; + pub const ILL = 4; + pub const TRAP = 5; + pub const ABRT = 6; + pub const IOT = ABRT; + pub const BUS = 7; + pub const FPE = 8; + pub const KILL = 9; + pub const USR1 = 10; + pub const SEGV = 11; + pub const USR2 = 12; + pub const PIPE = 13; + pub const ALRM = 14; + pub const TERM = 15; + pub const STKFLT = 16; + pub const CHLD = 17; + pub const CONT = 18; + pub const STOP = 19; + pub const TSTP = 20; + pub const TTIN = 21; + pub const TTOU = 22; + pub const URG = 23; + pub const XCPU = 24; + pub const XFSZ = 25; + pub const VTALRM = 26; + pub const PROF = 27; + pub const WINCH = 28; + pub const IO = 29; + pub const POLL = 29; + pub const PWR = 30; + pub const SYS = 31; + pub const UNUSED = SYS; +}; + +pub const POLL = struct { + pub const IN = 0x001; + pub const PRI = 0x002; + pub const OUT = 0x004; + pub const ERR = 0x008; + pub const HUP = 0x010; + pub const NVAL = 0x020; + pub const RDNORM = 0x040; + pub const RDBAND = 0x080; + pub const WRNORM = if (arch.isMIPS()) OUT else 0x100; + pub const WRBAND = if (arch.isMIPS()) 0x100 else 0x200; + pub const MSG = 0x400; + pub const RDHUP = 0x2000; +}; + +pub const W = struct { + pub const NOHANG = 1; + pub const UNTRACED = 2; + pub const STOPPED = 2; + pub const EXITED = 4; + pub const CONTINUED = 8; + pub const NOWAIT = 0x1000000; + + pub fn EXITSTATUS(s: c_int) u8 { + return @intCast((s & 0xff00) >> 8); + } + pub fn TERMSIG(s: c_int) u8 { + return @intCast(s & 0x7f); + } + pub fn STOPSIG(s: c_int) u8 { + return EXITSTATUS(s); + } + pub fn COREDUMP(s: c_int) c_uint { + return s & 0x80; + } + pub fn IFEXITED(s: c_int) bool { + return TERMSIG(s) == 0; + } + pub fn IFSTOPPED(s: c_int) bool { + return ((s & 0xffff) *% 0x10001) >> 8 > 0x7f00; + } + pub fn IFSIGNALED(s: c_int) bool { + return s & 0xffff -% 1 < 0xff; + } + pub fn IFCONTINUED(s: c_int) bool { + return s == 0xffff; + } +}; + +pub const SEEK = struct { + pub const SET = 0; + pub const CUR = 1; + pub const END = 2; + pub const DATA = 3; + pub const HOLE = 4; +}; + +pub const IPV6 = struct { + pub const ADDRFORM = 1; + pub const @"2292PKTINFO" = 2; + pub const @"2292HOPOPTS" = 3; + pub const @"2292DSTOPTS" = 4; + pub const @"2292RTHDR" = 5; + pub const @"2292PKTOPTIONS" = 6; + pub const CHECKSUM = 7; + pub const @"2292HOPLIMIT" = 8; + pub const NEXTHOP = 9; + pub const AUTHHDR = 10; + pub const UNICAST_HOPS = 16; + pub const MULTICAST_IF = 17; + pub const MULTICAST_HOPS = 18; + pub const MULTICAST_LOOP = 19; + pub const JOIN_GROUP = 20; + pub const LEAVE_GROUP = 21; + pub const ROUTER_ALERT = 22; + pub const MTU_DISCOVER = 23; + pub const MTU = 24; + pub const RECVERR = 25; + pub const V6ONLY = 26; + pub const JOIN_ANYCAST = 27; + pub const LEAVE_ANYCAST = 28; + pub const MULTICAST_ALL = 29; + pub const ROUTER_ALERT_ISOLATE = 30; + pub const IPSEC_POLICY = 34; + pub const XFRM_POLICY = 35; + pub const HDRINCL = 36; + pub const RECVPKTINFO = 49; + pub const PKTINFO = 50; + pub const RECVHOPLIMIT = 51; + pub const HOPLIMIT = 52; + pub const RECVHOPOPTS = 53; + pub const HOPOPTS = 54; + pub const RTHDRDSTOPTS = 55; + pub const RECVRTHDR = 56; + pub const RTHDR = 57; + pub const RECVDSTOPTS = 58; + pub const DSTOPTS = 59; + pub const RECVPATHMTU = 60; + pub const PATHMTU = 61; + pub const DONTFRAG = 62; + pub const RECVTCLASS = 66; + pub const TCLASS = 67; + pub const AUTOFLOWLABEL = 70; + pub const ADDR_PREFERENCES = 72; + pub const MINHOPCOUNT = 73; + pub const ORIGDSTADDR = 74; + pub const RECVORIGDSTADDR = ORIGDSTADDR; + pub const TRANSPARENT = 75; + pub const UNICAST_IF = 76; + pub const RECVFRAGSIZE = 77; + pub const FREEBIND = 78; +}; + +pub fn getpid() pid_t { + return libc.getpid(); +} +pub fn exit(status: c_int) noreturn { + return libc.exit(status); +} +pub fn getenv(name: [:0]const u8) ?[:0]u8 { + return std.mem.sliceTo(libc.getenv(name.ptr) orelse return null, 0); +} +pub fn openat(fd: c_int, file: [*:0]const u8, oflag: c_int) errno.Error!c_int { + const rc = libc.openat(fd, file, oflag); + if (rc == -1) return errno.fromInt(errno.fromLibC()); + return rc; +} +pub fn openat4(fd: c_int, file: [*:0]const u8, oflag: c_int, mode: mode_t) errno.Error!c_int { + const rc = libc.openat(fd, file, oflag, mode); + if (rc == -1) return errno.fromInt(errno.fromLibC()); + return rc; +} +pub fn close(fd: c_int) errno.Error!void { + const rc = libc.close(fd); + if (rc == -1) return errno.fromInt(errno.fromLibC()); + std.debug.assert(rc == 0); +} +pub fn read(fd: c_int, buf: []u8) errno.Error!usize { + const rc = libc.read(fd, buf.ptr, buf.len); + if (rc == -1) return errno.fromInt(errno.fromLibC()); + std.debug.assert(rc >= 0); + return @intCast(rc); +} +pub fn fstat(fd: c_int) errno.Error!struct_stat { + var buf: struct_stat = undefined; + const rc = libc.fstat(fd, &buf); + if (rc == -1) return errno.fromInt(errno.fromLibC()); + std.debug.assert(rc == 0); + return buf; +} +pub fn readv(fd: c_int, bufs: []const struct_iovec) errno.Error!usize { + std.debug.assert(bufs.len > 0); + std.debug.assert(bufs.len <= IOV_MAX); + const rc = libc.readv(fd, bufs.ptr, @intCast(bufs.len)); + if (rc == -1) return errno.fromInt(errno.fromLibC()); + std.debug.assert(rc >= 0); + return @intCast(rc); +} +pub fn mkdirat(fd: c_int, path: [*:0]const u8, mode: mode_t) errno.Error!void { + const rc = libc.mkdirat(fd, path, mode); + if (rc == -1) return errno.fromInt(errno.fromLibC()); + std.debug.assert(rc == 0); +} +pub fn pthread_self() pthread_t { + return libc.pthread_self(); +} +pub fn gettid() pid_t { + return libc.gettid(); +} +pub fn fstatat(fd: c_int, path: [*:0]const u8, flag: c_int) errno.Error!struct_stat { + var buf: struct_stat = undefined; + const rc = libc.fstatat(fd, path, &buf, flag); + if (rc == -1) return errno.fromInt(errno.fromLibC()); + std.debug.assert(rc == 0); + return buf; +} +pub fn socket(domain: AF, ty: c_int, protocol: c_int) errno.Error!c_uint { + const rc = libc.socket(@intFromEnum(domain), ty, protocol); + if (rc == -1) return errno.fromInt(errno.fromLibC()); + std.debug.assert(rc > 0); + return @intCast(rc); +} +pub fn listen(socketfd: c_uint, backlog: c_int) errno.Error!void { + const rc = libc.listen(@intCast(socketfd), backlog); + if (rc == -1) return errno.fromInt(errno.fromLibC()); + std.debug.assert(rc == 0); +} +pub fn bind(socketfd: c_uint, address: *const struct_sockaddr, address_len: socklen_t) errno.Error!void { + const rc = libc.bind(@intCast(socketfd), address, address_len); + if (rc == -1) return errno.fromInt(errno.fromLibC()); + std.debug.assert(rc == 0); +} +pub fn connect(socketfd: c_uint, address: *const struct_sockaddr, address_len: socklen_t) errno.Error!void { + const rc = libc.connect(@intCast(socketfd), address, address_len); + if (rc == -1) return errno.fromInt(errno.fromLibC()); + std.debug.assert(rc == 0); +} +pub fn shutdown(socketfd: c_uint, how: SHUT) errno.Error!void { + const rc = libc.shutdown(@intCast(socketfd), @intFromEnum(how)); + if (rc == -1) return errno.fromInt(errno.fromLibC()); + std.debug.assert(rc == 0); +} +pub fn setsockopt(socketfd: c_uint, level: c_int, optname: c_int, opaque_opt: []const u8) errno.Error!void { + const rc = libc.setsockopt(@intCast(socketfd), level, optname, opaque_opt.ptr, @intCast(opaque_opt.len)); + if (rc == -1) return errno.fromInt(errno.fromLibC()); + std.debug.assert(rc == 0); +} +pub fn accept4(socketfd: c_uint, noalias address: ?*struct_sockaddr, noalias address_len: *socklen_t, flags: c_int) errno.Error!c_uint { + const rc = libc.accept4(@intCast(socketfd), address, address_len, flags); + if (rc == -1) return errno.fromInt(errno.fromLibC()); + std.debug.assert(rc > 0); + return @intCast(rc); +} +pub fn send(socketfd: c_uint, buffer: []const u8, flags: c_int) errno.Error!usize { + const rc = libc.send(@intCast(socketfd), buffer.ptr, buffer.len, flags); + if (rc == -1) return errno.fromInt(errno.fromLibC()); + std.debug.assert(rc >= 0); + return @intCast(rc); +} +pub fn recv(socketfd: c_uint, buffer: []u8, flags: c_int) errno.Error!usize { + const rc = libc.recv(@intCast(socketfd), buffer.ptr, buffer.len, flags); + if (rc == -1) return errno.fromInt(errno.fromLibC()); + std.debug.assert(rc >= 0); + return @intCast(rc); +} +pub fn getaddrinfo(noalias nodename: ?[*:0]const u8, noalias servname: ?[*:0]const u8, noalias req: ?*const struct_addrinfo) eai.Error!*const struct_addrinfo { + var pai: *const struct_addrinfo = undefined; + var hints = std.mem.zeroes(struct_addrinfo); + const rc = libc.getaddrinfo(nodename, servname, req orelse &hints, &pai); + if (rc < 0) return eai.fromInt(rc); + std.debug.assert(rc == 0); + return pai; +} +pub fn freeaddrinfo(ai: *const struct_addrinfo) void { + return libc.freeaddrinfo(ai); +} +pub fn clock_gettime(clock_id: clockid_t) !struct_timespec { + var tp: struct_timespec = undefined; + const rc = libc.clock_gettime(clock_id, &tp); + if (rc == -1) return errno.fromInt(errno.fromLibC()); + std.debug.assert(rc == 0); + return tp; +} +pub fn memfd_create(name: [*:0]const u8, flags: c_uint) !c_int { + const rc = libc.memfd_create(name, flags); + if (rc == -1) return errno.fromInt(errno.fromLibC()); + std.debug.assert(rc >= 0); + return rc; +} +pub fn readlinkat(dirfd: c_int, noalias path: [*:0]const u8, noalias buf: []u8) ![:0]u8 { + const rc = libc.readlinkat(dirfd, path, buf.ptr, buf.len); + if (rc == -1) return errno.fromInt(errno.fromLibC()); + std.debug.assert(rc >= 0); + buf[@intCast(rc)] = 0; + return buf[0..@intCast(rc) :0]; +} +pub fn write(fd: c_int, buf: []const u8) !usize { + const rc = libc.write(fd, buf.ptr, buf.len); + if (rc == -1) return errno.fromInt(errno.fromLibC()); + std.debug.assert(rc >= 0); + return @intCast(rc); +} +pub fn writev(fd: c_int, iovec: []const struct_iovec) !usize { + const rc = libc.writev(fd, iovec.ptr, @intCast(iovec.len)); + if (rc == -1) return errno.fromInt(errno.fromLibC()); + std.debug.assert(rc >= 0); + return @intCast(rc); +} +pub fn getsockname(socketfd: c_uint, noalias address: *struct_sockaddr, noalias address_len: *socklen_t) errno.Error!void { + const rc = libc.getsockname(@intCast(socketfd), address, address_len); + if (rc == -1) return errno.fromInt(errno.fromLibC()); + std.debug.assert(rc == 0); +} +pub fn sendfile(out_fd: c_int, in_fd: c_int, offset: ?*const off_t, count: usize) errno.Error!usize { + const rc = libc.sendfile(out_fd, in_fd, offset, count); + if (rc == -1) return errno.fromInt(errno.fromLibC()); + std.debug.assert(rc >= 0); + return @intCast(rc); +} +pub fn getdents(dirfd: c_int, buf: []u8) errno.Error!usize { + const rc = libc.getdents(dirfd, buf.ptr, buf.len); + if (rc == -1) return errno.fromInt(errno.fromLibC()); + std.debug.assert(rc >= 0); + return @intCast(rc); +} +pub fn renameat(oldfd: c_int, old: [*:0]const u8, newfd: c_int, new: [*:0]const u8) !void { + const rc = libc.renameat(oldfd, old, newfd, new); + if (rc == -1) return errno.fromInt(errno.fromLibC()); + std.debug.assert(rc == 0); +} +pub fn mmap(addr: ?*anyopaque, len: usize, prot: c_int, flags: c_int, fd: c_int, offset: off_t) errno.Error![]u8 { + const rc = libc.mmap(addr, len, prot, flags, fd, offset); + if (@intFromPtr(rc) == MAP.FAILED) return errno.fromInt(errno.fromLibC()); + const ptr: [*]u8 = @ptrCast(rc); + return ptr[0..len]; +} +pub fn munmap(addr: *const anyopaque, len: usize) errno.Error!void { + const rc = libc.munmap(addr, len); + if (rc == -1) return errno.fromInt(errno.fromLibC()); + std.debug.assert(rc == 0); +} +pub fn sched_getaffinity(pid: pid_t) !cpu_set_t { + var cpuset: cpu_set_t = undefined; + const rc = libc.sched_getaffinity(pid, @sizeOf(cpu_set_t), &cpuset); + if (rc == -1) return errno.fromInt(errno.fromLibC()); + std.debug.assert(rc == 0); + return cpuset; +} +pub fn mkdtemp(template: [*:0]u8) ![*:0]u8 { + const rc = libc.mkdtemp(template); + if (rc == null) return errno.fromInt(errno.fromLibC()); + return rc.?; +} +pub fn getrandom(buf: []u8, flags: c_uint) ![]u8 { + const rc = libc.getrandom(buf.ptr, buf.len, flags); + if (rc == -1) return errno.fromInt(errno.fromLibC()); + std.debug.assert(rc >= 0); + return buf[0..@intCast(rc)]; +} +pub fn flock(fd: c_int, op: c_int) !void { + const rc = libc.flock(fd, op); + if (rc == -1) return errno.fromInt(errno.fromLibC()); + std.debug.assert(rc == 0); +} +pub fn futimens(fd: c_int, times: [2]struct_timespec) !void { + const rc = libc.futimens(fd, ×); + if (rc == -1) return errno.fromInt(errno.fromLibC()); + std.debug.assert(rc == 0); +} +pub fn faccessat(fd: c_int, path: [*:0]const u8, amode: c_int, flag: c_int) !void { + const rc = libc.faccessat(fd, path, amode, flag); + if (rc == -1) return errno.fromInt(errno.fromLibC()); + std.debug.assert(rc == 0); +} +pub fn pipe2(flag: c_int) ![2]c_int { + var fildes: [2]c_int = @splat(-1); + const rc = libc.pipe2(&fildes, flag); + if (rc == -1) return errno.fromInt(errno.fromLibC()); + std.debug.assert(rc == 0); + return fildes; +} +pub fn kill(pid: pid_t, sig: c_int) !void { + const rc = libc.kill(pid, sig); + if (rc == -1) return errno.fromInt(errno.fromLibC()); + std.debug.assert(rc == 0); +} +pub fn fork() !pid_t { + const rc = libc.fork(); + if (rc == -1) return errno.fromInt(errno.fromLibC()); + std.debug.assert(rc >= 0); + return rc; +} +pub fn fchdir(fildes: c_int) !void { + const rc = libc.fchdir(fildes); + if (rc == -1) return errno.fromInt(errno.fromLibC()); + std.debug.assert(rc == 0); +} +pub fn execvp(file: [*:0]const u8, argv: [*:null]const ?[*:0]const u8) !noreturn { + const rc = libc.execvp(file, argv); + std.debug.assert(rc == -1); + return errno.fromInt(errno.fromLibC()); +} +pub fn dup2(fildes: c_int, fildes2: c_int) !void { + const rc = libc.dup2(fildes, fildes2); + if (rc == -1) return errno.fromInt(errno.fromLibC()); + std.debug.assert(rc >= 0); +} +pub fn poll(fds: []struct_pollfd, timeout_ms: c_int) !c_int { + const rc = libc.poll(fds.ptr, fds.len, timeout_ms); + if (rc == -1) return errno.fromInt(errno.fromLibC()); + std.debug.assert(rc >= 0); + return rc; +} +pub fn waitpid(pid: pid_t, options: c_int) !struct { pid_t, c_int } { + var status: c_int = 0; + const rc = libc.waitpid(pid, &status, options); + if (rc == -1) return errno.fromInt(errno.fromLibC()); + std.debug.assert(rc >= 0); + return .{ rc, status }; +} +pub fn unlinkat(fd: c_int, name: [*:0]const u8, flag: c_int) !void { + const rc = libc.unlinkat(fd, name, flag); + if (rc == -1) return errno.fromInt(errno.fromLibC()); + std.debug.assert(rc == 0); +} +pub fn lseek(fd: c_int, offset: off_t, whence: c_int) !void { + const rc = libc.lseek(fd, offset, whence); + if (rc == -1) return errno.fromInt(errno.fromLibC()); + std.debug.assert(rc >= 0); +} +pub fn getcwd(buf: []u8) ![*:0]u8 { + const rc = libc.getcwd(buf.ptr, buf.len); + if (rc == null) return errno.fromInt(errno.fromLibC()); + return rc.?; +} +pub fn fchmod(fd: c_int, mode: mode_t) !void { + const rc = libc.fchmod(fd, mode); + if (rc == -1) return errno.fromInt(errno.fromLibC()); + std.debug.assert(rc == 0); +} +pub fn copy_file_range(fd_int: c_int, off_in: ?*off_t, fd_out: c_int, off_out: ?*off_t, size: usize, flags: c_uint) errno.Error!usize { + const rc = libc.copy_file_range(fd_int, off_in, fd_out, off_out, size, flags); + if (rc == -1) return errno.fromInt(errno.fromLibC()); + std.debug.assert(rc >= 0); + return @intCast(rc); +} +pub fn dup(fildes: c_int) !c_int { + const rc = libc.dup(fildes); + if (rc == -1) return errno.fromInt(errno.fromLibC()); + std.debug.assert(rc >= 0); + return rc; +} diff --git a/sys.zig b/sys.zig index 4d9da2bbe74f2d8d762d153fa74e2c1be442fb94..b88fb10928a82533ec10ac78a6b97076b6db8c61 100644 --- a/sys.zig +++ b/sys.zig @@ -2,5 +2,8 @@ const std = @import("std"); const builtin = @import("builtin"); pub const impl = switch (builtin.target.os.tag) { + .linux => linux, else => unreachable, }; + +pub const linux = @import("./linux.zig"); -- 2.54.0