Change to Permissions bit_set from relying on octal numbering for os2

This commit is contained in:
gingerBill
2025-10-31 14:45:53 +00:00
parent d374dc3c99
commit b9df67f8c5
14 changed files with 88 additions and 44 deletions
+7 -5
View File
@@ -51,8 +51,8 @@ init_std_files :: proc "contextless" () {
}
@(init)
init_preopens :: proc() {
strip_prefixes :: proc(path: string) -> string {
init_preopens :: proc "contextless" () {
strip_prefixes :: proc "contextless" (path: string) -> string {
path := path
loop: for len(path) > 0 {
switch {
@@ -69,6 +69,8 @@ init_preopens :: proc() {
return path
}
context = runtime.default_context()
n: int
n_loop: for fd := wasi.fd_t(3); ; fd += 1 {
_, err := wasi.fd_prestat_get(fd)
@@ -171,7 +173,7 @@ match_preopen :: proc(path: string) -> (wasi.fd_t, string, bool) {
return match.fd, relative, true
}
_open :: proc(name: string, flags: File_Flags, perm: int) -> (f: ^File, err: Error) {
_open :: proc(name: string, flags: File_Flags, perm: Permissions) -> (f: ^File, err: Error) {
dir_fd, relative, ok := match_preopen(name)
if !ok {
return nil, .Invalid_Path
@@ -373,11 +375,11 @@ _fchdir :: proc(f: ^File) -> Error {
return .Unsupported
}
_fchmod :: proc(f: ^File, mode: int) -> Error {
_fchmod :: proc(f: ^File, mode: Permissions) -> Error {
return .Unsupported
}
_chmod :: proc(name: string, mode: int) -> Error {
_chmod :: proc(name: string, mode: Permissions) -> Error {
return .Unsupported
}