- 
          
 - 
                Notifications
    
You must be signed in to change notification settings  - Fork 841
 
Open
Labels
Description
We are nearing the replacement of core:os, this issue outlines todos and nice to haves.
Todos:
- core:os/os2 read_entire_file creates infinite loop #3279
 - os2.pipe() -> Assert error #4712
 -  @gingerBill needs to look at the env API, 
env_posix.odinhas a bunch ofNOTE(laytan):comments outlining potential improvements, same thing on the directory iterator, these comments are mostly about surfacing errors instead of ignoring them or returning just a boolean (which core:os famously does a lot and we should avoid) (b3bbb00 & 7994405) -  the 
IMPORTANT NOTEsaying the package is a mockup needs to be removed fromdoc.odin -  
writeon linux needs to loop until everything is written, just like windows and posix implementations (os/os2: bring Linux to other impls standards by looping writes and maxing one shot RW sizes #4730) -  linux does not do the 
MAX_RWthing other implementations do but afaik it does have the same restriction (os/os2: bring Linux to other impls standards by looping writes and maxing one shot RW sizes #4730) -  
removeon posix needs to handle directories, just like the other implementations (it already did, whoops) -  unused 
File_Flagcases should be removed,.Sparse,.Unbuffered_IO -  
core:pathneeds to be looked over and possibly removed/merged into os2 (Add new path API foros2#4954) - Flysand: create() does not allow to set the permission bits or specify the behavior when the file exists (.Trunc or .Excl). I would like to see truncate parameter to that procedure that is false by default. If it's not specified, .Excl is the behavior on existing files, otherwise existing file is truncated.
 - atomic bulk operations
 - bulk operations errors with more info on what actually went wrong and where, so instead of Permission_Denied, get a path back or something too
 - Errors are not detailed enough, often getting an .Unknown, this is because it is built on io.Error
 
Targets supported in core:os but not yet in core:os/os2:
- wasi (os/os2: wasi target support #4716)
 -  js - just 
os.writeis implemented, maybe it should just be dropped entirely for os2 - haiku - should be pretty easy to use the posix implementation at first, can go "native" later
 
Non blocking but can have api consequences:
- buffered file mode/flag (needs testing to see if it's beneficial)
 - Jeroen: Virtual File System - file possibly backed by not actual files
 
Packages that use core:os and need to be updated: (Started in #5858)
-  
core:compress/gzip -  
core:crypto -  
core:encoding/csv -  
core:encoding/hxa -  
core:encoding/ini -  
core:encoding/xml -  
core:flags -  
core:fmt -  
core:image/bmp -  
core:image/jpeg -  
core:image/netpbm -  
core:image/png -  
core:image/qoi -  
core:image/tga -  
core:image -  
core:log -  
core:math/big -  
core:mem/virtual -  
core:net -  
core:odin/parser -  
core:path/filepath(todo: onlyrelanddirto look at adopting or not incore:os/os2) -  
core:prof/spall -  
core:terminal -  
core:testing -  
core:text/i18n -  
core:text/regex -  
core:text/table -  
core:time/timezone -  
core:unicode/tools -  
tests/core/encoding/hxa -  
tests/core/flags -  
tests/core/io -  
tests/core/os -  
tests/documentation -  
vendor:fontstash -  
vendor:libc -  
vendor:opengl -  
examples/all(for all of theodin checks at the moment, later also for documentation) - odin-lang/examples repo needs to be updated
 
Nice to have, but not blocking the replacement of core:os:
-  JS impl of 
core:fmtuses a 1k stack buffer to format into, add a way to grow if that's insufficient? Someone who uses wasm may want to look at this. - more tests
 -  docs additions, 
dir.odin,file.odin, etc. don't have any docs - docs unification, doc style differs between files and procs
 - linux process_info should query /proc/pid/exe instead of the way it's done now to get executable paths
 -  netbsd, openbsd, freebsd targets implementation for 
_process_info_by_pid,_process_list,_process_open,_process_handle_still_valid,_process_state_update_timesfor full process API coverage (decided to make non blocking because it is a new API) -  
current_executable_path(allocator: runtime.Allocator) -> (string, Error)returning the full absolute executable path of the program, useful for loading things relative to this path. You can already do this in a round about way with:current_process_info({.Executable_Path}, context.allocator)but a more direct way with the native APIs for each target would be nice (os/os2: add get_executable_path and get_executable_directory #4733) - wrapper api over the process API that handles the details of processes and just allows easy communication, similar to this idea: https://gist.github.com/laytan/68be38614d9274663a48fd3d710fefc2
 -  a heap allocator that does not rely on any system libraries, ideally this goes into 
base:though, so it can be the default allocator in general (Add native lock-free dynamic heap allocator #4749) -  
core:testingto replaceos2.stdoutandos2.stderrwith an implementation that synchronises between tests (currently writing to stdout or stderr in tests doesn't work well because the terminal renders progress and clears it out) - Flysand: There is no procedure to free a file handle without closing it (which can be used in tandem with new_file, if i.e. a library returned a handle, and that library is responsible for closing the file).
 - Flysand: It would be nice to have unlink :: remove alias.
 
After replacement the following can be closed:
flysand7, jk-gan, Retrodad0001, Feoramund, Kelimion and 4 more