mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 15:48:51 +00:00
Use fstat on os2.File directly
This commit is contained in:
+10
-15
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user