diff --git a/core/os/dir_freebsd.odin b/core/os/dir_bsd.odin similarity index 98% rename from core/os/dir_freebsd.odin rename to core/os/dir_bsd.odin index 2965182cd..c0dc8ad1f 100644 --- a/core/os/dir_freebsd.odin +++ b/core/os/dir_bsd.odin @@ -1,3 +1,4 @@ +//+build freebsd, netbsd package os import "core:mem" diff --git a/core/os/os_netbsd.odin b/core/os/os_netbsd.odin index e10b2eab0..c72c6d4ab 100644 --- a/core/os/os_netbsd.odin +++ b/core/os/os_netbsd.odin @@ -483,6 +483,13 @@ is_dir_path :: proc(path: string, follow_links: bool = true) -> bool { is_file :: proc {is_file_path, is_file_handle} is_dir :: proc {is_dir_path, is_dir_handle} +exists :: proc(path: string) -> bool { + runtime.DEFAULT_TEMP_ALLOCATOR_TEMP_GUARD() + cpath := strings.clone_to_cstring(path, context.temp_allocator) + res := _unix_access(cpath, O_RDONLY) + return res == 0 +} + // NOTE(bill): Uses startup to initialize it stdin: Handle = 0 diff --git a/core/path/filepath/path_unix.odin b/core/path/filepath/path_unix.odin index 9beda5557..a4b27b027 100644 --- a/core/path/filepath/path_unix.odin +++ b/core/path/filepath/path_unix.odin @@ -1,4 +1,4 @@ -//+build linux, darwin, freebsd, openbsd +//+build linux, darwin, freebsd, openbsd, netbsd package filepath when ODIN_OS == .Darwin { @@ -61,7 +61,7 @@ when ODIN_OS == .Darwin { foreign libc { @(link_name="__error") __error :: proc() -> ^i32 --- } -} else when ODIN_OS == .OpenBSD { +} else when ODIN_OS == .OpenBSD || ODIN_OS == .NetBSD { @(private) foreign libc { @(link_name="__errno") __error :: proc() -> ^i32 --- diff --git a/core/sys/unix/signal_netbsd.odin b/core/sys/unix/signal_netbsd.odin index b74c7287b..c32f0bfbe 100644 --- a/core/sys/unix/signal_netbsd.odin +++ b/core/sys/unix/signal_netbsd.odin @@ -13,8 +13,8 @@ SIG_BLOCK :: 1 SIG_UNBLOCK :: 2 SIG_SETMASK :: 3 -siginfo_t :: struct { si_pad: [128]c.char } -sigset_t :: struct { bits: [4]u32 } +siginfo_t :: struct { _: [128]u8 } +sigset_t :: struct { _: [4]u32 } foreign libc { @(link_name="__sigemptyset14") sigemptyset :: proc(set: ^sigset_t) -> c.int --- diff --git a/core/thread/thread_unix.odin b/core/thread/thread_unix.odin index 3640251dd..c80d6854b 100644 --- a/core/thread/thread_unix.odin +++ b/core/thread/thread_unix.odin @@ -20,7 +20,7 @@ Thread_Os_Specific :: struct #align(16) { // It then waits for `start` to be called. // _create :: proc(procedure: Thread_Proc, priority: Thread_Priority) -> ^Thread { - __linux_thread_entry_proc :: proc "c" (t: rawptr) -> rawptr { + __unix_thread_entry_proc :: proc "c" (t: rawptr) -> rawptr { t := (^Thread)(t) when ODIN_OS != .Darwin { @@ -109,7 +109,7 @@ _create :: proc(procedure: Thread_Proc, priority: Thread_Priority) -> ^Thread { assert(res == 0) thread.procedure = procedure - if unix.pthread_create(&thread.unix_thread, &attrs, __linux_thread_entry_proc, thread) != 0 { + if unix.pthread_create(&thread.unix_thread, &attrs, __unix_thread_entry_proc, thread) != 0 { free(thread, thread.creation_allocator) return nil }