mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-04 14:48:47 +00:00
sys/posix: impl rest of linux, impl some of Windows
This commit is contained in:
@@ -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"`,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user