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

This commit is contained in:
Laytan Laats committed 2024-08-14 01:44:37 +02:00
1 parent ff0ca0bd53
commit a4d459f651
23 files changed
+1535 -17

No files matched your search

+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)
}
}