diff --git a/core/sys/posix/sys_ipc.odin b/core/sys/posix/sys_ipc.odin index f8778ee15f2..0ba9d2d5d97 100644 --- a/core/sys/posix/sys_ipc.odin +++ b/core/sys/posix/sys_ipc.odin @@ -36,7 +36,7 @@ IPC_Flag_Bits :: enum c.int { } IPC_Flags :: bit_set[IPC_Flag_Bits; c.int] -when ODIN_OS == .Darwin { +when ODIN_OS == .Darwin || ODIN_OS == .Linux { key_t :: distinct c.int32_t diff --git a/core/sys/posix/sys_mman.odin b/core/sys/posix/sys_mman.odin index 217d321ac7f..d71a9263966 100644 --- a/core/sys/posix/sys_mman.odin +++ b/core/sys/posix/sys_mman.odin @@ -163,7 +163,7 @@ when ODIN_OS == .NetBSD { @(private) LMSYNC :: "msync" } -when ODIN_OS == .Darwin || ODIN_OS == .NetBSD || ODIN_OS == .OpenBSD { +when ODIN_OS == .Darwin || ODIN_OS == .NetBSD || ODIN_OS == .OpenBSD || ODIN_OS == .Linux { PROT_EXEC :: 0x04 _PROT_NONE :: 0x00 @@ -174,7 +174,7 @@ when ODIN_OS == .Darwin || ODIN_OS == .NetBSD || ODIN_OS == .OpenBSD { MAP_PRIVATE :: 0x0002 MAP_SHARED :: 0x0001 - when ODIN_OS == .Darwin { + when ODIN_OS == .Darwin || ODIN_OS == .Linux { MS_INVALIDATE :: 0x0002 _MS_SYNC :: 0x0010 } else when ODIN_OS == .NetBSD { @@ -184,13 +184,18 @@ when ODIN_OS == .Darwin || ODIN_OS == .NetBSD || ODIN_OS == .OpenBSD { MS_INVALIDATE :: 0x0004 _MS_SYNC :: 0x0002 } + MS_ASYNC :: 0x0001 MS_SYNC :: Sync_Flags{Sync_Flags_Bits(log2(_MS_SYNC))} MCL_CURRENT :: 0x0001 MCL_FUTURE :: 0x0002 - MAP_FAILED :: rawptr(~uintptr(0)) + when ODIN_OS == .Linux { + MAP_FAILED :: rawptr(~uintptr(-1)) + } else { + MAP_FAILED :: rawptr(~uintptr(0)) + } POSIX_MADV_DONTNEED :: 4 POSIX_MADV_NORMAL :: 0 diff --git a/core/sys/posix/sys_time.odin b/core/sys/posix/sys_time.odin index 093fdd688e6..fd2e5812127 100644 --- a/core/sys/posix/sys_time.odin +++ b/core/sys/posix/sys_time.odin @@ -66,7 +66,7 @@ when ODIN_OS == .NetBSD { @(private) LUTIMES :: "utimes" } -when ODIN_OS == .Darwin || ODIN_OS == .FreeBSD || ODIN_OS == .NetBSD || ODIN_OS == .OpenBSD { +when ODIN_OS == .Darwin || ODIN_OS == .FreeBSD || ODIN_OS == .NetBSD || ODIN_OS == .OpenBSD || ODIN_OS == .Linux { itimerval :: struct { it_interval: timeval, /* [PSX] timer interval */ diff --git a/core/sys/posix/sys_utsname.odin b/core/sys/posix/sys_utsname.odin index 803f40ffd96..4786eb4fd31 100644 --- a/core/sys/posix/sys_utsname.odin +++ b/core/sys/posix/sys_utsname.odin @@ -37,10 +37,15 @@ foreign lib { uname :: proc(uname: ^utsname) -> c.int --- } -when ODIN_OS == .Darwin || ODIN_OS == .FreeBSD || ODIN_OS == .NetBSD || ODIN_OS == .OpenBSD { - - @(private) - _SYS_NAMELEN :: 256 +when ODIN_OS == .Darwin || ODIN_OS == .FreeBSD || ODIN_OS == .NetBSD || ODIN_OS == .OpenBSD || ODIN_OS == .Linux { + + when ODIN_OS == .Linux { + @(private) + _SYS_NAMELEN :: 65 + } else { + @(private) + _SYS_NAMELEN :: 256 + } utsname :: struct { sysname: [_SYS_NAMELEN]c.char `fmt:"s,0"`, /* [PSX] name of OS */