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
+20
View File
@@ -0,0 +1,20 @@
//+private
//+build darwin, netbsd, freebsd, openbsd
package os2
import "base:runtime"
@(require)
import "core:sys/posix"
_temp_dir :: proc(allocator: runtime.Allocator) -> (string, runtime.Allocator_Error) {
if tmp, ok := _lookup_env("TMPDIR", allocator); ok {
return tmp, nil
}
when #defined(posix.P_tmpdir) {
return clone_string(posix.P_tmpdir, allocator)
}
return clone_string("/tmp/", allocator)
}