|
@@ -90,22 +90,17 @@ _open :: proc(name: string, flags: File_Flags, perm: File_Mode) -> (f: ^File, er
|
|
|
|
|
|
_new_file :: proc(fd: uintptr, _: string = "") -> ^File {
|
|
|
file := new(File, file_allocator())
|
|
|
- _construct_file(file, fd, "")
|
|
|
- return file
|
|
|
-}
|
|
|
-
|
|
|
-_construct_file :: proc(file: ^File, fd: uintptr, _: string = "") {
|
|
|
- file^ = {
|
|
|
- impl = {
|
|
|
- fd = linux.Fd(fd),
|
|
|
- allocator = file_allocator(),
|
|
|
- name = _get_full_path(file.impl.fd, file.impl.allocator),
|
|
|
- },
|
|
|
- stream = {
|
|
|
- data = file,
|
|
|
- procedure = _file_stream_proc,
|
|
|
- },
|
|
|
+ file.impl = {
|
|
|
+ fd = linux.Fd(fd),
|
|
|
+ allocator = file_allocator(),
|
|
|
+ name = _get_full_path(file.impl.fd, file.impl.allocator),
|
|
|
+ }
|
|
|
+ file.stream = {
|
|
|
+ data = file,
|
|
|
+ procedure = _file_stream_proc,
|
|
|
}
|
|
|
+ file.fstat = _fstat
|
|
|
+ return file
|
|
|
}
|
|
|
|
|
|
_destroy :: proc(f: ^File) -> Error {
|