sys/posix: impl rest of linux, impl some of Windows

This commit is contained in:
Laytan Laats
2024-12-01 11:54:51 +11:00
committed by flysand7
parent 879771fe32
commit 49ddbd9b99
63 changed files with 1237 additions and 789 deletions
+17 -10
View File
@@ -1,3 +1,4 @@
#+build linux, darwin, netbsd, openbsd, freebsd
package posix
import "core:c"
@@ -37,15 +38,10 @@ foreign lib {
uname :: proc(uname: ^utsname) -> c.int ---
}
when ODIN_OS == .Darwin || ODIN_OS == .FreeBSD || ODIN_OS == .NetBSD || ODIN_OS == .OpenBSD || ODIN_OS == .Linux {
when ODIN_OS == .Darwin || ODIN_OS == .FreeBSD || ODIN_OS == .NetBSD || ODIN_OS == .OpenBSD {
when ODIN_OS == .Linux {
@(private)
_SYS_NAMELEN :: 65
} else {
@(private)
_SYS_NAMELEN :: 256
}
@(private)
_SYS_NAMELEN :: 256
utsname :: struct {
sysname: [_SYS_NAMELEN]c.char `fmt:"s,0"`, /* [PSX] name of OS */
@@ -55,6 +51,17 @@ when ODIN_OS == .Darwin || ODIN_OS == .FreeBSD || ODIN_OS == .NetBSD || ODIN_OS
machine: [_SYS_NAMELEN]c.char `fmt:"s,0"`, /* [PSX] hardware type */
}
} else {
#panic("posix is unimplemented for the current target")
} else when ODIN_OS == .Linux {
@(private)
_SYS_NAMELEN :: 65
utsname :: struct {
sysname: [_SYS_NAMELEN]c.char `fmt:"s,0"`, /* [PSX] name of OS */
nodename: [_SYS_NAMELEN]c.char `fmt:"s,0"`, /* [PSX] name of this network node */
release: [_SYS_NAMELEN]c.char `fmt:"s,0"`, /* [PSX] release level */
version: [_SYS_NAMELEN]c.char `fmt:"s,0"`, /* [PSX] version level */
machine: [_SYS_NAMELEN]c.char `fmt:"s,0"`, /* [PSX] hardware type */
__domainname: [_SYS_NAMELEN]c.char `fmt:"s,0"`,
}
}