mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 15:48:51 +00:00
Fixed link warnings
Hardlink libc functions to the correct version on NetBSD 10 since we do not use the micro-magic from C.
This commit is contained in:
@@ -9,11 +9,20 @@ when ODIN_OS == .Darwin {
|
||||
|
||||
import "core:c"
|
||||
|
||||
@(default_calling_convention="c")
|
||||
foreign libc {
|
||||
clock_gettime :: proc(clock_id: u64, timespec: ^timespec) -> c.int ---
|
||||
sleep :: proc(seconds: c.uint) -> c.int ---
|
||||
nanosleep :: proc(requested, remaining: ^timespec) -> c.int ---
|
||||
when ODIN_OS == .NetBSD {
|
||||
@(default_calling_convention="c")
|
||||
foreign libc {
|
||||
@(link_name="__clock_gettime50") clock_gettime :: proc(clock_id: u64, timespec: ^timespec) -> c.int ---
|
||||
@(link_name="__nanosleep50") nanosleep :: proc(requested, remaining: ^timespec) -> c.int ---
|
||||
@(link_name="sleep") sleep :: proc(seconds: c.uint) -> c.int ---
|
||||
}
|
||||
} else {
|
||||
@(default_calling_convention="c")
|
||||
foreign libc {
|
||||
clock_gettime :: proc(clock_id: u64, timespec: ^timespec) -> c.int ---
|
||||
sleep :: proc(seconds: c.uint) -> c.int ---
|
||||
nanosleep :: proc(requested, remaining: ^timespec) -> c.int ---
|
||||
}
|
||||
}
|
||||
|
||||
timespec :: struct {
|
||||
@@ -65,8 +74,6 @@ seconds_since_boot :: proc "c" () -> f64 {
|
||||
return f64(ts_boottime.tv_sec) + f64(ts_boottime.tv_nsec) / 1e9
|
||||
}
|
||||
|
||||
// TODO(phix): 'nanosleep' here might refere to the wrong version on NetBSD. Need to investigate this further.
|
||||
// Normally this is solved by just including 'time.h'. So I need to understand the macro-magic going on in there.
|
||||
inline_nanosleep :: proc "c" (nanoseconds: i64) -> (remaining: timespec, res: i32) {
|
||||
s, ns := nanoseconds / 1e9, nanoseconds % 1e9
|
||||
requested := timespec{tv_sec=s, tv_nsec=ns}
|
||||
|
||||
Reference in New Issue
Block a user