mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-04 14:48:47 +00:00
core/sys/unix: Add syscalls_linux.odin
Linux is in the unfortunate situation where the system call number is architecture specific. This consolidates the system call number definitions in a single location, adds some wrappers, and hopefully fixes the existing non-portable invocations of the syscall intrinsic.
This commit is contained in:
@@ -8,6 +8,7 @@ import "core:strings"
|
||||
import "core:c"
|
||||
import "core:strconv"
|
||||
import "core:intrinsics"
|
||||
import "core:sys/unix"
|
||||
|
||||
Handle :: distinct i32
|
||||
File_Time :: distinct u64
|
||||
@@ -265,8 +266,6 @@ X_OK :: 1 // Test for execute permission
|
||||
W_OK :: 2 // Test for write permission
|
||||
R_OK :: 4 // Test for read permission
|
||||
|
||||
SYS_GETTID :: 186
|
||||
|
||||
foreign libc {
|
||||
@(link_name="__errno_location") __errno_location :: proc() -> ^int ---
|
||||
|
||||
@@ -594,7 +593,7 @@ exit :: proc "contextless" (code: int) -> ! {
|
||||
}
|
||||
|
||||
current_thread_id :: proc "contextless" () -> int {
|
||||
return cast(int)intrinsics.syscall(SYS_GETTID)
|
||||
return unix.sys_gettid()
|
||||
}
|
||||
|
||||
dlopen :: proc(filename: string, flags: int) -> rawptr {
|
||||
|
||||
Reference in New Issue
Block a user