2017-05-01 17:12:38 +00:00
|
|
|
const builtin = @import("builtin");
|
|
|
|
const Os = builtin.Os;
|
2017-03-23 06:59:58 +00:00
|
|
|
|
2017-05-01 17:12:38 +00:00
|
|
|
pub use switch(builtin.os) {
|
2017-03-26 10:39:28 +00:00
|
|
|
Os.linux => @import("linux.zig"),
|
|
|
|
Os.windows => @import("windows.zig"),
|
2018-01-07 04:10:53 +00:00
|
|
|
Os.macosx, Os.ios => @import("darwin.zig"),
|
2017-03-23 06:59:58 +00:00
|
|
|
else => empty_import,
|
|
|
|
};
|
2017-08-27 04:11:09 +00:00
|
|
|
const empty_import = @import("../empty.zig");
|
2017-03-23 06:59:58 +00:00
|
|
|
|
2018-01-25 09:10:11 +00:00
|
|
|
pub extern "c" fn abort() noreturn;
|
|
|
|
pub extern "c" fn exit(code: c_int) noreturn;
|
|
|
|
pub extern "c" fn isatty(fd: c_int) c_int;
|
|
|
|
pub extern "c" fn close(fd: c_int) c_int;
|
|
|
|
pub extern "c" fn fstat(fd: c_int, buf: &Stat) c_int;
|
|
|
|
pub extern "c" fn @"fstat$INODE64"(fd: c_int, buf: &Stat) c_int;
|
|
|
|
pub extern "c" fn lseek(fd: c_int, offset: isize, whence: c_int) isize;
|
|
|
|
pub extern "c" fn open(path: &const u8, oflag: c_int, ...) c_int;
|
|
|
|
pub extern "c" fn raise(sig: c_int) c_int;
|
|
|
|
pub extern "c" fn read(fd: c_int, buf: &c_void, nbyte: usize) isize;
|
|
|
|
pub extern "c" fn stat(noalias path: &const u8, noalias buf: &Stat) c_int;
|
2018-02-09 01:46:12 +00:00
|
|
|
pub extern "c" fn write(fd: c_int, buf: &const c_void, nbyte: usize) isize;
|
2017-08-27 04:11:09 +00:00
|
|
|
pub extern "c" fn mmap(addr: ?&c_void, len: usize, prot: c_int, flags: c_int,
|
2018-01-25 09:10:11 +00:00
|
|
|
fd: c_int, offset: isize) ?&c_void;
|
|
|
|
pub extern "c" fn munmap(addr: &c_void, len: usize) c_int;
|
|
|
|
pub extern "c" fn unlink(path: &const u8) c_int;
|
|
|
|
pub extern "c" fn getcwd(buf: &u8, size: usize) ?&u8;
|
|
|
|
pub extern "c" fn waitpid(pid: c_int, stat_loc: &c_int, options: c_int) c_int;
|
|
|
|
pub extern "c" fn fork() c_int;
|
2018-04-13 09:27:09 +00:00
|
|
|
pub extern "c" fn access(path: &const u8, mode: c_uint) c_int;
|
2018-01-25 09:10:11 +00:00
|
|
|
pub extern "c" fn pipe(fds: &c_int) c_int;
|
|
|
|
pub extern "c" fn mkdir(path: &const u8, mode: c_uint) c_int;
|
|
|
|
pub extern "c" fn symlink(existing: &const u8, new: &const u8) c_int;
|
|
|
|
pub extern "c" fn rename(old: &const u8, new: &const u8) c_int;
|
|
|
|
pub extern "c" fn chdir(path: &const u8) c_int;
|
2017-08-27 04:11:09 +00:00
|
|
|
pub extern "c" fn execve(path: &const u8, argv: &const ?&const u8,
|
2018-01-25 09:10:11 +00:00
|
|
|
envp: &const ?&const u8) c_int;
|
|
|
|
pub extern "c" fn dup(fd: c_int) c_int;
|
|
|
|
pub extern "c" fn dup2(old_fd: c_int, new_fd: c_int) c_int;
|
|
|
|
pub extern "c" fn readlink(noalias path: &const u8, noalias buf: &u8, bufsize: usize) isize;
|
|
|
|
pub extern "c" fn realpath(noalias file_name: &const u8, noalias resolved_name: &u8) ?&u8;
|
|
|
|
pub extern "c" fn sigprocmask(how: c_int, noalias set: &const sigset_t, noalias oset: ?&sigset_t) c_int;
|
2018-04-18 20:46:50 +00:00
|
|
|
pub extern "c" fn gettimeofday(tv: ?&timeval, tz: ?&timezone) c_int;
|
2018-01-25 09:10:11 +00:00
|
|
|
pub extern "c" fn sigaction(sig: c_int, noalias act: &const Sigaction, noalias oact: ?&Sigaction) c_int;
|
|
|
|
pub extern "c" fn nanosleep(rqtp: &const timespec, rmtp: ?×pec) c_int;
|
|
|
|
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;
|
2018-03-05 05:57:02 +00:00
|
|
|
pub extern "c" fn rmdir(path: &const u8) c_int;
|
2017-10-17 12:13:04 +00:00
|
|
|
|
2018-02-12 07:14:44 +00:00
|
|
|
pub extern "c" fn aligned_alloc(alignment: usize, size: usize) ?&c_void;
|
2018-01-25 09:10:11 +00:00
|
|
|
pub extern "c" fn malloc(usize) ?&c_void;
|
|
|
|
pub extern "c" fn realloc(&c_void, usize) ?&c_void;
|
|
|
|
pub extern "c" fn free(&c_void) void;
|
|
|
|
pub extern "c" fn posix_memalign(memptr: &&c_void, alignment: usize, size: usize) c_int;
|