2019-05-26 16:56:37 -07:00
|
|
|
const std = @import("std");
|
2020-02-24 22:52:27 -08:00
|
|
|
const builtin = std.builtin;
|
2019-05-26 16:56:37 -07:00
|
|
|
const page_size = std.mem.page_size;
|
2019-05-18 21:53:24 -07:00
|
|
|
|
2020-01-05 03:24:10 -08:00
|
|
|
pub const tokenizer = @import("c/tokenizer.zig");
|
2020-01-04 04:34:00 -08:00
|
|
|
pub const Token = tokenizer.Token;
|
|
|
|
pub const Tokenizer = tokenizer.Tokenizer;
|
2020-01-04 10:37:04 -08:00
|
|
|
pub const parse = @import("c/parse.zig").parse;
|
2020-01-04 04:34:00 -08:00
|
|
|
pub const ast = @import("c/ast.zig");
|
|
|
|
|
2019-05-29 15:55:42 -07:00
|
|
|
pub usingnamespace @import("os/bits.zig");
|
2017-03-22 23:59:58 -07:00
|
|
|
|
2020-02-24 22:52:27 -08:00
|
|
|
pub usingnamespace switch (std.Target.current.os.tag) {
|
2019-05-24 16:36:09 -07:00
|
|
|
.linux => @import("c/linux.zig"),
|
2019-05-18 21:53:24 -07:00
|
|
|
.windows => @import("c/windows.zig"),
|
|
|
|
.macosx, .ios, .tvos, .watchos => @import("c/darwin.zig"),
|
2019-11-07 22:52:23 -08:00
|
|
|
.freebsd, .kfreebsd => @import("c/freebsd.zig"),
|
2019-05-18 21:53:24 -07:00
|
|
|
.netbsd => @import("c/netbsd.zig"),
|
2019-10-22 15:06:35 -07:00
|
|
|
.dragonfly => @import("c/dragonfly.zig"),
|
2019-11-07 22:52:23 -08:00
|
|
|
.openbsd => @import("c/openbsd.zig"),
|
|
|
|
.haiku => @import("c/haiku.zig"),
|
|
|
|
.hermit => @import("c/hermit.zig"),
|
|
|
|
.solaris => @import("c/solaris.zig"),
|
|
|
|
.fuchsia => @import("c/fuchsia.zig"),
|
|
|
|
.minix => @import("c/minix.zig"),
|
|
|
|
.emscripten => @import("c/emscripten.zig"),
|
2019-03-13 10:45:51 -07:00
|
|
|
else => struct {},
|
2017-03-22 23:59:58 -07:00
|
|
|
};
|
|
|
|
|
2019-05-27 12:34:46 -07:00
|
|
|
pub fn getErrno(rc: var) u16 {
|
2019-05-18 21:53:24 -07:00
|
|
|
if (rc == -1) {
|
2019-05-27 12:34:46 -07:00
|
|
|
return @intCast(u16, _errno().*);
|
2019-05-18 21:53:24 -07:00
|
|
|
} else {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-07-08 11:26:40 -07:00
|
|
|
/// The return type is `type` to force comptime function call execution.
|
|
|
|
/// TODO: https://github.com/ziglang/zig/issues/425
|
|
|
|
/// If not linking libc, returns struct{pub const ok = false;}
|
|
|
|
/// If linking musl libc, returns struct{pub const ok = true;}
|
|
|
|
/// If linking gnu libc (glibc), the `ok` value will be true if the target
|
|
|
|
/// version is greater than or equal to `glibc_version`.
|
|
|
|
/// If linking a libc other than these, returns `false`.
|
|
|
|
pub fn versionCheck(glibc_version: builtin.Version) type {
|
|
|
|
return struct {
|
|
|
|
pub const ok = blk: {
|
|
|
|
if (!builtin.link_libc) break :blk false;
|
2020-02-24 22:52:27 -08:00
|
|
|
if (std.Target.current.abi.isMusl()) break :blk true;
|
|
|
|
if (std.Target.current.isGnuLibC()) {
|
|
|
|
const ver = std.Target.current.os.version_range.linux.glibc;
|
|
|
|
const order = ver.order(glibc_version);
|
|
|
|
break :blk switch (order) {
|
|
|
|
.gt, .eq => true,
|
|
|
|
.lt => false,
|
|
|
|
};
|
|
|
|
} else {
|
|
|
|
break :blk false;
|
2019-07-08 11:26:40 -07:00
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2020-02-22 12:59:13 -08:00
|
|
|
pub extern "c" var environ: [*:null]?[*:0]u8;
|
|
|
|
|
2019-12-17 12:43:49 -08:00
|
|
|
pub extern "c" fn fopen(filename: [*:0]const u8, modes: [*:0]const u8) ?*FILE;
|
2019-04-24 21:24:25 -07:00
|
|
|
pub extern "c" fn fclose(stream: *FILE) c_int;
|
2019-04-21 14:24:58 -07:00
|
|
|
pub extern "c" fn fwrite(ptr: [*]const u8, size_of_type: usize, item_count: usize, stream: *FILE) usize;
|
|
|
|
pub extern "c" fn fread(ptr: [*]u8, size_of_type: usize, item_count: usize, stream: *FILE) usize;
|
|
|
|
|
2019-11-23 01:45:35 -08:00
|
|
|
pub extern "c" fn printf(format: [*:0]const u8, ...) c_int;
|
2018-01-25 01:10:11 -08:00
|
|
|
pub extern "c" fn abort() noreturn;
|
|
|
|
pub extern "c" fn exit(code: c_int) noreturn;
|
2019-05-19 22:15:23 -07:00
|
|
|
pub extern "c" fn isatty(fd: fd_t) c_int;
|
|
|
|
pub extern "c" fn close(fd: fd_t) c_int;
|
2020-01-15 00:15:24 -08:00
|
|
|
pub extern "c" fn fstatat(dirfd: fd_t, path: [*:0]const u8, stat_buf: *Stat, flags: u32) c_int;
|
2019-09-21 20:55:56 -07:00
|
|
|
pub extern "c" fn lseek(fd: fd_t, offset: off_t, whence: c_int) off_t;
|
2019-12-17 12:43:49 -08:00
|
|
|
pub extern "c" fn open(path: [*:0]const u8, oflag: c_uint, ...) c_int;
|
|
|
|
pub extern "c" fn openat(fd: c_int, path: [*:0]const u8, oflag: c_uint, ...) c_int;
|
2020-03-11 12:56:43 -07:00
|
|
|
pub extern "c" fn ftruncate(fd: c_int, length: off_t) c_int;
|
2018-01-25 01:10:11 -08:00
|
|
|
pub extern "c" fn raise(sig: c_int) c_int;
|
2019-05-19 22:15:23 -07:00
|
|
|
pub extern "c" fn read(fd: fd_t, buf: [*]u8, nbyte: usize) isize;
|
2019-09-09 21:25:37 -07:00
|
|
|
pub extern "c" fn readv(fd: c_int, iov: [*]const iovec, iovcnt: c_uint) isize;
|
2019-05-19 22:15:23 -07:00
|
|
|
pub extern "c" fn pread(fd: fd_t, buf: [*]u8, nbyte: usize, offset: u64) isize;
|
2019-09-25 12:57:13 -07:00
|
|
|
pub extern "c" fn preadv(fd: c_int, iov: [*]const iovec, iovcnt: c_uint, offset: u64) isize;
|
2019-08-16 20:19:13 -07:00
|
|
|
pub extern "c" fn writev(fd: c_int, iov: [*]const iovec_const, iovcnt: c_uint) isize;
|
2019-09-25 12:57:13 -07:00
|
|
|
pub extern "c" fn pwritev(fd: c_int, iov: [*]const iovec_const, iovcnt: c_uint, offset: u64) isize;
|
2019-05-19 22:15:23 -07:00
|
|
|
pub extern "c" fn write(fd: fd_t, buf: [*]const u8, nbyte: usize) isize;
|
|
|
|
pub extern "c" fn pwrite(fd: fd_t, buf: [*]const u8, nbyte: usize, offset: u64) isize;
|
2019-09-25 12:57:13 -07:00
|
|
|
pub extern "c" fn mmap(addr: ?*align(page_size) c_void, len: usize, prot: c_uint, flags: c_uint, fd: fd_t, offset: u64) *c_void;
|
2019-05-26 16:56:37 -07:00
|
|
|
pub extern "c" fn munmap(addr: *align(page_size) c_void, len: usize) c_int;
|
|
|
|
pub extern "c" fn mprotect(addr: *align(page_size) c_void, len: usize, prot: c_uint) c_int;
|
2019-12-17 12:43:49 -08:00
|
|
|
pub extern "c" fn unlink(path: [*:0]const u8) c_int;
|
|
|
|
pub extern "c" fn unlinkat(dirfd: fd_t, path: [*:0]const u8, flags: c_uint) c_int;
|
2018-06-03 22:09:15 -07:00
|
|
|
pub extern "c" fn getcwd(buf: [*]u8, size: usize) ?[*]u8;
|
2019-05-26 20:35:26 -07:00
|
|
|
pub extern "c" fn waitpid(pid: c_int, stat_loc: *c_uint, options: c_uint) c_int;
|
2018-01-25 01:10:11 -08:00
|
|
|
pub extern "c" fn fork() c_int;
|
2019-12-17 12:43:49 -08:00
|
|
|
pub extern "c" fn access(path: [*:0]const u8, mode: c_uint) c_int;
|
2020-02-16 10:25:30 -08:00
|
|
|
pub extern "c" fn faccessat(dirfd: fd_t, path: [*:0]const u8, mode: c_uint, flags: c_uint) c_int;
|
2019-05-19 22:15:23 -07:00
|
|
|
pub extern "c" fn pipe(fds: *[2]fd_t) c_int;
|
|
|
|
pub extern "c" fn pipe2(fds: *[2]fd_t, flags: u32) c_int;
|
2019-12-17 12:43:49 -08:00
|
|
|
pub extern "c" fn mkdir(path: [*:0]const u8, mode: c_uint) c_int;
|
2020-01-15 00:07:08 -08:00
|
|
|
pub extern "c" fn mkdirat(dirfd: fd_t, path: [*:0]const u8, mode: u32) c_int;
|
2019-12-17 12:43:49 -08:00
|
|
|
pub extern "c" fn symlink(existing: [*:0]const u8, new: [*:0]const u8) c_int;
|
|
|
|
pub extern "c" fn rename(old: [*:0]const u8, new: [*:0]const u8) c_int;
|
zig build system: correctly handle multiple output artifacts
Previously the zig build system incorrectly assumed that the only build
artifact was a binary. Now, when you enable the cache, only the output
dir is printed to stdout, and the zig build system iterates over the
files in that directory, copying them to the output directory.
To support this change:
* Add `std.os.renameat`, `std.os.renameatZ`, and `std.os.renameatW`.
* Fix `std.os.linux.renameat` not compiling due to typos.
* Deprecate `std.fs.updateFile` and `std.fs.updateFileMode`.
* Add `std.fs.Dir.updateFile`, which supports using open directory
handles for both the source and destination paths, as well as an
options parameter which allows overriding the mode.
* Update `std.fs.AtomicFile` to support operating based on an open
directory handle. Instead of `std.fs.AtomicFile.init`, use
`std.fs.Dir.atomicFile`.
* `std.fs.AtomicFile` deinit() better handles the situation when the
rename fails but the temporary file still exists, by still
attempting to remove the temporary file.
* `std.fs.Dir.openFileWindows` is moved to `std.os.windows.OpenFileW`.
* `std.os.RenameError` gains the error codes `NoDevice`,
`SharingViolation`, and `PipeBusy` which have been observed from
Windows.
Closes #4733
2020-03-13 18:06:07 -07:00
|
|
|
pub extern "c" fn renameat(olddirfd: fd_t, old: [*:0]const u8, newdirfd: fd_t, new: [*:0]const u8) c_int;
|
2019-12-17 12:43:49 -08:00
|
|
|
pub extern "c" fn chdir(path: [*:0]const u8) c_int;
|
2020-01-15 00:11:54 -08:00
|
|
|
pub extern "c" fn fchdir(fd: fd_t) c_int;
|
2019-12-17 12:43:49 -08:00
|
|
|
pub extern "c" fn execve(path: [*:0]const u8, argv: [*:null]const ?[*:0]const u8, envp: [*:null]const ?[*:0]const u8) c_int;
|
2019-05-19 22:15:23 -07:00
|
|
|
pub extern "c" fn dup(fd: fd_t) c_int;
|
|
|
|
pub extern "c" fn dup2(old_fd: fd_t, new_fd: fd_t) c_int;
|
2019-12-17 12:43:49 -08:00
|
|
|
pub extern "c" fn readlink(noalias path: [*:0]const u8, noalias buf: [*]u8, bufsize: usize) isize;
|
2020-02-27 16:49:00 -08:00
|
|
|
pub extern "c" fn readlinkat(dirfd: fd_t, noalias path: [*:0]const u8, noalias buf: [*]u8, bufsize: usize) isize;
|
2020-05-12 12:53:33 -07:00
|
|
|
|
|
|
|
pub usingnamespace switch (builtin.os.tag) {
|
|
|
|
.macosx, .ios, .watchos, .tvos => struct {
|
|
|
|
pub const realpath = @"realpath$DARWIN_EXTSN";
|
|
|
|
},
|
|
|
|
else => struct {
|
|
|
|
pub extern "c" fn realpath(noalias file_name: [*:0]const u8, noalias resolved_name: [*]u8) ?[*:0]u8;
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2018-01-25 01:10:11 -08:00
|
|
|
pub extern "c" fn setreuid(ruid: c_uint, euid: c_uint) c_int;
|
|
|
|
pub extern "c" fn setregid(rgid: c_uint, egid: c_uint) c_int;
|
2019-12-17 12:43:49 -08:00
|
|
|
pub extern "c" fn rmdir(path: [*:0]const u8) c_int;
|
2019-11-24 18:12:01 -08:00
|
|
|
pub extern "c" fn getenv(name: [*:0]const u8) ?[*:0]u8;
|
2019-05-27 14:28:59 -07:00
|
|
|
pub extern "c" fn sysctl(name: [*]const c_int, namelen: c_uint, oldp: ?*c_void, oldlenp: ?*usize, newp: ?*c_void, newlen: usize) c_int;
|
2019-12-17 12:43:49 -08:00
|
|
|
pub extern "c" fn sysctlbyname(name: [*:0]const u8, oldp: ?*c_void, oldlenp: ?*usize, newp: ?*c_void, newlen: usize) c_int;
|
|
|
|
pub extern "c" fn sysctlnametomib(name: [*:0]const u8, mibp: ?*c_int, sizep: ?*usize) c_int;
|
2020-01-29 22:36:28 -08:00
|
|
|
pub extern "c" fn tcgetattr(fd: fd_t, termios_p: *termios) c_int;
|
|
|
|
pub extern "c" fn tcsetattr(fd: fd_t, optional_action: TCSA, termios_p: *const termios) c_int;
|
2020-02-07 09:11:15 -08:00
|
|
|
pub extern "c" fn fcntl(fd: fd_t, cmd: c_int, ...) c_int;
|
2020-04-02 21:57:02 -07:00
|
|
|
pub extern "c" fn flock(fd: fd_t, operation: c_int) c_int;
|
2020-02-28 00:11:37 -08:00
|
|
|
pub extern "c" fn uname(buf: *utsname) c_int;
|
2019-05-19 22:15:23 -07:00
|
|
|
|
2019-09-22 12:36:11 -07:00
|
|
|
pub extern "c" fn gethostname(name: [*]u8, len: usize) c_int;
|
2019-05-19 22:15:23 -07:00
|
|
|
pub extern "c" fn bind(socket: fd_t, address: ?*const sockaddr, address_len: socklen_t) c_int;
|
2020-03-24 11:14:01 -07:00
|
|
|
pub extern "c" fn socketpair(domain: c_uint, sock_type: c_uint, protocol: c_uint, sv: *[2]fd_t) c_int;
|
2019-05-26 20:35:26 -07:00
|
|
|
pub extern "c" fn listen(sockfd: fd_t, backlog: c_uint) c_int;
|
|
|
|
pub extern "c" fn getsockname(sockfd: fd_t, noalias addr: *sockaddr, noalias addrlen: *socklen_t) c_int;
|
|
|
|
pub extern "c" fn connect(sockfd: fd_t, sock_addr: *const sockaddr, addrlen: socklen_t) c_int;
|
2020-05-02 06:14:28 -07:00
|
|
|
pub extern "c" fn accept(sockfd: fd_t, addr: *sockaddr, addrlen: *socklen_t) c_int;
|
2019-05-26 20:35:26 -07:00
|
|
|
pub extern "c" fn accept4(sockfd: fd_t, addr: *sockaddr, addrlen: *socklen_t, flags: c_uint) c_int;
|
2020-03-24 11:14:01 -07:00
|
|
|
pub extern "c" fn getsockopt(sockfd: fd_t, level: u32, optname: u32, optval: ?*c_void, optlen: *socklen_t) c_int;
|
|
|
|
pub extern "c" fn setsockopt(sockfd: fd_t, level: u32, optname: u32, optval: ?*const c_void, optlen: socklen_t) c_int;
|
2019-10-28 23:19:22 -07:00
|
|
|
pub extern "c" fn send(sockfd: fd_t, buf: *const c_void, len: usize, flags: u32) isize;
|
|
|
|
pub extern "c" fn sendto(
|
|
|
|
sockfd: fd_t,
|
|
|
|
buf: *const c_void,
|
|
|
|
len: usize,
|
|
|
|
flags: u32,
|
2020-03-02 23:03:22 -08:00
|
|
|
dest_addr: ?*const sockaddr,
|
2019-10-28 23:19:22 -07:00
|
|
|
addrlen: socklen_t,
|
|
|
|
) isize;
|
|
|
|
|
|
|
|
pub extern fn recv(sockfd: fd_t, arg1: ?*c_void, arg2: usize, arg3: c_int) isize;
|
|
|
|
pub extern fn recvfrom(
|
|
|
|
sockfd: fd_t,
|
|
|
|
noalias buf: *c_void,
|
|
|
|
len: usize,
|
|
|
|
flags: u32,
|
|
|
|
noalias src_addr: ?*sockaddr,
|
|
|
|
noalias addrlen: ?*socklen_t,
|
|
|
|
) isize;
|
|
|
|
|
2020-04-01 03:00:37 -07:00
|
|
|
pub usingnamespace switch (builtin.os.tag) {
|
|
|
|
.netbsd => struct {
|
|
|
|
pub const clock_getres = __clock_getres50;
|
|
|
|
pub const clock_gettime = __clock_gettime50;
|
|
|
|
pub const fstat = __fstat50;
|
|
|
|
pub const getdents = __getdents30;
|
|
|
|
pub const getrusage = __getrusage50;
|
|
|
|
pub const gettimeofday = __gettimeofday50;
|
|
|
|
pub const nanosleep = __nanosleep50;
|
|
|
|
pub const sched_yield = __libc_thr_yield;
|
|
|
|
pub const sigaction = __sigaction14;
|
|
|
|
pub const sigaltstack = __sigaltstack14;
|
|
|
|
pub const sigprocmask = __sigprocmask14;
|
|
|
|
pub const stat = __stat50;
|
|
|
|
},
|
|
|
|
.macosx, .ios, .watchos, .tvos => struct {
|
|
|
|
// XXX: close -> close$NOCANCEL
|
|
|
|
// XXX: getdirentries -> _getdirentries64
|
|
|
|
pub extern "c" fn clock_getres(clk_id: c_int, tp: *timespec) c_int;
|
|
|
|
pub extern "c" fn clock_gettime(clk_id: c_int, tp: *timespec) c_int;
|
|
|
|
pub const fstat = @"fstat$INODE64";
|
|
|
|
pub extern "c" fn getrusage(who: c_int, usage: *rusage) c_int;
|
|
|
|
pub extern "c" fn gettimeofday(noalias tv: ?*timeval, noalias tz: ?*timezone) c_int;
|
|
|
|
pub extern "c" fn nanosleep(rqtp: *const timespec, rmtp: ?*timespec) c_int;
|
|
|
|
pub extern "c" fn sched_yield() c_int;
|
|
|
|
pub extern "c" fn sigaction(sig: c_int, noalias act: *const Sigaction, noalias oact: ?*Sigaction) c_int;
|
|
|
|
pub extern "c" fn sigprocmask(how: c_int, noalias set: ?*const sigset_t, noalias oset: ?*sigset_t) c_int;
|
|
|
|
pub extern "c" fn socket(domain: c_uint, sock_type: c_uint, protocol: c_uint) c_int;
|
|
|
|
pub extern "c" fn stat(noalias path: [*:0]const u8, noalias buf: *Stat) c_int;
|
|
|
|
},
|
|
|
|
else => struct {
|
|
|
|
pub extern "c" fn clock_getres(clk_id: c_int, tp: *timespec) c_int;
|
|
|
|
pub extern "c" fn clock_gettime(clk_id: c_int, tp: *timespec) c_int;
|
|
|
|
pub extern "c" fn fstat(fd: fd_t, buf: *Stat) c_int;
|
|
|
|
pub extern "c" fn getrusage(who: c_int, usage: *rusage) c_int;
|
|
|
|
pub extern "c" fn gettimeofday(noalias tv: ?*timeval, noalias tz: ?*timezone) c_int;
|
|
|
|
pub extern "c" fn nanosleep(rqtp: *const timespec, rmtp: ?*timespec) c_int;
|
|
|
|
pub extern "c" fn sched_yield() c_int;
|
|
|
|
pub extern "c" fn sigaction(sig: c_int, noalias act: *const Sigaction, noalias oact: ?*Sigaction) c_int;
|
|
|
|
pub extern "c" fn sigprocmask(how: c_int, noalias set: ?*const sigset_t, noalias oset: ?*sigset_t) c_int;
|
|
|
|
pub extern "c" fn socket(domain: c_uint, sock_type: c_uint, protocol: c_uint) c_int;
|
|
|
|
pub extern "c" fn stat(noalias path: [*:0]const u8, noalias buf: *Stat) c_int;
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2019-05-19 22:15:23 -07:00
|
|
|
pub extern "c" fn kill(pid: pid_t, sig: c_int) c_int;
|
2019-05-24 19:52:07 -07:00
|
|
|
pub extern "c" fn getdirentries(fd: fd_t, buf_ptr: [*]u8, nbytes: usize, basep: *i64) isize;
|
2019-05-19 22:15:23 -07:00
|
|
|
pub extern "c" fn setgid(ruid: c_uint, euid: c_uint) c_int;
|
|
|
|
pub extern "c" fn setuid(uid: c_uint) c_int;
|
2017-10-17 05:13:04 -07:00
|
|
|
|
2018-06-05 15:03:21 -07:00
|
|
|
pub extern "c" fn aligned_alloc(alignment: usize, size: usize) ?*c_void;
|
|
|
|
pub extern "c" fn malloc(usize) ?*c_void;
|
2019-03-15 14:47:47 -07:00
|
|
|
pub extern "c" fn realloc(?*c_void, usize) ?*c_void;
|
2018-06-05 15:03:21 -07:00
|
|
|
pub extern "c" fn free(*c_void) void;
|
|
|
|
pub extern "c" fn posix_memalign(memptr: **c_void, alignment: usize, size: usize) c_int;
|
2018-04-28 20:30:13 -07:00
|
|
|
|
2019-11-04 07:15:52 -08:00
|
|
|
pub extern "c" fn futimes(fd: fd_t, times: *[2]timeval) c_int;
|
2019-12-17 12:43:49 -08:00
|
|
|
pub extern "c" fn utimes(path: [*:0]const u8, times: *[2]timeval) c_int;
|
2019-11-04 07:15:52 -08:00
|
|
|
|
2019-12-17 12:43:49 -08:00
|
|
|
pub extern "c" fn utimensat(dirfd: fd_t, pathname: [*:0]const u8, times: *[2]timespec, flags: u32) c_int;
|
2019-07-14 00:06:20 -07:00
|
|
|
pub extern "c" fn futimens(fd: fd_t, times: *const [2]timespec) c_int;
|
|
|
|
|
2020-05-04 08:49:27 -07:00
|
|
|
pub extern "c" fn pthread_create(noalias newthread: *pthread_t, noalias attr: ?*const pthread_attr_t, start_routine: fn (?*c_void) callconv(.C) ?*c_void, noalias arg: ?*c_void) c_int;
|
2019-05-19 22:15:23 -07:00
|
|
|
pub extern "c" fn pthread_attr_init(attr: *pthread_attr_t) c_int;
|
|
|
|
pub extern "c" fn pthread_attr_setstack(attr: *pthread_attr_t, stackaddr: *c_void, stacksize: usize) c_int;
|
2020-03-23 15:26:34 -07:00
|
|
|
pub extern "c" fn pthread_attr_setguardsize(attr: *pthread_attr_t, guardsize: usize) c_int;
|
2019-05-19 22:15:23 -07:00
|
|
|
pub extern "c" fn pthread_attr_destroy(attr: *pthread_attr_t) c_int;
|
|
|
|
pub extern "c" fn pthread_self() pthread_t;
|
|
|
|
pub extern "c" fn pthread_join(thread: pthread_t, arg_return: ?*?*c_void) c_int;
|
2018-04-28 20:30:13 -07:00
|
|
|
|
2019-05-19 22:15:23 -07:00
|
|
|
pub extern "c" fn kqueue() c_int;
|
|
|
|
pub extern "c" fn kevent(
|
|
|
|
kq: c_int,
|
|
|
|
changelist: [*]const Kevent,
|
|
|
|
nchanges: c_int,
|
|
|
|
eventlist: [*]Kevent,
|
|
|
|
nevents: c_int,
|
|
|
|
timeout: ?*const timespec,
|
|
|
|
) c_int;
|
2019-10-26 12:05:42 -07:00
|
|
|
|
|
|
|
pub extern "c" fn getaddrinfo(
|
2019-12-17 12:43:49 -08:00
|
|
|
noalias node: [*:0]const u8,
|
|
|
|
noalias service: [*:0]const u8,
|
2019-10-26 12:05:42 -07:00
|
|
|
noalias hints: *const addrinfo,
|
|
|
|
noalias res: **addrinfo,
|
2020-01-17 18:12:18 -08:00
|
|
|
) EAI;
|
2019-10-26 12:05:42 -07:00
|
|
|
|
|
|
|
pub extern "c" fn freeaddrinfo(res: *addrinfo) void;
|
|
|
|
|
|
|
|
pub extern "c" fn getnameinfo(
|
|
|
|
noalias addr: *const sockaddr,
|
|
|
|
addrlen: socklen_t,
|
|
|
|
noalias host: [*]u8,
|
|
|
|
hostlen: socklen_t,
|
|
|
|
noalias serv: [*]u8,
|
|
|
|
servlen: socklen_t,
|
|
|
|
flags: u32,
|
2020-01-17 18:12:18 -08:00
|
|
|
) EAI;
|
2019-10-26 12:05:42 -07:00
|
|
|
|
2020-01-17 18:12:18 -08:00
|
|
|
pub extern "c" fn gai_strerror(errcode: EAI) [*:0]const u8;
|
2019-10-28 23:19:22 -07:00
|
|
|
|
|
|
|
pub extern "c" fn poll(fds: [*]pollfd, nfds: nfds_t, timeout: c_int) c_int;
|
2019-10-29 11:03:39 -07:00
|
|
|
|
|
|
|
pub extern "c" fn dn_expand(
|
2019-12-17 12:43:49 -08:00
|
|
|
msg: [*:0]const u8,
|
|
|
|
eomorig: [*:0]const u8,
|
|
|
|
comp_dn: [*:0]const u8,
|
|
|
|
exp_dn: [*:0]u8,
|
2019-10-29 11:03:39 -07:00
|
|
|
length: c_int,
|
|
|
|
) c_int;
|
2019-11-07 14:33:25 -08:00
|
|
|
|
2019-11-07 22:52:23 -08:00
|
|
|
pub const PTHREAD_MUTEX_INITIALIZER = pthread_mutex_t{};
|
|
|
|
pub extern "c" fn pthread_mutex_lock(mutex: *pthread_mutex_t) c_int;
|
|
|
|
pub extern "c" fn pthread_mutex_unlock(mutex: *pthread_mutex_t) c_int;
|
|
|
|
pub extern "c" fn pthread_mutex_destroy(mutex: *pthread_mutex_t) c_int;
|
|
|
|
|
|
|
|
pub const PTHREAD_COND_INITIALIZER = pthread_cond_t{};
|
|
|
|
pub extern "c" fn pthread_cond_wait(noalias cond: *pthread_cond_t, noalias mutex: *pthread_mutex_t) c_int;
|
2019-11-23 12:04:31 -08:00
|
|
|
pub extern "c" fn pthread_cond_timedwait(noalias cond: *pthread_cond_t, noalias mutex: *pthread_mutex_t, noalias abstime: *const timespec) c_int;
|
2019-11-07 22:52:23 -08:00
|
|
|
pub extern "c" fn pthread_cond_signal(cond: *pthread_cond_t) c_int;
|
2019-12-22 13:24:17 -08:00
|
|
|
pub extern "c" fn pthread_cond_broadcast(cond: *pthread_cond_t) c_int;
|
2019-11-07 22:52:23 -08:00
|
|
|
pub extern "c" fn pthread_cond_destroy(cond: *pthread_cond_t) c_int;
|
|
|
|
|
2020-04-27 22:14:40 -07:00
|
|
|
pub const pthread_t = *@Type(.Opaque);
|
|
|
|
pub const FILE = @Type(.Opaque);
|
2019-12-10 09:28:28 -08:00
|
|
|
|
|
|
|
pub extern "c" fn dlopen(path: [*:0]const u8, mode: c_int) ?*c_void;
|
|
|
|
pub extern "c" fn dlclose(handle: *c_void) c_int;
|
|
|
|
pub extern "c" fn dlsym(handle: ?*c_void, symbol: [*:0]const u8) ?*c_void;
|