os2 tests

This commit is contained in:
CiD-
2022-03-08 17:15:45 -05:00
parent 1f19610fd6
commit 832003dd4b
4 changed files with 17 additions and 34 deletions
+11
View File
@@ -1,6 +1,8 @@
//+private
package os2
import "core:sys/unix"
EPERM :: 1
ENOENT :: 2
ESRCH :: 3
@@ -126,6 +128,15 @@ ENOTRECOVERABLE:: 131 /* State not recoverable */
ERFKILL :: 132 /* Operation not possible due to RF-kill */
EHWPOISON :: 133 /* Memory page has hardware error */
_get_platform_error :: proc(res: int) -> Error {
errno := unix.get_errno(res)
return Platform_Error{i32(errno)}
}
_ok_or_error :: proc(res: int) -> Error {
return res >= 0 ? nil : _get_platform_error(res)
}
_error_string :: proc(errno: i32) -> string {
if errno == 0 {
return ""