core:testing Darwin

This commit is contained in:
Jeroen van Rijn
2025-10-28 19:34:13 +01:00
parent 47786deddc
commit 14021f6444
2 changed files with 6 additions and 3 deletions

View File

@@ -161,7 +161,8 @@ __fd :: proc(f: ^File) -> posix.FD {
return -1
}
is_tty :: proc "contextless" (f: ^File) -> bool {
_is_tty :: proc "contextless" (f: ^File) -> bool {
context = runtime.default_context()
fd := _fd(f)
is_tty := posix.isatty(posix.FD(fd))
return bool(is_tty)

View File

@@ -5,12 +5,14 @@ import "base:runtime"
import "base:intrinsics"
import "core:bytes"
import "core:c"
import "core:sys/darwin"
import "core:sys/posix"
import "core:sys/unix"
import "core:time"
foreign import libc "system:System"
foreign import libc "system:System"
foreign import pthread "system:System"
foreign libc {
sysctl :: proc "c" (
@@ -33,7 +35,7 @@ _get_current_thread_id :: proc "contextless" () -> int {
return int(tid)
}
_processor_core_count :: proc() -> int {
_get_processor_core_count :: proc() -> int {
count : int = 0
count_size := size_of(count)
if _sysctlbyname("hw.logicalcpu", &count, &count_size, nil, 0) == 0 {