Browse Source

fix core and libc

avanspector 1 year ago
parent
commit
c3746d9f56
4 changed files with 23 additions and 3 deletions
  1. 1 1
      base/runtime/os_specific_haiku.odin
  2. 1 1
      core/c/libc/time.odin
  3. 20 0
      core/os/os_haiku.odin
  4. 1 1
      core/time/time_unix.odin

+ 1 - 1
base/runtime/os_specific_haiku.odin

@@ -14,7 +14,7 @@ foreign libc {
 _stderr_write :: proc "contextless" (data: []byte) -> (int, _OS_Errno) {
 _stderr_write :: proc "contextless" (data: []byte) -> (int, _OS_Errno) {
 	ret := _unix_write(2, raw_data(data), len(data))
 	ret := _unix_write(2, raw_data(data), len(data))
 	if ret < len(data) {
 	if ret < len(data) {
-		err := __error()
+		err := __errnop()
 		return int(ret), _OS_Errno(err^ if err != nil else 0)
 		return int(ret), _OS_Errno(err^ if err != nil else 0)
 	}
 	}
 	return int(ret), 0
 	return int(ret), 0

+ 1 - 1
core/c/libc/time.odin

@@ -45,7 +45,7 @@ when ODIN_OS == .Windows {
 	}
 	}
 }
 }
 
 
-when ODIN_OS == .Linux || ODIN_OS == .FreeBSD || ODIN_OS == .Darwin || ODIN_OS == .OpenBSD {
+when ODIN_OS == .Linux || ODIN_OS == .FreeBSD || ODIN_OS == .Darwin || ODIN_OS == .OpenBSD || ODIN_OS == .Haiku {
 	@(default_calling_convention="c")
 	@(default_calling_convention="c")
 	foreign libc {
 	foreign libc {
 		// 7.27.2 Time manipulation functions
 		// 7.27.2 Time manipulation functions

+ 20 - 0
core/os/os_haiku.odin

@@ -0,0 +1,20 @@
+package os
+
+foreign import libc "system:c"
+
+import "core:strings"
+import "core:c"
+import "base:runtime"
+
+Handle    :: distinct i32
+Pid       :: distinct i32
+File_Time :: distinct i64
+Errno     :: distinct i32
+
+B_GENERAL_ERROR_BASE :: min(i32)
+B_POSIX_ERROR_BASE   :: B_GENERAL_ERROR_BASE + 0x7000
+
+INVALID_HANDLE :: ~Handle(0)
+
+ERROR_NONE:	Errno: 0
+

+ 1 - 1
core/time/time_unix.odin

@@ -1,5 +1,5 @@
 //+private
 //+private
-//+build linux, darwin, freebsd, openbsd
+//+build linux, darwin, freebsd, openbsd, haiku
 package time
 package time
 
 
 import "core:sys/unix"
 import "core:sys/unix"