os2: initial implementation for Darwin&BSDs, process API is only thing incomplete

This commit is contained in:
Laytan Laats
2024-08-14 01:44:37 +02:00
parent ff0ca0bd53
commit a4d459f651
23 changed files with 1535 additions and 17 deletions
+30
View File
@@ -0,0 +1,30 @@
//+private
//+build darwin, netbsd, freebsd, openbsd
package os2
import "core:sys/posix"
_error_string :: proc(errno: i32) -> string {
return string(posix.strerror(posix.Errno(errno)))
}
_get_platform_error :: proc() -> Error {
#partial switch errno := posix.errno(); errno {
case .EPERM:
return .Permission_Denied
case .EEXIST:
return .Exist
case .ENOENT:
return .Not_Exist
case .ETIMEDOUT:
return .Timeout
case .EPIPE:
return .Broken_Pipe
case .EBADF:
return .Invalid_File
case .ENOMEM:
return .Out_Of_Memory
case:
return Platform_Error(errno)
}
}