|
@@ -66,7 +66,7 @@ _standard_stream_init :: proc() {
|
|
|
}
|
|
|
|
|
|
_open :: proc(name: string, flags: File_Flags, perm: int) -> (f: ^File, err: Error) {
|
|
|
- temp_allocator := get_temp_allocator(TEMP_ALLOCATOR_GUARD({}))
|
|
|
+ temp_allocator := TEMP_ALLOCATOR_GUARD({})
|
|
|
name_cstr := clone_to_cstring(name, temp_allocator) or_return
|
|
|
|
|
|
// Just default to using O_NOCTTY because needing to open a controlling
|
|
@@ -299,7 +299,7 @@ _truncate :: proc(f: ^File, size: i64) -> Error {
|
|
|
}
|
|
|
|
|
|
_remove :: proc(name: string) -> Error {
|
|
|
- temp_allocator := get_temp_allocator(TEMP_ALLOCATOR_GUARD({}))
|
|
|
+ temp_allocator := TEMP_ALLOCATOR_GUARD({})
|
|
|
name_cstr := clone_to_cstring(name, temp_allocator) or_return
|
|
|
|
|
|
if fd, errno := linux.open(name_cstr, _OPENDIR_FLAGS + {.NOFOLLOW}); errno == .NONE {
|
|
@@ -311,7 +311,7 @@ _remove :: proc(name: string) -> Error {
|
|
|
}
|
|
|
|
|
|
_rename :: proc(old_name, new_name: string) -> Error {
|
|
|
- temp_allocator := get_temp_allocator(TEMP_ALLOCATOR_GUARD({}))
|
|
|
+ temp_allocator := TEMP_ALLOCATOR_GUARD({})
|
|
|
old_name_cstr := clone_to_cstring(old_name, temp_allocator) or_return
|
|
|
new_name_cstr := clone_to_cstring(new_name, temp_allocator) or_return
|
|
|
|
|
@@ -319,7 +319,7 @@ _rename :: proc(old_name, new_name: string) -> Error {
|
|
|
}
|
|
|
|
|
|
_link :: proc(old_name, new_name: string) -> Error {
|
|
|
- temp_allocator := get_temp_allocator(TEMP_ALLOCATOR_GUARD({}))
|
|
|
+ temp_allocator := TEMP_ALLOCATOR_GUARD({})
|
|
|
old_name_cstr := clone_to_cstring(old_name, temp_allocator) or_return
|
|
|
new_name_cstr := clone_to_cstring(new_name, temp_allocator) or_return
|
|
|
|
|
@@ -327,7 +327,7 @@ _link :: proc(old_name, new_name: string) -> Error {
|
|
|
}
|
|
|
|
|
|
_symlink :: proc(old_name, new_name: string) -> Error {
|
|
|
- temp_allocator := get_temp_allocator(TEMP_ALLOCATOR_GUARD({}))
|
|
|
+ temp_allocator := TEMP_ALLOCATOR_GUARD({})
|
|
|
old_name_cstr := clone_to_cstring(old_name, temp_allocator) or_return
|
|
|
new_name_cstr := clone_to_cstring(new_name, temp_allocator) or_return
|
|
|
return _get_platform_error(linux.symlink(old_name_cstr, new_name_cstr))
|
|
@@ -352,13 +352,13 @@ _read_link_cstr :: proc(name_cstr: cstring, allocator: runtime.Allocator) -> (st
|
|
|
}
|
|
|
|
|
|
_read_link :: proc(name: string, allocator: runtime.Allocator) -> (s: string, e: Error) {
|
|
|
- temp_allocator := get_temp_allocator(TEMP_ALLOCATOR_GUARD({ allocator }))
|
|
|
+ temp_allocator := TEMP_ALLOCATOR_GUARD({ allocator })
|
|
|
name_cstr := clone_to_cstring(name, temp_allocator) or_return
|
|
|
return _read_link_cstr(name_cstr, allocator)
|
|
|
}
|
|
|
|
|
|
_chdir :: proc(name: string) -> Error {
|
|
|
- temp_allocator := get_temp_allocator(TEMP_ALLOCATOR_GUARD({}))
|
|
|
+ temp_allocator := TEMP_ALLOCATOR_GUARD({})
|
|
|
name_cstr := clone_to_cstring(name, temp_allocator) or_return
|
|
|
return _get_platform_error(linux.chdir(name_cstr))
|
|
|
}
|
|
@@ -369,7 +369,7 @@ _fchdir :: proc(f: ^File) -> Error {
|
|
|
}
|
|
|
|
|
|
_chmod :: proc(name: string, mode: int) -> Error {
|
|
|
- temp_allocator := get_temp_allocator(TEMP_ALLOCATOR_GUARD({}))
|
|
|
+ temp_allocator := TEMP_ALLOCATOR_GUARD({})
|
|
|
name_cstr := clone_to_cstring(name, temp_allocator) or_return
|
|
|
return _get_platform_error(linux.chmod(name_cstr, transmute(linux.Mode)(u32(mode))))
|
|
|
}
|
|
@@ -381,14 +381,14 @@ _fchmod :: proc(f: ^File, mode: int) -> Error {
|
|
|
|
|
|
// NOTE: will throw error without super user priviledges
|
|
|
_chown :: proc(name: string, uid, gid: int) -> Error {
|
|
|
- temp_allocator := get_temp_allocator(TEMP_ALLOCATOR_GUARD({}))
|
|
|
+ temp_allocator := TEMP_ALLOCATOR_GUARD({})
|
|
|
name_cstr := clone_to_cstring(name, temp_allocator) or_return
|
|
|
return _get_platform_error(linux.chown(name_cstr, linux.Uid(uid), linux.Gid(gid)))
|
|
|
}
|
|
|
|
|
|
// NOTE: will throw error without super user priviledges
|
|
|
_lchown :: proc(name: string, uid, gid: int) -> Error {
|
|
|
- temp_allocator := get_temp_allocator(TEMP_ALLOCATOR_GUARD({}))
|
|
|
+ temp_allocator := TEMP_ALLOCATOR_GUARD({})
|
|
|
name_cstr := clone_to_cstring(name, temp_allocator) or_return
|
|
|
return _get_platform_error(linux.lchown(name_cstr, linux.Uid(uid), linux.Gid(gid)))
|
|
|
}
|
|
@@ -400,7 +400,7 @@ _fchown :: proc(f: ^File, uid, gid: int) -> Error {
|
|
|
}
|
|
|
|
|
|
_chtimes :: proc(name: string, atime, mtime: time.Time) -> Error {
|
|
|
- temp_allocator := get_temp_allocator(TEMP_ALLOCATOR_GUARD({}))
|
|
|
+ temp_allocator := TEMP_ALLOCATOR_GUARD({})
|
|
|
name_cstr := clone_to_cstring(name, temp_allocator) or_return
|
|
|
times := [2]linux.Time_Spec {
|
|
|
{
|
|
@@ -431,7 +431,7 @@ _fchtimes :: proc(f: ^File, atime, mtime: time.Time) -> Error {
|
|
|
}
|
|
|
|
|
|
_exists :: proc(name: string) -> bool {
|
|
|
- temp_allocator := get_temp_allocator(TEMP_ALLOCATOR_GUARD({}))
|
|
|
+ temp_allocator := TEMP_ALLOCATOR_GUARD({})
|
|
|
name_cstr, _ := clone_to_cstring(name, temp_allocator)
|
|
|
return linux.access(name_cstr, linux.F_OK) == .NONE
|
|
|
}
|
|
@@ -440,7 +440,7 @@ _exists :: proc(name: string) -> bool {
|
|
|
_read_entire_pseudo_file :: proc { _read_entire_pseudo_file_string, _read_entire_pseudo_file_cstring }
|
|
|
|
|
|
_read_entire_pseudo_file_string :: proc(name: string, allocator: runtime.Allocator) -> (b: []u8, e: Error) {
|
|
|
- temp_allocator := get_temp_allocator(TEMP_ALLOCATOR_GUARD({ allocator }))
|
|
|
+ temp_allocator := TEMP_ALLOCATOR_GUARD({ allocator })
|
|
|
name_cstr := clone_to_cstring(name, temp_allocator) or_return
|
|
|
return _read_entire_pseudo_file_cstring(name_cstr, allocator)
|
|
|
}
|