mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-07 08:08:50 +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:
@@ -290,8 +290,8 @@ foreign libc {
|
|||||||
@(link_name="lseek") _unix_seek :: proc(fd: Handle, offset: i64, whence: c.int) -> i64 ---
|
@(link_name="lseek") _unix_seek :: proc(fd: Handle, offset: i64, whence: c.int) -> i64 ---
|
||||||
@(link_name="getpagesize") _unix_getpagesize :: proc() -> c.int ---
|
@(link_name="getpagesize") _unix_getpagesize :: proc() -> c.int ---
|
||||||
@(link_name="stat") _unix_stat :: proc(path: cstring, stat: ^OS_Stat) -> c.int ---
|
@(link_name="stat") _unix_stat :: proc(path: cstring, stat: ^OS_Stat) -> c.int ---
|
||||||
@(link_name="lstat") _unix_lstat :: proc(path: cstring, sb: ^OS_Stat) -> c.int ---
|
@(link_name="__lstat50") _unix_lstat :: proc(path: cstring, sb: ^OS_Stat) -> c.int ---
|
||||||
@(link_name="fstat") _unix_fstat :: proc(fd: Handle, stat: ^OS_Stat) -> c.int ---
|
@(link_name="__fstat50") _unix_fstat :: proc(fd: Handle, stat: ^OS_Stat) -> c.int ---
|
||||||
@(link_name="readlink") _unix_readlink :: proc(path: cstring, buf: ^byte, bufsiz: c.size_t) -> c.ssize_t ---
|
@(link_name="readlink") _unix_readlink :: proc(path: cstring, buf: ^byte, bufsiz: c.size_t) -> c.ssize_t ---
|
||||||
@(link_name="access") _unix_access :: proc(path: cstring, mask: c.int) -> c.int ---
|
@(link_name="access") _unix_access :: proc(path: cstring, mask: c.int) -> c.int ---
|
||||||
@(link_name="getcwd") _unix_getcwd :: proc(buf: cstring, len: c.size_t) -> cstring ---
|
@(link_name="getcwd") _unix_getcwd :: proc(buf: cstring, len: c.size_t) -> cstring ---
|
||||||
|
|||||||
@@ -14,14 +14,13 @@ SIG_UNBLOCK :: 2
|
|||||||
SIG_SETMASK :: 3
|
SIG_SETMASK :: 3
|
||||||
|
|
||||||
siginfo_t :: struct { si_pad: [128]c.char }
|
siginfo_t :: struct { si_pad: [128]c.char }
|
||||||
sigset_t :: struct { bits: [4]c.uint }
|
sigset_t :: struct { bits: [4]u32 }
|
||||||
|
|
||||||
foreign libc {
|
foreign libc {
|
||||||
sigemptyset :: proc(set: ^sigset_t) -> c.int ---
|
@(link_name="__sigemptyset14") sigemptyset :: proc(set: ^sigset_t) -> c.int ---
|
||||||
sigaddset :: proc(set: ^sigset_t, _signal: c.int) -> c.int ---
|
@(link_name="__sigaddset14") sigaddset :: proc(set: ^sigset_t, _signal: c.int) -> c.int ---
|
||||||
|
@(link_name="__sigtimedwait50") sigtimedwait :: proc(set: ^sigset_t, info: ^siginfo_t, timeout: ^timespec) -> c.int ---
|
||||||
sigtimedwait :: proc(set: ^sigset_t, info: ^siginfo_t, timeout: ^timespec) -> c.int ---
|
@(link_name="sigwait") sigwait :: proc(set: ^sigset_t, _signal: ^c.int) -> c.int ---
|
||||||
sigwait :: proc(set: ^sigset_t, _signal: ^c.int) -> c.int ---
|
|
||||||
|
|
||||||
@(private="file", link_name="__errno") get_error_location :: proc() -> ^c.int ---
|
@(private="file", link_name="__errno") get_error_location :: proc() -> ^c.int ---
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,12 +9,21 @@ when ODIN_OS == .Darwin {
|
|||||||
|
|
||||||
import "core:c"
|
import "core:c"
|
||||||
|
|
||||||
|
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")
|
@(default_calling_convention="c")
|
||||||
foreign libc {
|
foreign libc {
|
||||||
clock_gettime :: proc(clock_id: u64, timespec: ^timespec) -> c.int ---
|
clock_gettime :: proc(clock_id: u64, timespec: ^timespec) -> c.int ---
|
||||||
sleep :: proc(seconds: c.uint) -> c.int ---
|
sleep :: proc(seconds: c.uint) -> c.int ---
|
||||||
nanosleep :: proc(requested, remaining: ^timespec) -> c.int ---
|
nanosleep :: proc(requested, remaining: ^timespec) -> c.int ---
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
timespec :: struct {
|
timespec :: struct {
|
||||||
tv_sec: i64, // seconds
|
tv_sec: i64, // seconds
|
||||||
@@ -65,8 +74,6 @@ seconds_since_boot :: proc "c" () -> f64 {
|
|||||||
return f64(ts_boottime.tv_sec) + f64(ts_boottime.tv_nsec) / 1e9
|
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) {
|
inline_nanosleep :: proc "c" (nanoseconds: i64) -> (remaining: timespec, res: i32) {
|
||||||
s, ns := nanoseconds / 1e9, nanoseconds % 1e9
|
s, ns := nanoseconds / 1e9, nanoseconds % 1e9
|
||||||
requested := timespec{tv_sec=s, tv_nsec=ns}
|
requested := timespec{tv_sec=s, tv_nsec=ns}
|
||||||
|
|||||||
Reference in New Issue
Block a user