And fix most of the fallout. This also makes optional pointers not
require resolving zero bits, because the comptime value struct layout no
longer depends on whether the type has zero bits.
Thanks to @LemonBoy for the behavior test case
Closes#4357Closes#4359
* improve `std.fs.AtomicFile` to use sendfile()
- also fix AtomicFile cleanup not destroying tmp files under some
error conditions
* improve `std.fs.updateFile` to take advantage of the new `makePath`
which no longer needs an Allocator.
* rename std.fs.makeDir to std.fs.makeDirAbsolute
* rename std.fs.Dir.makeDirC to std.fs.Dir.makeDirZ
* add std.fs.Dir.makeDirW and provide Windows implementation of
std.os.mkdirat. std.os.windows.CreateDirectory is now implemented
by calling ntdll, supports an optional root directory handle,
and returns an open directory handle. Its error set has a few more
errors in it.
* rename std.fs.Dir.changeTo to std.fs.Dir.setAsCwd
* fix std.fs.File.writevAll and related functions when len 0 iovecs
supplied.
* introduce `std.fs.File.writeFileAll`, exposing a convenient
cross-platform API on top of sendfile().
* `NoDevice` added to std.os.MakeDirError error set.
* std.os.fchdir gets a smaller error set.
* std.os.windows.CloseHandle is implemented with ntdll call rather than
kernel32.
The previous behaviour of using path.resolve has unexpected behaviour around symlinks.
This more simple implementation is more correct and doesn't require an allocator
* rework os.sendfile and add macosx support, and a fallback
implementation for any OS.
* fix sendto compile error
* std.os write functions support partial writes. closes#3443.
* std.os pread / pwrite functions can now return `error.Unseekable`.
* std.fs.File read/write functions now have readAll/writeAll variants
which loop to complete operations even when partial reads/writes
happen.
* Audit std.os read/write functions with respect to Linux returning
EINVAL for lengths greater than 0x7fff0000.
* std.os read/write shim functions do not unnecessarily loop. Since
partial reads/writes are part of the API, the caller will be forced
to loop anyway, and so that would just be code bloat.
* Improve doc comments
* Add a non-trivial test for std.os.sendfile
* Fix std.os.pread on 32 bit Linux
* Add missing SYS_sendfile bit on aarch64
This changset adds a `sendfile(2)` syscall bindings to the linux bits
component. Where available, the `sendfile64(2)` syscall will be
transparently called.
A wrapping function has also been added to the std.os to transform
errno returns to Zig errors.
Change-Id: I86769fc4382c0771e3656e7b21137bafd99a4411