Andrew Kelley
81bfd28974
std.Io.Dir: rework atomic file
2026-01-05 20:28:58 -08:00
Andrew Kelley
d6a1e73142
std: start wrangling environment variables and process args
...
this commit is unfinished. It marks a spot where I wanted to start
moving child process stuff below the std.Io.VTable
2026-01-04 00:27:07 -08:00
Michael Dusan
09f06082f0
openbsd: make test lib/std/std.zig pass
...
* According to OpenBSD's getdents docs indicate the buffer must be
greater or or equal to the block size associated with the file and to
refer to stat(2).
* Use S_BLKSIZE, which is 512, instead of @sizeOf(std.c.dirent), which is 280.
* Oddly the other BSDs are not this picky.
2025-12-29 21:40:02 -05:00
nyx-xyn
f2f474fc78
std.Io.Dir: pass io to Walker.leave
2025-12-29 00:36:57 +01:00
Andrew Kelley
a7c9d11b28
std.Io: make file access time optional
...
Some filesystems, such as ZFS, do not report atime. It's pretty useless
in general, so make it an optional field in File.Stat.
Also take the opportunity to make setting timestamps API more flexible
and match the APIs widely available, which have UTIME_OMIT and UTIME_NOW
constants that can be independently set for both fields.
This is needed to handle smoothly the case when atime is null.
2025-12-27 10:40:24 -08:00
Ryan Liptak
e442a0ecc2
Dir.readFile/readFileAlloc: take advantage of .allow_directory = false on Windows
...
Since we know the read will fail for directories, we can take advantage
of Windows being able to fail with IsDir during open to avoid needing to
wait until the read to find out about the directory-ness of the file.
2025-12-23 22:15:11 -08:00
Ryan Liptak
ad08117e9d
Fix sizing of buffer/reservation size for dirReadWindows
2025-12-23 22:15:11 -08:00
Andrew Kelley
99f25bfc23
std.Io: implement directory reading for WASI
2025-12-23 22:15:11 -08:00
Andrew Kelley
a8088306f6
std: rename other Dir "make" functions to "create"
2025-12-23 22:15:11 -08:00
Andrew Kelley
6e0c7ed865
std: rename makeDir to createDir for consistency with createFile
2025-12-23 22:15:11 -08:00
Andrew Kelley
6aa31cedb7
std.Io.Dir.Reader: fix min_buffer_len on 32-bit linux
...
dirents64 still uses 8 byte alignment on 32-bit systems
2025-12-23 22:15:11 -08:00
Andrew Kelley
002d444964
std: fix Io.Dir.min_buffer_len on Linux
2025-12-23 22:15:11 -08:00
Ryan Liptak
3431f45031
std: Enough fixes to get things compiling on Windows
2025-12-23 22:15:11 -08:00
Andrew Kelley
8632a28ca9
std: add support for realpath on file handle
...
and rename OperationNotSupported to OperationUnsupported
2025-12-23 22:15:10 -08:00
Andrew Kelley
3466056478
std.Io.Dir.CopyFileOptions: rename override_permissions
...
to more simply `permissions`.
In master branch this was `override_mode`.
2025-12-23 22:15:10 -08:00
Andrew Kelley
d8b1cc953e
std.Io.Dir.renameAbsolute: consistent parameter order
2025-12-23 22:15:10 -08:00
Andrew Kelley
f3723b42e1
std.Io: add unimplemented hard link API to File and Dir
2025-12-23 22:15:10 -08:00
Andrew Kelley
446c145ca8
std.Io.Threaded: fix compilation errors on posix
2025-12-23 22:15:10 -08:00
Ryan Liptak
a2416c685a
Implement dirReadWindows
2025-12-23 22:15:10 -08:00
Andrew Kelley
a5b719e9eb
compiler: fix build failures from std.Io-fs
2025-12-23 22:15:10 -08:00
Andrew Kelley
97f106f949
std.Io: fix dir iteration on macOS
2025-12-23 22:15:09 -08:00
Andrew Kelley
22afd168d9
fix build runner compilation errors on macOS
2025-12-23 22:15:09 -08:00
Andrew Kelley
16bd2e137e
compiler: fix most compilation errors from std.fs changes
2025-12-23 22:15:09 -08:00
Andrew Kelley
22b0eea3c0
std.Io.Dir: improve realPath documentation
2025-12-23 22:15:09 -08:00
Andrew Kelley
16f8af1b9a
compiler: update various code to new fs API
2025-12-23 22:15:09 -08:00
Andrew Kelley
e1cf753db7
std: update fchmodat tests
2025-12-23 22:15:09 -08:00
Andrew Kelley
68621afd2e
std.tar: update fs API calls to take io argument
2025-12-23 22:15:09 -08:00
Andrew Kelley
0e230993d5
std.Io.Dir: add setFilePermissions and setFileOwner
2025-12-23 22:15:09 -08:00
Andrew Kelley
91fa252cf2
std.Io: implement dir reading for BSDs
2025-12-23 22:15:09 -08:00
Andrew Kelley
94ef56ee26
std.Io.Dir: fix walking
...
* Make Io.Dir.Reader lower level, accepting a buffer.
* Make Io.Dir.Iterator higher level, requesting only one Entry with
every call to `next`.
2025-12-23 22:15:09 -08:00
Andrew Kelley
7bc0166b7c
std.Io: implement dirRead for Linux
...
unfortunately, Io.Dir.SelectiveWalker is copying the iterator which
has multiple problems
2025-12-23 22:15:09 -08:00
Andrew Kelley
78d262d96e
std: WIP: debug-level stderr writing
2025-12-23 22:15:09 -08:00
Andrew Kelley
5b436d2c51
build_runner compiling again
2025-12-23 22:15:08 -08:00
Andrew Kelley
bee8005fe6
std.heap.DebugAllocator: never detect TTY config
...
instead, allow the user to set it as a field.
this fixes a bug where leak printing and error printing would run tty
config detection for stderr, and then emit a log, which is not necessary
going to print to stderr.
however, the nice defaults are gone; the user must explicitly assign the
tty_config field during initialization or else the logging will not have
color.
related: https://github.com/ziglang/zig/issues/24510
2025-12-23 22:15:08 -08:00
Andrew Kelley
4a53e5b0b4
fix a handful of compilation errors related to std.fs migration
2025-12-23 22:15:08 -08:00
Andrew Kelley
1dcfc8787e
update all readFileAlloc() to accept Io instance
2025-12-23 22:15:08 -08:00
Andrew Kelley
4be8be1d2b
update all rename() to rename(io)
2025-12-23 22:15:08 -08:00
Andrew Kelley
950d18ef69
update all access() to access(io)
2025-12-23 22:15:08 -08:00
Andrew Kelley
7f5bb118d4
std.Io: make all the close functions batched
2025-12-23 22:15:08 -08:00
Andrew Kelley
264d714321
update all openDir() sites to accept io instance
2025-12-23 22:15:08 -08:00
Andrew Kelley
9169983159
std.fs: migrate most of the API elsewhere
2025-12-23 22:15:08 -08:00
Andrew Kelley
877032ec6a
std: reorganize realpath and process executable APIs
2025-12-23 22:15:08 -08:00
Andrew Kelley
8328de24f1
update all occurrences of openFile to receive an io instance
2025-12-23 22:15:08 -08:00
Andrew Kelley
dd1d15b72a
update all occurrences of std.fs.Dir to std.Io.Dir
2025-12-23 22:15:08 -08:00
Andrew Kelley
aafddc2ea1
update all occurrences of close() to close(io)
2025-12-23 22:15:07 -08:00
Andrew Kelley
ba999d608c
std: extract sendfile/copy_file_range from Io.File.Writer
...
and move it into std.Io.Threaded (below the VTable)
2025-12-23 22:15:07 -08:00
Andrew Kelley
814480db7c
std: all File functions moved to std.Io
2025-12-23 22:15:07 -08:00
Andrew Kelley
d1d2c37af2
std: all Dir functions moved to std.Io
2025-12-23 22:15:07 -08:00
Andrew Kelley
89bda60d28
std.Io.Threaded: implement makePath
2025-12-23 22:15:07 -08:00
Matthew Lugg
49f17237b0
compiler,std: remove a handful of redundant discards
...
I'm embarrassed to say I didn't realise until a few days ago that you
could omit the `_` capture for `if`/`while` on `E!void`...
2025-12-22 11:54:57 +00:00