small fixes

This commit is contained in:
avanspector
2024-02-27 01:59:17 +01:00
parent 8d4bb35bcc
commit 38c69b9691
4 changed files with 78 additions and 28 deletions
+13 -3
View File
@@ -1,9 +1,11 @@
//+build haiku
package sys_haiku
import "core:c"
Errno :: enum i32 {
// Error baselines
GENERAL_ERROR_BASE = min(i32),
GENERAL_ERROR_BASE = -(1<<31),
OS_ERROR_BASE = GENERAL_ERROR_BASE + 0x1000,
APP_ERROR_BASE = GENERAL_ERROR_BASE + 0x2000,
INTERFACE_ERROR_BASE = GENERAL_ERROR_BASE + 0x3000,
@@ -113,6 +115,8 @@ Errno :: enum i32 {
EOVERFLOW = POSIX_ERROR_BASE + 41,
EOPNOTSUPP = POSIX_ERROR_BASE + 43,
EAGAIN = WOULD_BLOCK,
// New error codes that can be mapped to POSIX errors
TOO_MANY_ARGS_NEG = E2BIG,
FILE_TOO_LARGE_NEG = EFBIG,
@@ -221,8 +225,14 @@ Errno :: enum i32 {
ILLEGAL_DATA = TRANSLATION_ERROR_BASE + 2,
}
errno :: #force_inline proc "contextless" () -> Errno {
return Errno(_errnop()^)
}
foreign import libroot "system:c"
foreign libroot {
_to_positive_error :: proc(error: i32) -> i32 ---
_to_negative_error :: proc(error: i32) -> i32 ---
_to_positive_error :: proc(error: c.int) -> c.int ---
_to_negative_error :: proc(error: c.int) -> c.int ---
_errnop :: proc() -> ^c.int ---
}
+8 -8
View File
@@ -193,9 +193,9 @@ sigval :: struct #raw_union {
}
siginfo_t :: struct {
si_signo: c.int, // signal number
si_code: c.int, // signal code
si_errno: c.int, // if non zero, an error number associated with this signal
si_signo: c.int, // signal number
si_code: c.int, // signal code
si_errno: c.int, // if non zero, an error number associated with this signal
si_pid: pid_t, // sending process ID
si_uid: uid_t, // real user ID of sending process
@@ -207,11 +207,11 @@ siginfo_t :: struct {
foreign libroot {
// signal set (sigset_t) manipulation
sigemptyset :: proc(set: ^sigset_t) -> c.int ---
sigfillset :: proc(set: ^sigset_t) -> c.int ---
sigaddset :: proc(set: ^sigset_t, _signal: c.int) -> c.int ---
sigdelset :: proc(set: ^sigset_t, _signal: c.int) -> c.int ---
sigismember :: proc(set: ^sigset_t, _signal: c.int) -> c.int ---
sigemptyset :: proc(set: ^sigset_t) -> c.int ---
sigfillset :: proc(set: ^sigset_t) -> c.int ---
sigaddset :: proc(set: ^sigset_t, _signal: c.int) -> c.int ---
sigdelset :: proc(set: ^sigset_t, _signal: c.int) -> c.int ---
sigismember :: proc(set: ^sigset_t, _signal: c.int) -> c.int ---
// querying and waiting for signals
sigpending :: proc(set: ^sigset_t) -> c.int ---
sigsuspend :: proc(mask: ^sigset_t) -> c.int ---
+2 -2
View File
@@ -9,9 +9,9 @@ nanotime_t :: i64
type_code :: u32
perform_code :: u32
phys_addr_t :: u64 when ODIN_ARCH == .amd64 || ODIN_ARCH == .arm64 else u32
phys_addr_t :: uintptr
phys_size_t :: phys_addr_t
generic_addr_t :: u64 when ODIN_ARCH == .amd64 || ODIN_ARCH == .arm64 else u32
generic_addr_t :: uintptr
generic_size_t :: generic_addr_t
area_id :: i32