posix: add package

This commit is contained in:
Laytan Laats
2024-08-14 01:44:35 +02:00
parent ac68a9d52c
commit efe68c2e24
83 changed files with 12665 additions and 328 deletions
+4 -4
View File
@@ -330,7 +330,7 @@ dev_t :: u64
ino_t :: u64
nlink_t :: u32
off_t :: i64
mode_t :: u16
mode_t :: u32
pid_t :: u32
uid_t :: u32
gid_t :: u32
@@ -454,7 +454,7 @@ foreign libc {
@(link_name="realloc") _unix_realloc :: proc(ptr: rawptr, size: c.size_t) -> rawptr ---
@(link_name="getenv") _unix_getenv :: proc(cstring) -> cstring ---
@(link_name="realpath") _unix_realpath :: proc(path: cstring, resolved_path: rawptr) -> rawptr ---
@(link_name="realpath") _unix_realpath :: proc(path: cstring, resolved_path: [^]byte = nil) -> cstring ---
@(link_name="sysctlbyname") _sysctlbyname :: proc(path: cstring, oldp: rawptr, oldlenp: rawptr, newp: rawptr, newlen: int) -> c.int ---
@(link_name="exit") _unix_exit :: proc(status: c.int) -> ! ---
@@ -832,9 +832,9 @@ absolute_path_from_relative :: proc(rel: string) -> (path: string, err: Error) {
if path_ptr == nil {
return "", get_last_error()
}
defer _unix_free(path_ptr)
defer _unix_free(rawptr(path_ptr))
path = strings.clone(string(cstring(path_ptr)))
path = strings.clone(string(path_ptr))
return path, nil
}