diff --git a/CMakeLists.txt b/CMakeLists.txt index 4222b7f454..4e35059a5b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -139,7 +139,7 @@ set(ZIG_STD_SRC "${CMAKE_SOURCE_DIR}/std/test_runner_nolibc.zig" "${CMAKE_SOURCE_DIR}/std/io.zig" "${CMAKE_SOURCE_DIR}/std/os.zig" - "${CMAKE_SOURCE_DIR}/std/syscall.zig" + "${CMAKE_SOURCE_DIR}/std/linux.zig" "${CMAKE_SOURCE_DIR}/std/errno.zig" "${CMAKE_SOURCE_DIR}/std/rand.zig" "${CMAKE_SOURCE_DIR}/std/math.zig" diff --git a/std/bootstrap.zig b/std/bootstrap.zig index a047500d48..849567e3cf 100644 --- a/std/bootstrap.zig +++ b/std/bootstrap.zig @@ -1,7 +1,7 @@ // This file is in a package which has the root source file exposed as "@root". const root = @import("@root"); -const syscall = @import("syscall.zig"); +const linux = @import("linux.zig"); const want_start_symbol = switch(@compile_var("os")) { linux => true, @@ -47,8 +47,8 @@ fn call_main() -> %void { } fn call_main_and_exit() -> unreachable { - call_main() %% syscall.exit(1); - syscall.exit(0); + call_main() %% linux.exit(1); + linux.exit(0); } #condition(want_main_symbol) diff --git a/std/io.zig b/std/io.zig index 272459e4e7..a653a8c8e9 100644 --- a/std/io.zig +++ b/std/io.zig @@ -1,4 +1,4 @@ -const syscall = @import("syscall.zig"); +const linux = @import("linux.zig"); const errno = @import("errno.zig"); const math = @import("math.zig"); @@ -105,7 +105,7 @@ pub struct OutStream { } pub fn flush(os: &OutStream) -> %void { - const amt_written = syscall.write(os.fd, &os.buffer[0], os.index); + const amt_written = linux.write(os.fd, &os.buffer[0], os.index); os.index = 0; if (amt_written < 0) { return switch (-amt_written) { @@ -123,12 +123,12 @@ pub struct OutStream { } pub fn close(os: &OutStream) -> %void { - const closed = close(os.fd); + const closed = linux.close(os.fd); if (closed < 0) { return switch (-closed) { - EIO => error.Io, - EBADF => error.BadFd, - EINTR => error.SigInterrupt, + errno.EIO => error.Io, + errno.EBADF => error.BadFd, + errno.EINTR => error.SigInterrupt, else => error.Unexpected, } } @@ -139,7 +139,7 @@ pub struct InStream { fd: isize, pub fn read(is: &InStream, buf: []u8) -> %isize { - const amt_read = syscall.read(is.fd, &buf[0], buf.len); + const amt_read = linux.read(is.fd, &buf[0], buf.len); if (amt_read < 0) { return switch (-amt_read) { errno.EINVAL => unreachable{}, @@ -154,12 +154,12 @@ pub struct InStream { } pub fn close(is: &InStream) -> %void { - const closed = close(is.fd); + const closed = linux.close(is.fd); if (closed < 0) { return switch (-closed) { - EIO => error.Io, - EBADF => error.BadFd, - EINTR => error.SigInterrupt, + errno.EIO => error.Io, + errno.EBADF => error.BadFd, + errno.EINTR => error.SigInterrupt, else => error.Unexpected, } } @@ -168,8 +168,8 @@ pub struct InStream { #attribute("cold") pub fn abort() -> unreachable { - syscall.raise(syscall.SIGABRT); - syscall.raise(syscall.SIGKILL); + linux.raise(linux.SIGABRT); + linux.raise(linux.SIGKILL); while (true) {} } diff --git a/std/syscall.zig b/std/linux.zig similarity index 100% rename from std/syscall.zig rename to std/linux.zig diff --git a/std/os.zig b/std/os.zig index 287b76191d..5e0ee4878a 100644 --- a/std/os.zig +++ b/std/os.zig @@ -1,4 +1,4 @@ -const syscall = @import("syscall.zig"); +const linux = @import("linux.zig"); const errno = @import("errno.zig"); pub error SigInterrupt; @@ -7,7 +7,7 @@ pub error Unexpected; pub fn get_random_bytes(buf: []u8) -> %void { switch (@compile_var("os")) { linux => { - const amt_got = syscall.getrandom(buf.ptr, buf.len, 0); + const amt_got = linux.getrandom(buf.ptr, buf.len, 0); if (amt_got < 0) { return switch (-amt_got) { errno.EINVAL => unreachable{},