@zigc/lib 0.16.0-test.1 → 0.17.0-dev.131
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +19 -0
- package/c/fcntl.zig +6 -1
- package/c/inttypes.zig +0 -10
- package/c/math.zig +138 -114
- package/c/pthread.zig +57 -0
- package/c/search.zig +1 -27
- package/c/stdlib/drand48.zig +0 -57
- package/c/stdlib.zig +0 -100
- package/c/string.zig +20 -7
- package/c/strings.zig +0 -38
- package/c/stropts.zig +17 -0
- package/c/unistd.zig +27 -26
- package/c/wchar.zig +10 -0
- package/c.zig +3 -2
- package/compiler/aro/aro/Attribute/names.zig +604 -589
- package/compiler/aro/aro/Attribute.zig +202 -116
- package/compiler/aro/aro/Builtins/common.zig +874 -863
- package/compiler/aro/aro/Builtins/eval.zig +15 -7
- package/compiler/aro/aro/Builtins.zig +0 -1
- package/compiler/aro/aro/CodeGen.zig +8 -7
- package/compiler/aro/aro/Compilation.zig +137 -111
- package/compiler/aro/aro/Diagnostics.zig +21 -17
- package/compiler/aro/aro/Driver/GCCDetector.zig +635 -0
- package/compiler/aro/aro/Driver.zig +138 -63
- package/compiler/aro/aro/LangOpts.zig +12 -2
- package/compiler/aro/aro/Parser/Diagnostic.zig +79 -19
- package/compiler/aro/aro/Parser.zig +352 -153
- package/compiler/aro/aro/Pragma.zig +3 -2
- package/compiler/aro/aro/Preprocessor/Diagnostic.zig +21 -0
- package/compiler/aro/aro/Preprocessor.zig +136 -62
- package/compiler/aro/aro/Target.zig +17 -12
- package/compiler/aro/aro/Tokenizer.zig +31 -14
- package/compiler/aro/aro/Toolchain.zig +4 -7
- package/compiler/aro/aro/Tree.zig +178 -148
- package/compiler/aro/aro/TypeStore.zig +82 -24
- package/compiler/aro/aro/Value.zig +13 -17
- package/compiler/aro/aro/features.zig +1 -0
- package/compiler/aro/aro/pragmas/message.zig +3 -2
- package/compiler/aro/aro/pragmas/once.zig +0 -1
- package/compiler/aro/aro/record_layout.zig +3 -3
- package/compiler/aro/aro/text_literal.zig +3 -2
- package/compiler/aro/assembly_backend/x86_64.zig +7 -8
- package/compiler/aro/backend/Assembly.zig +1 -2
- package/compiler/aro/backend/Interner.zig +2 -2
- package/compiler/aro/backend/Ir.zig +100 -92
- package/compiler/aro/include/ptrcheck.h +49 -0
- package/compiler/aro/main.zig +26 -10
- package/compiler/build_runner.zig +1 -2
- package/compiler/objdump.zig +93 -0
- package/compiler/reduce/Walk.zig +7 -7
- package/compiler/reduce.zig +5 -1
- package/compiler/resinator/compile.zig +2 -2
- package/compiler/resinator/main.zig +7 -1
- package/compiler/resinator/preprocess.zig +1 -3
- package/compiler/std-docs.zig +8 -1
- package/compiler/test_runner.zig +194 -62
- package/compiler/translate-c/MacroTranslator.zig +80 -11
- package/compiler/translate-c/PatternList.zig +1 -9
- package/compiler/translate-c/Scope.zig +43 -6
- package/compiler/translate-c/Translator.zig +369 -127
- package/compiler/translate-c/ast.zig +19 -11
- package/compiler/translate-c/main.zig +76 -17
- package/compiler_rt/cos.zig +140 -53
- package/compiler_rt/divmodei4.zig +40 -17
- package/compiler_rt/exp.zig +1 -6
- package/compiler_rt/exp2.zig +1 -6
- package/compiler_rt/exp_f128.zig +377 -0
- package/compiler_rt/fabs.zig +0 -2
- package/compiler_rt/fma.zig +0 -2
- package/compiler_rt/fmax.zig +0 -2
- package/compiler_rt/fmin.zig +0 -2
- package/compiler_rt/fmod.zig +0 -2
- package/compiler_rt/limb64.zig +1127 -0
- package/compiler_rt/log.zig +0 -2
- package/compiler_rt/log10.zig +0 -2
- package/compiler_rt/log2.zig +0 -2
- package/compiler_rt/long_double.zig +37 -0
- package/compiler_rt/mulXi3.zig +1 -1
- package/compiler_rt/mulo.zig +6 -1
- package/compiler_rt/rem_pio2l.zig +173 -0
- package/compiler_rt/round.zig +0 -2
- package/compiler_rt/sin.zig +139 -56
- package/compiler_rt/sincos.zig +277 -72
- package/compiler_rt/sqrt.zig +0 -2
- package/compiler_rt/ssp.zig +1 -1
- package/compiler_rt/tan.zig +117 -48
- package/compiler_rt/trig.zig +256 -6
- package/compiler_rt/trunc.zig +0 -2
- package/compiler_rt/udivmodei4.zig +28 -0
- package/compiler_rt.zig +2 -0
- package/fuzzer.zig +857 -307
- package/libc/musl/arch/mipsn32/syscall_arch.h +35 -32
- package/libc/musl/src/math/pow.c +343 -0
- package/package.json +1 -1
- package/std/Build/Cache.zig +6 -6
- package/std/Build/Fuzz.zig +6 -19
- package/std/Build/Module.zig +1 -1
- package/std/Build/Step/CheckObject.zig +3 -3
- package/std/Build/Step/Compile.zig +18 -1
- package/std/Build/Step/ConfigHeader.zig +49 -33
- package/std/Build/Step/InstallArtifact.zig +18 -0
- package/std/Build/Step/Run.zig +538 -89
- package/std/Build/Step/TranslateC.zig +0 -6
- package/std/Build/Step.zig +10 -19
- package/std/Build/WebServer.zig +31 -19
- package/std/Build/abi.zig +47 -11
- package/std/Build.zig +17 -17
- package/std/Io/Dir.zig +7 -2
- package/std/Io/Dispatch.zig +5 -13
- package/std/Io/File/Reader.zig +3 -1
- package/std/Io/File/Writer.zig +8 -6
- package/std/Io/File.zig +1 -0
- package/std/Io/Kqueue.zig +2 -2
- package/std/Io/Reader.zig +8 -9
- package/std/Io/Semaphore.zig +112 -17
- package/std/Io/Terminal.zig +1 -1
- package/std/Io/Threaded.zig +352 -180
- package/std/Io/Uring.zig +15 -16
- package/std/Io/Writer.zig +46 -42
- package/std/Io/net.zig +11 -11
- package/std/Io.zig +1052 -20
- package/std/SemanticVersion.zig +1 -1
- package/std/Target/Query.zig +2 -2
- package/std/Target.zig +53 -7
- package/std/Thread.zig +8 -3
- package/std/array_hash_map.zig +105 -573
- package/std/array_list.zig +22 -31
- package/std/bit_set.zig +22 -6
- package/std/builtin/assembly.zig +68 -0
- package/std/builtin.zig +4 -0
- package/std/c/haiku.zig +3 -0
- package/std/c/serenity.zig +1 -6
- package/std/c.zig +106 -24
- package/std/compress/flate/Compress.zig +3 -3
- package/std/compress/flate/Decompress.zig +2 -3
- package/std/compress/zstd/Decompress.zig +2 -4
- package/std/crypto/Certificate/Bundle.zig +15 -1
- package/std/crypto/Certificate.zig +13 -1
- package/std/crypto/ascon.zig +75 -33
- package/std/crypto/codecs/asn1/Oid.zig +12 -1
- package/std/crypto/codecs/asn1.zig +33 -18
- package/std/crypto/codecs/base64_hex_ct.zig +16 -8
- package/std/crypto/ml_kem.zig +2 -9
- package/std/crypto/tls/Client.zig +79 -4
- package/std/crypto/tls.zig +1 -1
- package/std/crypto.zig +1 -0
- package/std/debug/Dwarf.zig +29 -9
- package/std/debug/Info.zig +4 -0
- package/std/debug/MachOFile.zig +46 -8
- package/std/debug/Pdb.zig +540 -37
- package/std/debug/SelfInfo/Elf.zig +19 -18
- package/std/debug/SelfInfo/MachO.zig +18 -7
- package/std/debug/SelfInfo/Windows.zig +138 -36
- package/std/debug.zig +181 -66
- package/std/enums.zig +25 -19
- package/std/fmt.zig +8 -3
- package/std/fs/path.zig +6 -4
- package/std/heap/ArenaAllocator.zig +145 -154
- package/std/heap/BufferFirstAllocator.zig +165 -0
- package/std/heap/debug_allocator.zig +7 -7
- package/std/heap.zig +2 -126
- package/std/http/Client.zig +31 -30
- package/std/http.zig +14 -13
- package/std/json/Scanner.zig +2 -2
- package/std/json/Stringify.zig +3 -3
- package/std/json/dynamic.zig +4 -4
- package/std/math/big/int.zig +16 -17
- package/std/mem/Allocator.zig +4 -5
- package/std/mem.zig +48 -0
- package/std/os/emscripten.zig +2 -18
- package/std/os/linux/IoUring.zig +2 -0
- package/std/os/linux/aarch64.zig +41 -12
- package/std/os/linux/arc.zig +173 -0
- package/std/os/linux/arm.zig +41 -12
- package/std/os/linux/hexagon.zig +33 -11
- package/std/os/linux/loongarch32.zig +41 -13
- package/std/os/linux/loongarch64.zig +41 -12
- package/std/os/linux/m68k.zig +41 -13
- package/std/os/linux/mips.zig +67 -36
- package/std/os/linux/mips64.zig +60 -29
- package/std/os/linux/mipsn32.zig +60 -29
- package/std/os/linux/or1k.zig +41 -12
- package/std/os/linux/powerpc.zig +41 -12
- package/std/os/linux/powerpc64.zig +41 -12
- package/std/os/linux/riscv32.zig +41 -12
- package/std/os/linux/riscv64.zig +41 -12
- package/std/os/linux/s390x.zig +44 -7
- package/std/os/linux/sparc64.zig +83 -52
- package/std/os/linux/thumb.zig +52 -36
- package/std/os/linux/x32.zig +41 -12
- package/std/os/linux/x86.zig +42 -13
- package/std/os/linux/x86_64.zig +41 -12
- package/std/os/linux.zig +419 -438
- package/std/os/uefi/tables/boot_services.zig +9 -8
- package/std/os/windows.zig +2 -2
- package/std/os.zig +41 -0
- package/std/pdb.zig +143 -4
- package/std/posix.zig +6 -12
- package/std/priority_dequeue.zig +13 -12
- package/std/priority_queue.zig +5 -4
- package/std/process/Child.zig +1 -1
- package/std/process/Environ.zig +1 -1
- package/std/process.zig +1 -1
- package/std/sort.zig +3 -3
- package/std/start.zig +17 -4
- package/std/std.zig +19 -6
- package/std/testing/FailingAllocator.zig +4 -4
- package/std/testing/Smith.zig +37 -2
- package/std/zig/Ast/Render.zig +187 -459
- package/std/zig/Ast.zig +0 -4
- package/std/zig/AstGen.zig +86 -103
- package/std/zig/AstRlAnnotate.zig +0 -11
- package/std/zig/AstSmith.zig +2602 -0
- package/std/zig/BuiltinFn.zig +0 -32
- package/std/zig/Client.zig +8 -3
- package/std/zig/LibCInstallation.zig +4 -3
- package/std/zig/Parse.zig +90 -81
- package/std/zig/Server.zig +26 -0
- package/std/zig/WindowsSdk.zig +13 -13
- package/std/zig/Zir.zig +66 -62
- package/std/zig/ZonGen.zig +6 -5
- package/std/zig/c_translation/helpers.zig +14 -9
- package/std/zig/llvm/Builder.zig +119 -60
- package/std/zig/system.zig +20 -4
- package/std/zig/tokenizer.zig +2 -1
- package/std/zig.zig +7 -10
- package/std/zip.zig +5 -5
- package/zig.h +340 -1
- package/compiler/aro/aro/Driver/Filesystem.zig +0 -241
- package/libc/mingw/complex/cabs.c +0 -48
- package/libc/mingw/complex/cabsf.c +0 -48
- package/libc/mingw/complex/cacos.c +0 -50
- package/libc/mingw/complex/cacosf.c +0 -50
- package/libc/mingw/complex/carg.c +0 -48
- package/libc/mingw/complex/cargf.c +0 -48
- package/libc/mingw/complex/casin.c +0 -50
- package/libc/mingw/complex/casinf.c +0 -50
- package/libc/mingw/complex/catan.c +0 -50
- package/libc/mingw/complex/catanf.c +0 -50
- package/libc/mingw/complex/ccos.c +0 -50
- package/libc/mingw/complex/ccosf.c +0 -50
- package/libc/mingw/complex/cexp.c +0 -48
- package/libc/mingw/complex/cexpf.c +0 -48
- package/libc/mingw/complex/cimag.c +0 -48
- package/libc/mingw/complex/cimagf.c +0 -48
- package/libc/mingw/complex/clog.c +0 -48
- package/libc/mingw/complex/clog10.c +0 -49
- package/libc/mingw/complex/clog10f.c +0 -49
- package/libc/mingw/complex/clogf.c +0 -48
- package/libc/mingw/complex/conj.c +0 -48
- package/libc/mingw/complex/conjf.c +0 -48
- package/libc/mingw/complex/cpow.c +0 -48
- package/libc/mingw/complex/cpowf.c +0 -48
- package/libc/mingw/complex/cproj.c +0 -48
- package/libc/mingw/complex/cprojf.c +0 -48
- package/libc/mingw/complex/creal.c +0 -48
- package/libc/mingw/complex/crealf.c +0 -48
- package/libc/mingw/complex/csin.c +0 -50
- package/libc/mingw/complex/csinf.c +0 -50
- package/libc/mingw/complex/csqrt.c +0 -48
- package/libc/mingw/complex/csqrtf.c +0 -48
- package/libc/mingw/complex/ctan.c +0 -50
- package/libc/mingw/complex/ctanf.c +0 -50
- package/libc/mingw/math/arm/s_rint.c +0 -86
- package/libc/mingw/math/arm/s_rintf.c +0 -51
- package/libc/mingw/math/arm/sincos.S +0 -30
- package/libc/mingw/math/arm-common/sincosl.c +0 -13
- package/libc/mingw/math/arm64/rint.c +0 -12
- package/libc/mingw/math/arm64/rintf.c +0 -12
- package/libc/mingw/math/arm64/sincos.S +0 -32
- package/libc/mingw/math/bsd_private_base.h +0 -148
- package/libc/mingw/math/fdiml.c +0 -24
- package/libc/mingw/math/frexpf.c +0 -13
- package/libc/mingw/math/frexpl.c +0 -71
- package/libc/mingw/math/x86/acosf.c +0 -29
- package/libc/mingw/math/x86/atanf.c +0 -23
- package/libc/mingw/math/x86/atanl.c +0 -18
- package/libc/mingw/math/x86/cos.def.h +0 -65
- package/libc/mingw/math/x86/cosl.c +0 -46
- package/libc/mingw/math/x86/cosl_internal.S +0 -55
- package/libc/mingw/math/x86/ldexp.c +0 -23
- package/libc/mingw/math/x86/scalbn.S +0 -41
- package/libc/mingw/math/x86/scalbnf.S +0 -40
- package/libc/mingw/math/x86/sin.def.h +0 -65
- package/libc/mingw/math/x86/sinl.c +0 -46
- package/libc/mingw/math/x86/sinl_internal.S +0 -58
- package/libc/mingw/math/x86/tanl.S +0 -62
- package/libc/mingw/misc/btowc.c +0 -28
- package/libc/mingw/misc/wcstof.c +0 -66
- package/libc/mingw/misc/wcstoimax.c +0 -132
- package/libc/mingw/misc/wcstoumax.c +0 -126
- package/libc/mingw/misc/wctob.c +0 -29
- package/libc/mingw/misc/winbs_uint64.c +0 -6
- package/libc/mingw/misc/winbs_ulong.c +0 -6
- package/libc/mingw/misc/winbs_ushort.c +0 -6
- package/libc/mingw/stdio/_Exit.c +0 -10
- package/libc/mingw/stdio/_findfirst64i32.c +0 -21
- package/libc/mingw/stdio/_findnext64i32.c +0 -21
- package/libc/mingw/stdio/_fstat64i32.c +0 -37
- package/libc/mingw/stdio/_stat64i32.c +0 -37
- package/libc/mingw/stdio/_wfindfirst64i32.c +0 -21
- package/libc/mingw/stdio/_wfindnext64i32.c +0 -21
- package/libc/mingw/stdio/_wstat64i32.c +0 -37
- package/libc/mingw/winpthreads/spinlock.c +0 -82
- package/libc/musl/src/legacy/isastream.c +0 -7
- package/libc/musl/src/legacy/valloc.c +0 -8
- package/libc/musl/src/linux/tee.c +0 -8
- package/libc/musl/src/math/__cosl.c +0 -96
- package/libc/musl/src/math/__sinl.c +0 -78
- package/libc/musl/src/math/__tanl.c +0 -143
- package/libc/musl/src/math/aarch64/lrint.c +0 -10
- package/libc/musl/src/math/aarch64/lrintf.c +0 -10
- package/libc/musl/src/math/aarch64/rintf.c +0 -7
- package/libc/musl/src/math/cosl.c +0 -39
- package/libc/musl/src/math/fdim.c +0 -10
- package/libc/musl/src/math/fdimf.c +0 -10
- package/libc/musl/src/math/fdiml.c +0 -18
- package/libc/musl/src/math/finite.c +0 -7
- package/libc/musl/src/math/finitef.c +0 -7
- package/libc/musl/src/math/frexp.c +0 -23
- package/libc/musl/src/math/frexpf.c +0 -23
- package/libc/musl/src/math/frexpl.c +0 -29
- package/libc/musl/src/math/i386/lrint.c +0 -8
- package/libc/musl/src/math/i386/lrintf.c +0 -8
- package/libc/musl/src/math/i386/rintf.c +0 -7
- package/libc/musl/src/math/lrint.c +0 -72
- package/libc/musl/src/math/lrintf.c +0 -8
- package/libc/musl/src/math/powerpc64/lrint.c +0 -16
- package/libc/musl/src/math/powerpc64/lrintf.c +0 -16
- package/libc/musl/src/math/rintf.c +0 -30
- package/libc/musl/src/math/s390x/rintf.c +0 -15
- package/libc/musl/src/math/sincosl.c +0 -60
- package/libc/musl/src/math/sinl.c +0 -41
- package/libc/musl/src/math/tanl.c +0 -29
- package/libc/musl/src/math/x32/lrint.s +0 -5
- package/libc/musl/src/math/x32/lrintf.s +0 -5
- package/libc/musl/src/math/x86_64/lrint.c +0 -8
- package/libc/musl/src/math/x86_64/lrintf.c +0 -8
- package/libc/musl/src/string/strdup.c +0 -10
- package/libc/musl/src/string/strndup.c +0 -12
- package/libc/musl/src/string/wcsdup.c +0 -10
- package/libc/musl/src/thread/pthread_spin_destroy.c +0 -6
- package/libc/musl/src/thread/pthread_spin_init.c +0 -6
- package/libc/musl/src/thread/pthread_spin_lock.c +0 -8
- package/libc/musl/src/thread/pthread_spin_trylock.c +0 -7
- package/libc/musl/src/thread/pthread_spin_unlock.c +0 -7
- package/libc/musl/src/unistd/dup2.c +0 -20
- package/libc/musl/src/unistd/dup3.c +0 -26
- package/libc/wasi/libc-bottom-half/sources/reallocarray.c +0 -14
- package/libc/wasi/thread-stub/pthread_spin_lock.c +0 -8
- package/libc/wasi/thread-stub/pthread_spin_trylock.c +0 -8
- package/libc/wasi/thread-stub/pthread_spin_unlock.c +0 -7
package/std/Io.zig
CHANGED
|
@@ -243,8 +243,6 @@ pub const VTable = struct {
|
|
|
243
243
|
netConnectUnix: *const fn (?*anyopaque, *const net.UnixAddress) net.UnixAddress.ConnectError!net.Socket.Handle,
|
|
244
244
|
netSocketCreatePair: *const fn (?*anyopaque, net.Socket.CreatePairOptions) net.Socket.CreatePairError![2]net.Socket,
|
|
245
245
|
netSend: *const fn (?*anyopaque, net.Socket.Handle, []net.OutgoingMessage, net.SendFlags) struct { ?net.Socket.SendError, usize },
|
|
246
|
-
/// Returns 0 on end of stream.
|
|
247
|
-
netRead: *const fn (?*anyopaque, src: net.Socket.Handle, data: [][]u8) net.Stream.Reader.Error!usize,
|
|
248
246
|
netWrite: *const fn (?*anyopaque, dest: net.Socket.Handle, header: []const u8, data: []const []const u8, splat: usize) net.Stream.Writer.Error!usize,
|
|
249
247
|
netWriteFile: *const fn (?*anyopaque, net.Socket.Handle, header: []const u8, *Io.File.Reader, Io.Limit) net.Stream.Writer.WriteFileError!usize,
|
|
250
248
|
netClose: *const fn (?*anyopaque, handle: []const net.Socket.Handle) void,
|
|
@@ -261,6 +259,7 @@ pub const Operation = union(enum) {
|
|
|
261
259
|
/// other systems this tag is unreachable.
|
|
262
260
|
device_io_control: DeviceIoControl,
|
|
263
261
|
net_receive: NetReceive,
|
|
262
|
+
net_read: NetRead,
|
|
264
263
|
|
|
265
264
|
pub const Tag = @typeInfo(Operation).@"union".tag_type.?;
|
|
266
265
|
|
|
@@ -374,11 +373,35 @@ pub const Operation = union(enum) {
|
|
|
374
373
|
ConnectionResetByPeer,
|
|
375
374
|
/// The local network interface used to reach the destination is offline.
|
|
376
375
|
NetworkDown,
|
|
376
|
+
/// A connectionless packet was previously sent successfully,
|
|
377
|
+
/// however, it was not received because no service is operating at
|
|
378
|
+
/// the destination port of the transport on the remote system.
|
|
379
|
+
/// This caused an ICMP port unreachable packet to be returned to
|
|
380
|
+
/// the OS where it was queued up to be reported at the next call
|
|
381
|
+
/// to send or receive on the bound socket.
|
|
382
|
+
PortUnreachable,
|
|
377
383
|
} || Io.UnexpectedError;
|
|
378
384
|
|
|
379
385
|
pub const Result = struct { ?net.Socket.ReceiveError, usize };
|
|
380
386
|
};
|
|
381
387
|
|
|
388
|
+
pub const NetRead = struct {
|
|
389
|
+
socket_handle: net.Socket.Handle,
|
|
390
|
+
data: [][]u8,
|
|
391
|
+
|
|
392
|
+
pub const Error = error{
|
|
393
|
+
SystemResources,
|
|
394
|
+
ConnectionResetByPeer,
|
|
395
|
+
SocketUnconnected,
|
|
396
|
+
/// The file descriptor does not hold the required rights to read
|
|
397
|
+
/// from it.
|
|
398
|
+
AccessDenied,
|
|
399
|
+
NetworkDown,
|
|
400
|
+
} || Io.UnexpectedError;
|
|
401
|
+
|
|
402
|
+
pub const Result = Error!usize;
|
|
403
|
+
};
|
|
404
|
+
|
|
382
405
|
pub const Result = Result: {
|
|
383
406
|
const operation_fields = @typeInfo(Operation).@"union".fields;
|
|
384
407
|
var field_names: [operation_fields.len][]const u8 = undefined;
|
|
@@ -500,8 +523,8 @@ pub const Batch = struct {
|
|
|
500
523
|
/// Returns the index that will be returned by `next` after the operation completes.
|
|
501
524
|
/// Asserts that no more than `storage.len` operations are active at a time.
|
|
502
525
|
pub fn add(batch: *Batch, operation: Operation) u32 {
|
|
503
|
-
const index = batch.unused.
|
|
504
|
-
batch.addAt(index
|
|
526
|
+
const index = batch.unused.head.toIndex();
|
|
527
|
+
batch.addAt(index, operation);
|
|
505
528
|
return index;
|
|
506
529
|
}
|
|
507
530
|
|
|
@@ -867,7 +890,7 @@ pub const Clock = enum {
|
|
|
867
890
|
if (t.clock == clock) return t;
|
|
868
891
|
const now_old = t.clock.now(io);
|
|
869
892
|
const now_new = clock.now(io);
|
|
870
|
-
const duration = now_old.durationTo(t);
|
|
893
|
+
const duration = now_old.durationTo(t.raw);
|
|
871
894
|
return .{
|
|
872
895
|
.clock = clock,
|
|
873
896
|
.raw = now_new.addDuration(duration),
|
|
@@ -1658,20 +1681,29 @@ pub const Condition = struct {
|
|
|
1658
1681
|
.epoch = .init(0),
|
|
1659
1682
|
};
|
|
1660
1683
|
|
|
1684
|
+
/// Blocks until the condition is signaled or canceled.
|
|
1685
|
+
///
|
|
1686
|
+
/// See also:
|
|
1687
|
+
/// * `waitUncancelable`
|
|
1688
|
+
/// * `waitTimeout`
|
|
1661
1689
|
pub fn wait(cond: *Condition, io: Io, mutex: *Mutex) Cancelable!void {
|
|
1662
|
-
|
|
1690
|
+
waitTimeout(cond, io, mutex, .none) catch |err| switch (err) {
|
|
1691
|
+
error.Timeout => unreachable,
|
|
1692
|
+
error.Canceled => |e| return e,
|
|
1693
|
+
};
|
|
1663
1694
|
}
|
|
1664
1695
|
|
|
1665
|
-
|
|
1696
|
+
pub const WaitTimeoutError = Cancelable || Timeout.Error;
|
|
1697
|
+
|
|
1698
|
+
/// Blocks until the condition is signaled, canceled, or the provided
|
|
1699
|
+
/// timeout expires.
|
|
1666
1700
|
///
|
|
1667
|
-
///
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
}
|
|
1701
|
+
/// See also:
|
|
1702
|
+
/// * `wait`
|
|
1703
|
+
/// * `waitUncancelable`
|
|
1704
|
+
pub fn waitTimeout(cond: *Condition, io: Io, mutex: *Mutex, timeout: Timeout) WaitTimeoutError!void {
|
|
1705
|
+
const deadline = timeout.toDeadline(io);
|
|
1673
1706
|
|
|
1674
|
-
fn waitInner(cond: *Condition, io: Io, mutex: *Mutex, uncancelable: bool) Cancelable!void {
|
|
1675
1707
|
var epoch = cond.epoch.load(.acquire); // `.acquire` to ensure ordered before state load
|
|
1676
1708
|
|
|
1677
1709
|
{
|
|
@@ -1683,10 +1715,7 @@ pub const Condition = struct {
|
|
|
1683
1715
|
defer mutex.lockUncancelable(io);
|
|
1684
1716
|
|
|
1685
1717
|
while (true) {
|
|
1686
|
-
const result =
|
|
1687
|
-
io.futexWaitUncancelable(u32, &cond.epoch.raw, epoch)
|
|
1688
|
-
else
|
|
1689
|
-
io.futexWait(u32, &cond.epoch.raw, epoch);
|
|
1718
|
+
const result = io.futexWaitTimeout(u32, &cond.epoch.raw, epoch, deadline);
|
|
1690
1719
|
|
|
1691
1720
|
epoch = cond.epoch.load(.acquire); // `.acquire` to ensure ordered before `state` laod
|
|
1692
1721
|
|
|
@@ -1706,13 +1735,62 @@ pub const Condition = struct {
|
|
|
1706
1735
|
}
|
|
1707
1736
|
|
|
1708
1737
|
// There are no more signals available; this was a spurious wakeup or an error. If it
|
|
1709
|
-
// was an error, we will remove ourselves as a waiter and return that error.
|
|
1710
|
-
//
|
|
1738
|
+
// was an error, we will remove ourselves as a waiter and return that error. If a
|
|
1739
|
+
// timeout was specified and the deadline has passed, we remove ourselves as a waiter
|
|
1740
|
+
// and return `error.Timeout`. Otherwise, we'll loop back to the futex wait.
|
|
1711
1741
|
result catch |err| {
|
|
1712
1742
|
const prev_state = cond.state.fetchSub(.{ .waiters = 1, .signals = 0 }, .monotonic);
|
|
1713
1743
|
assert(prev_state.waiters > 0); // underflow caused by illegal state
|
|
1714
1744
|
return err;
|
|
1715
1745
|
};
|
|
1746
|
+
switch (deadline) {
|
|
1747
|
+
.none => {},
|
|
1748
|
+
.deadline => |d| if (d.untilNow(io).raw.nanoseconds >= 0) {
|
|
1749
|
+
const prev_state = cond.state.fetchSub(.{ .waiters = 1, .signals = 0 }, .monotonic);
|
|
1750
|
+
assert(prev_state.waiters > 0); // underflow caused by illegal state
|
|
1751
|
+
return error.Timeout;
|
|
1752
|
+
},
|
|
1753
|
+
.duration => unreachable,
|
|
1754
|
+
}
|
|
1755
|
+
}
|
|
1756
|
+
}
|
|
1757
|
+
|
|
1758
|
+
/// Same as `wait`, except does not introduce a cancelation point.
|
|
1759
|
+
///
|
|
1760
|
+
/// See `Future.cancel` for a description of cancelation points.
|
|
1761
|
+
pub fn waitUncancelable(cond: *Condition, io: Io, mutex: *Mutex) void {
|
|
1762
|
+
var epoch = cond.epoch.load(.acquire); // `.acquire` to ensure ordered before state load
|
|
1763
|
+
|
|
1764
|
+
{
|
|
1765
|
+
const prev_state = cond.state.fetchAdd(.{ .waiters = 1, .signals = 0 }, .monotonic);
|
|
1766
|
+
assert(prev_state.waiters < math.maxInt(u16)); // overflow caused by too many waiters
|
|
1767
|
+
}
|
|
1768
|
+
|
|
1769
|
+
mutex.unlock(io);
|
|
1770
|
+
defer mutex.lockUncancelable(io);
|
|
1771
|
+
|
|
1772
|
+
while (true) {
|
|
1773
|
+
io.futexWaitUncancelable(u32, &cond.epoch.raw, epoch);
|
|
1774
|
+
|
|
1775
|
+
epoch = cond.epoch.load(.acquire); // `.acquire` to ensure ordered before `state` laod
|
|
1776
|
+
|
|
1777
|
+
// Even on error, try to consume a pending signal first. Otherwise a race might
|
|
1778
|
+
// cause a signal to get stuck in the state with no corresponding waiter.
|
|
1779
|
+
{
|
|
1780
|
+
var prev_state = cond.state.load(.monotonic);
|
|
1781
|
+
while (prev_state.signals > 0) {
|
|
1782
|
+
prev_state = cond.state.cmpxchgWeak(prev_state, .{
|
|
1783
|
+
.waiters = prev_state.waiters - 1,
|
|
1784
|
+
.signals = prev_state.signals - 1,
|
|
1785
|
+
}, .acquire, .monotonic) orelse {
|
|
1786
|
+
// We successfully consumed a signal.
|
|
1787
|
+
return;
|
|
1788
|
+
};
|
|
1789
|
+
}
|
|
1790
|
+
}
|
|
1791
|
+
|
|
1792
|
+
// There are no more signals available; this was a spurious wakeup,
|
|
1793
|
+
// so we'll loop back to the futex wait.
|
|
1716
1794
|
}
|
|
1717
1795
|
}
|
|
1718
1796
|
|
|
@@ -2491,3 +2569,957 @@ test {
|
|
|
2491
2569
|
_ = Semaphore;
|
|
2492
2570
|
_ = @import("Io/test.zig");
|
|
2493
2571
|
}
|
|
2572
|
+
|
|
2573
|
+
/// An implementation of `Io` which simulates a system supporting no `Io` operations.
|
|
2574
|
+
///
|
|
2575
|
+
/// This system has the following properties:
|
|
2576
|
+
/// * Concurrency is unavailable.
|
|
2577
|
+
/// * The stdio handles are pipes whose remote ends are already closed.
|
|
2578
|
+
/// * The filesystem is entirely empty, including that the cwd is no longer present.
|
|
2579
|
+
/// * The filesystem is full, so attempting to create entries always returns `error.NoSpaceLeft`.
|
|
2580
|
+
/// * No entropy source is supported, so `randomSecure` always returns `error.EntropyUnavailable`, and `random` always returns (fills the buffer) with 0.
|
|
2581
|
+
/// * No clocks are supported, so `now` and `sleep` always return `error.UnsupportedClock`.
|
|
2582
|
+
/// * No network is connected, so network operations always return `error.NetworkDown`.
|
|
2583
|
+
pub const failing: std.Io = .{
|
|
2584
|
+
.userdata = null,
|
|
2585
|
+
.vtable = &.{
|
|
2586
|
+
.crashHandler = noCrashHandler,
|
|
2587
|
+
|
|
2588
|
+
.async = noAsync,
|
|
2589
|
+
.concurrent = failingConcurrent,
|
|
2590
|
+
.await = unreachableAwait,
|
|
2591
|
+
.cancel = unreachableCancel,
|
|
2592
|
+
|
|
2593
|
+
.groupAsync = noGroupAsync,
|
|
2594
|
+
.groupConcurrent = failingGroupConcurrent,
|
|
2595
|
+
.groupAwait = unreachableGroupAwait,
|
|
2596
|
+
.groupCancel = unreachableGroupCancel,
|
|
2597
|
+
|
|
2598
|
+
.recancel = unreachableRecancel,
|
|
2599
|
+
.swapCancelProtection = unreachableSwapCancelProtection,
|
|
2600
|
+
.checkCancel = unreachableCheckCancel,
|
|
2601
|
+
|
|
2602
|
+
.futexWait = noFutexWait,
|
|
2603
|
+
.futexWaitUncancelable = noFutexWaitUncancelable,
|
|
2604
|
+
.futexWake = noFutexWake,
|
|
2605
|
+
|
|
2606
|
+
.operate = failingOperate,
|
|
2607
|
+
.batchAwaitAsync = unreachableBatchAwaitAsync,
|
|
2608
|
+
.batchAwaitConcurrent = unreachableBatchAwaitConcurrent,
|
|
2609
|
+
.batchCancel = unreachableBatchCancel,
|
|
2610
|
+
|
|
2611
|
+
.dirCreateDir = failingDirCreateDir,
|
|
2612
|
+
.dirCreateDirPath = failingDirCreateDirPath,
|
|
2613
|
+
.dirCreateDirPathOpen = failingDirCreateDirPathOpen,
|
|
2614
|
+
.dirOpenDir = failingDirOpenDir,
|
|
2615
|
+
.dirStat = failingDirStat,
|
|
2616
|
+
.dirStatFile = failingDirStatFile,
|
|
2617
|
+
.dirAccess = failingDirAccess,
|
|
2618
|
+
.dirCreateFile = failingDirCreateFile,
|
|
2619
|
+
.dirCreateFileAtomic = failingDirCreateFileAtomic,
|
|
2620
|
+
.dirOpenFile = failingDirOpenFile,
|
|
2621
|
+
.dirClose = unreachableDirClose,
|
|
2622
|
+
.dirRead = noDirRead,
|
|
2623
|
+
.dirRealPath = failingDirRealPath,
|
|
2624
|
+
.dirRealPathFile = failingDirRealPathFile,
|
|
2625
|
+
.dirDeleteFile = failingDirDeleteFile,
|
|
2626
|
+
.dirDeleteDir = failingDirDeleteDir,
|
|
2627
|
+
.dirRename = failingDirRename,
|
|
2628
|
+
.dirRenamePreserve = failingDirRenamePreserve,
|
|
2629
|
+
.dirSymLink = failingDirSymLink,
|
|
2630
|
+
.dirReadLink = failingDirReadLink,
|
|
2631
|
+
.dirSetOwner = failingDirSetOwner,
|
|
2632
|
+
.dirSetFileOwner = failingDirSetFileOwner,
|
|
2633
|
+
.dirSetPermissions = failingDirSetPermissions,
|
|
2634
|
+
.dirSetFilePermissions = failingDirSetFilePermissions,
|
|
2635
|
+
.dirSetTimestamps = noDirSetTimestamps,
|
|
2636
|
+
.dirHardLink = failingDirHardLink,
|
|
2637
|
+
|
|
2638
|
+
.fileStat = failingFileStat,
|
|
2639
|
+
.fileLength = failingFileLength,
|
|
2640
|
+
.fileClose = unreachableFileClose,
|
|
2641
|
+
.fileWritePositional = failingFileWritePositional,
|
|
2642
|
+
.fileWriteFileStreaming = noFileWriteFileStreaming,
|
|
2643
|
+
.fileWriteFilePositional = noFileWriteFilePositional,
|
|
2644
|
+
.fileReadPositional = failingFileReadPositional,
|
|
2645
|
+
.fileSeekBy = failingFileSeekBy,
|
|
2646
|
+
.fileSeekTo = failingFileSeekTo,
|
|
2647
|
+
.fileSync = failingFileSync,
|
|
2648
|
+
.fileIsTty = unreachableFileIsTty,
|
|
2649
|
+
.fileEnableAnsiEscapeCodes = unreachableFileEnableAnsiEscapeCodes,
|
|
2650
|
+
.fileSupportsAnsiEscapeCodes = unreachableFileSupportsAnsiEscapeCodes,
|
|
2651
|
+
.fileSetLength = failingFileSetLength,
|
|
2652
|
+
.fileSetOwner = failingFileSetOwner,
|
|
2653
|
+
.fileSetPermissions = failingFileSetPermissions,
|
|
2654
|
+
.fileSetTimestamps = noFileSetTimestamps,
|
|
2655
|
+
.fileLock = failingFileLock,
|
|
2656
|
+
.fileTryLock = failingFileTryLock,
|
|
2657
|
+
.fileUnlock = unreachableFileUnlock,
|
|
2658
|
+
.fileDowngradeLock = failingFileDowngradeLock,
|
|
2659
|
+
.fileRealPath = failingFileRealPath,
|
|
2660
|
+
.fileHardLink = failingFileHardLink,
|
|
2661
|
+
|
|
2662
|
+
.fileMemoryMapCreate = failingFileMemoryMapCreate,
|
|
2663
|
+
.fileMemoryMapDestroy = unreachableFileMemoryMapDestroy,
|
|
2664
|
+
.fileMemoryMapSetLength = unreachableFileMemoryMapSetLength,
|
|
2665
|
+
.fileMemoryMapRead = unreachableFileMemoryMapRead,
|
|
2666
|
+
.fileMemoryMapWrite = unreachableFileMemoryMapWrite,
|
|
2667
|
+
|
|
2668
|
+
.processExecutableOpen = failingProcessExecutableOpen,
|
|
2669
|
+
.processExecutablePath = failingProcessExecutablePath,
|
|
2670
|
+
.lockStderr = unreachableLockStderr,
|
|
2671
|
+
.tryLockStderr = noTryLockStderr,
|
|
2672
|
+
.unlockStderr = unreachableUnlockStderr,
|
|
2673
|
+
.processCurrentPath = failingProcessCurrentPath,
|
|
2674
|
+
.processSetCurrentDir = failingProcessSetCurrentDir,
|
|
2675
|
+
.processSetCurrentPath = failingProcessSetCurrentPath,
|
|
2676
|
+
.processReplace = failingProcessReplace,
|
|
2677
|
+
.processReplacePath = failingProcessReplacePath,
|
|
2678
|
+
.processSpawn = failingProcessSpawn,
|
|
2679
|
+
.processSpawnPath = failingProcessSpawnPath,
|
|
2680
|
+
.childWait = unreachableChildWait,
|
|
2681
|
+
.childKill = unreachableChildKill,
|
|
2682
|
+
|
|
2683
|
+
.progressParentFile = failingProgressParentFile,
|
|
2684
|
+
|
|
2685
|
+
.random = noRandom,
|
|
2686
|
+
.randomSecure = failingRandomSecure,
|
|
2687
|
+
|
|
2688
|
+
.now = noNow,
|
|
2689
|
+
.clockResolution = failingClockResolution,
|
|
2690
|
+
.sleep = noSleep,
|
|
2691
|
+
|
|
2692
|
+
.netListenIp = failingNetListenIp,
|
|
2693
|
+
.netAccept = failingNetAccept,
|
|
2694
|
+
.netBindIp = failingNetBindIp,
|
|
2695
|
+
.netConnectIp = failingNetConnectIp,
|
|
2696
|
+
.netListenUnix = failingNetListenUnix,
|
|
2697
|
+
.netConnectUnix = failingNetConnectUnix,
|
|
2698
|
+
.netSocketCreatePair = failingNetSocketCreatePair,
|
|
2699
|
+
.netSend = failingNetSend,
|
|
2700
|
+
.netWrite = failingNetWrite,
|
|
2701
|
+
.netWriteFile = failingNetWriteFile,
|
|
2702
|
+
.netClose = unreachableNetClose,
|
|
2703
|
+
.netShutdown = failingNetShutdown,
|
|
2704
|
+
.netInterfaceNameResolve = failingNetInterfaceNameResolve,
|
|
2705
|
+
.netInterfaceName = unreachableNetInterfaceName,
|
|
2706
|
+
.netLookup = failingNetLookup,
|
|
2707
|
+
},
|
|
2708
|
+
};
|
|
2709
|
+
|
|
2710
|
+
pub fn noCrashHandler(userdata: ?*anyopaque) void {
|
|
2711
|
+
_ = userdata;
|
|
2712
|
+
}
|
|
2713
|
+
|
|
2714
|
+
pub fn noAsync(userdata: ?*anyopaque, result: []u8, result_alignment: std.mem.Alignment, context: []const u8, context_alignment: std.mem.Alignment, start: *const fn (context: *const anyopaque, result: *anyopaque) void) ?*AnyFuture {
|
|
2715
|
+
_ = userdata;
|
|
2716
|
+
_ = result_alignment;
|
|
2717
|
+
_ = context_alignment;
|
|
2718
|
+
start(context.ptr, result.ptr);
|
|
2719
|
+
return null;
|
|
2720
|
+
}
|
|
2721
|
+
|
|
2722
|
+
pub fn failingConcurrent(
|
|
2723
|
+
userdata: ?*anyopaque,
|
|
2724
|
+
result_len: usize,
|
|
2725
|
+
result_alignment: std.mem.Alignment,
|
|
2726
|
+
context: []const u8,
|
|
2727
|
+
context_alignment: std.mem.Alignment,
|
|
2728
|
+
start: *const fn (context: *const anyopaque, result: *anyopaque) void,
|
|
2729
|
+
) ConcurrentError!*AnyFuture {
|
|
2730
|
+
_ = userdata;
|
|
2731
|
+
_ = result_len;
|
|
2732
|
+
_ = result_alignment;
|
|
2733
|
+
_ = context;
|
|
2734
|
+
_ = context_alignment;
|
|
2735
|
+
_ = start;
|
|
2736
|
+
return error.ConcurrencyUnavailable;
|
|
2737
|
+
}
|
|
2738
|
+
|
|
2739
|
+
pub fn unreachableAwait(
|
|
2740
|
+
userdata: ?*anyopaque,
|
|
2741
|
+
any_future: *AnyFuture,
|
|
2742
|
+
result: []u8,
|
|
2743
|
+
result_alignment: std.mem.Alignment,
|
|
2744
|
+
) void {
|
|
2745
|
+
_ = userdata;
|
|
2746
|
+
_ = any_future;
|
|
2747
|
+
_ = result;
|
|
2748
|
+
_ = result_alignment;
|
|
2749
|
+
unreachable;
|
|
2750
|
+
}
|
|
2751
|
+
|
|
2752
|
+
pub fn unreachableCancel(
|
|
2753
|
+
userdata: ?*anyopaque,
|
|
2754
|
+
any_future: *AnyFuture,
|
|
2755
|
+
result: []u8,
|
|
2756
|
+
result_alignment: std.mem.Alignment,
|
|
2757
|
+
) void {
|
|
2758
|
+
_ = userdata;
|
|
2759
|
+
_ = any_future;
|
|
2760
|
+
_ = result;
|
|
2761
|
+
_ = result_alignment;
|
|
2762
|
+
unreachable;
|
|
2763
|
+
}
|
|
2764
|
+
|
|
2765
|
+
pub fn noGroupAsync(
|
|
2766
|
+
userdata: ?*anyopaque,
|
|
2767
|
+
group: *Group,
|
|
2768
|
+
context: []const u8,
|
|
2769
|
+
context_alignment: std.mem.Alignment,
|
|
2770
|
+
start: *const fn (context: *const anyopaque) void,
|
|
2771
|
+
) void {
|
|
2772
|
+
_ = userdata;
|
|
2773
|
+
_ = group;
|
|
2774
|
+
_ = context_alignment;
|
|
2775
|
+
start(context.ptr);
|
|
2776
|
+
}
|
|
2777
|
+
|
|
2778
|
+
pub fn failingGroupConcurrent(
|
|
2779
|
+
userdata: ?*anyopaque,
|
|
2780
|
+
group: *Group,
|
|
2781
|
+
context: []const u8,
|
|
2782
|
+
context_alignment: std.mem.Alignment,
|
|
2783
|
+
start: *const fn (context: *const anyopaque) void,
|
|
2784
|
+
) ConcurrentError!void {
|
|
2785
|
+
_ = userdata;
|
|
2786
|
+
_ = group;
|
|
2787
|
+
_ = context;
|
|
2788
|
+
_ = context_alignment;
|
|
2789
|
+
_ = start;
|
|
2790
|
+
return error.ConcurrencyUnavailable;
|
|
2791
|
+
}
|
|
2792
|
+
|
|
2793
|
+
pub fn unreachableGroupAwait(userdata: ?*anyopaque, group: *Group, token: *anyopaque) Cancelable!void {
|
|
2794
|
+
_ = userdata;
|
|
2795
|
+
_ = group;
|
|
2796
|
+
_ = token;
|
|
2797
|
+
unreachable;
|
|
2798
|
+
}
|
|
2799
|
+
|
|
2800
|
+
pub fn unreachableGroupCancel(userdata: ?*anyopaque, group: *Group, token: *anyopaque) void {
|
|
2801
|
+
_ = userdata;
|
|
2802
|
+
_ = group;
|
|
2803
|
+
_ = token;
|
|
2804
|
+
unreachable;
|
|
2805
|
+
}
|
|
2806
|
+
|
|
2807
|
+
pub fn unreachableRecancel(userdata: ?*anyopaque) void {
|
|
2808
|
+
_ = userdata;
|
|
2809
|
+
unreachable;
|
|
2810
|
+
}
|
|
2811
|
+
|
|
2812
|
+
pub fn unreachableSwapCancelProtection(userdata: ?*anyopaque, new: CancelProtection) CancelProtection {
|
|
2813
|
+
_ = userdata;
|
|
2814
|
+
_ = new;
|
|
2815
|
+
unreachable;
|
|
2816
|
+
}
|
|
2817
|
+
|
|
2818
|
+
pub fn unreachableCheckCancel(userdata: ?*anyopaque) Cancelable!void {
|
|
2819
|
+
_ = userdata;
|
|
2820
|
+
unreachable;
|
|
2821
|
+
}
|
|
2822
|
+
|
|
2823
|
+
pub fn noFutexWait(userdata: ?*anyopaque, ptr: *const u32, expected: u32, timeout: Timeout) Cancelable!void {
|
|
2824
|
+
_ = userdata;
|
|
2825
|
+
std.debug.assert(ptr.* == expected or timeout != .none);
|
|
2826
|
+
}
|
|
2827
|
+
|
|
2828
|
+
pub fn noFutexWaitUncancelable(userdata: ?*anyopaque, ptr: *const u32, expected: u32) void {
|
|
2829
|
+
_ = userdata;
|
|
2830
|
+
std.debug.assert(ptr.* == expected);
|
|
2831
|
+
}
|
|
2832
|
+
|
|
2833
|
+
pub fn noFutexWake(userdata: ?*anyopaque, ptr: *const u32, max_waiters: u32) void {
|
|
2834
|
+
_ = userdata;
|
|
2835
|
+
_ = ptr;
|
|
2836
|
+
_ = max_waiters;
|
|
2837
|
+
// no-op
|
|
2838
|
+
}
|
|
2839
|
+
|
|
2840
|
+
pub fn failingOperate(userdata: ?*anyopaque, operation: Operation) Cancelable!Operation.Result {
|
|
2841
|
+
_ = userdata;
|
|
2842
|
+
return switch (operation) {
|
|
2843
|
+
.file_read_streaming => .{ .file_read_streaming = error.InputOutput },
|
|
2844
|
+
.file_write_streaming => .{ .file_write_streaming = error.InputOutput },
|
|
2845
|
+
.device_io_control => unreachable,
|
|
2846
|
+
.net_receive => .{ .net_receive = .{ error.NetworkDown, 0 } },
|
|
2847
|
+
.net_read => .{ .net_read = error.NetworkDown },
|
|
2848
|
+
};
|
|
2849
|
+
}
|
|
2850
|
+
|
|
2851
|
+
pub fn unreachableBatchAwaitAsync(userdata: ?*anyopaque, b: *Batch) Cancelable!void {
|
|
2852
|
+
_ = userdata;
|
|
2853
|
+
_ = b;
|
|
2854
|
+
unreachable;
|
|
2855
|
+
}
|
|
2856
|
+
|
|
2857
|
+
pub fn unreachableBatchAwaitConcurrent(userdata: ?*anyopaque, b: *Batch, timeout: Timeout) Batch.AwaitConcurrentError!void {
|
|
2858
|
+
_ = userdata;
|
|
2859
|
+
_ = b;
|
|
2860
|
+
_ = timeout;
|
|
2861
|
+
unreachable;
|
|
2862
|
+
}
|
|
2863
|
+
|
|
2864
|
+
pub fn unreachableBatchCancel(userdata: ?*anyopaque, b: *Batch) void {
|
|
2865
|
+
_ = userdata;
|
|
2866
|
+
_ = b;
|
|
2867
|
+
unreachable;
|
|
2868
|
+
}
|
|
2869
|
+
|
|
2870
|
+
pub fn failingDirCreateDir(userdata: ?*anyopaque, dir: Dir, sub_path: []const u8, permissions: Dir.Permissions) Dir.CreateDirError!void {
|
|
2871
|
+
_ = userdata;
|
|
2872
|
+
_ = dir;
|
|
2873
|
+
_ = sub_path;
|
|
2874
|
+
_ = permissions;
|
|
2875
|
+
return error.NoSpaceLeft;
|
|
2876
|
+
}
|
|
2877
|
+
|
|
2878
|
+
pub fn failingDirCreateDirPath(userdata: ?*anyopaque, dir: Dir, sub_path: []const u8, permissions: Dir.Permissions) Dir.CreateDirPathError!Dir.CreatePathStatus {
|
|
2879
|
+
_ = userdata;
|
|
2880
|
+
_ = dir;
|
|
2881
|
+
_ = sub_path;
|
|
2882
|
+
_ = permissions;
|
|
2883
|
+
return error.NoSpaceLeft;
|
|
2884
|
+
}
|
|
2885
|
+
|
|
2886
|
+
pub fn failingDirCreateDirPathOpen(userdata: ?*anyopaque, dir: Dir, sub_path: []const u8, permissions: Dir.Permissions, options: Dir.OpenOptions) Dir.CreateDirPathOpenError!Dir {
|
|
2887
|
+
_ = userdata;
|
|
2888
|
+
_ = dir;
|
|
2889
|
+
_ = sub_path;
|
|
2890
|
+
_ = permissions;
|
|
2891
|
+
_ = options;
|
|
2892
|
+
return error.NoSpaceLeft;
|
|
2893
|
+
}
|
|
2894
|
+
|
|
2895
|
+
pub fn failingDirOpenDir(userdata: ?*anyopaque, dir: Dir, sub_path: []const u8, options: Dir.OpenOptions) Dir.OpenError!Dir {
|
|
2896
|
+
_ = userdata;
|
|
2897
|
+
_ = dir;
|
|
2898
|
+
_ = sub_path;
|
|
2899
|
+
_ = options;
|
|
2900
|
+
return error.FileNotFound;
|
|
2901
|
+
}
|
|
2902
|
+
|
|
2903
|
+
pub fn failingDirStat(userdata: ?*anyopaque, dir: Dir) Dir.StatError!Dir.Stat {
|
|
2904
|
+
_ = userdata;
|
|
2905
|
+
_ = dir;
|
|
2906
|
+
return error.Streaming;
|
|
2907
|
+
}
|
|
2908
|
+
|
|
2909
|
+
pub fn failingDirStatFile(userdata: ?*anyopaque, dir: Dir, sub_path: []const u8, options: Dir.StatFileOptions) Dir.StatFileError!File.Stat {
|
|
2910
|
+
_ = userdata;
|
|
2911
|
+
_ = dir;
|
|
2912
|
+
_ = sub_path;
|
|
2913
|
+
_ = options;
|
|
2914
|
+
return error.FileNotFound;
|
|
2915
|
+
}
|
|
2916
|
+
|
|
2917
|
+
pub fn failingDirAccess(userdata: ?*anyopaque, dir: Dir, sub_path: []const u8, options: Dir.AccessOptions) Dir.AccessError!void {
|
|
2918
|
+
_ = userdata;
|
|
2919
|
+
_ = dir;
|
|
2920
|
+
_ = sub_path;
|
|
2921
|
+
_ = options;
|
|
2922
|
+
return error.FileNotFound;
|
|
2923
|
+
}
|
|
2924
|
+
|
|
2925
|
+
pub fn failingDirCreateFile(userdata: ?*anyopaque, dir: Dir, sub_path: []const u8, options: File.CreateFlags) File.OpenError!File {
|
|
2926
|
+
_ = userdata;
|
|
2927
|
+
_ = dir;
|
|
2928
|
+
_ = sub_path;
|
|
2929
|
+
_ = options;
|
|
2930
|
+
return error.NoSpaceLeft;
|
|
2931
|
+
}
|
|
2932
|
+
|
|
2933
|
+
pub fn failingDirCreateFileAtomic(userdata: ?*anyopaque, dir: Dir, sub_path: []const u8, options: Dir.CreateFileAtomicOptions) Dir.CreateFileAtomicError!File.Atomic {
|
|
2934
|
+
_ = userdata;
|
|
2935
|
+
_ = dir;
|
|
2936
|
+
_ = sub_path;
|
|
2937
|
+
_ = options;
|
|
2938
|
+
return error.NoSpaceLeft;
|
|
2939
|
+
}
|
|
2940
|
+
|
|
2941
|
+
pub fn failingDirOpenFile(userdata: ?*anyopaque, dir: Dir, sub_path: []const u8, flags: File.OpenFlags) File.OpenError!File {
|
|
2942
|
+
_ = userdata;
|
|
2943
|
+
_ = dir;
|
|
2944
|
+
_ = sub_path;
|
|
2945
|
+
_ = flags;
|
|
2946
|
+
return error.FileNotFound;
|
|
2947
|
+
}
|
|
2948
|
+
|
|
2949
|
+
pub fn unreachableDirClose(userdata: ?*anyopaque, dirs: []const Dir) void {
|
|
2950
|
+
_ = userdata;
|
|
2951
|
+
_ = dirs;
|
|
2952
|
+
unreachable;
|
|
2953
|
+
}
|
|
2954
|
+
|
|
2955
|
+
pub fn noDirRead(userdata: ?*anyopaque, dir_reader: *Dir.Reader, buffer: []Dir.Entry) Dir.Reader.Error!usize {
|
|
2956
|
+
_ = userdata;
|
|
2957
|
+
_ = dir_reader;
|
|
2958
|
+
_ = buffer;
|
|
2959
|
+
return 0;
|
|
2960
|
+
}
|
|
2961
|
+
|
|
2962
|
+
pub fn failingDirRealPath(userdata: ?*anyopaque, dir: Dir, out_buffer: []u8) Dir.RealPathError!usize {
|
|
2963
|
+
_ = userdata;
|
|
2964
|
+
_ = dir;
|
|
2965
|
+
_ = out_buffer;
|
|
2966
|
+
return error.FileNotFound;
|
|
2967
|
+
}
|
|
2968
|
+
|
|
2969
|
+
pub fn failingDirRealPathFile(userdata: ?*anyopaque, dir: Dir, path_name: []const u8, out_buffer: []u8) Dir.RealPathFileError!usize {
|
|
2970
|
+
_ = userdata;
|
|
2971
|
+
_ = dir;
|
|
2972
|
+
_ = path_name;
|
|
2973
|
+
_ = out_buffer;
|
|
2974
|
+
return error.FileNotFound;
|
|
2975
|
+
}
|
|
2976
|
+
|
|
2977
|
+
pub fn failingDirDeleteFile(userdata: ?*anyopaque, dir: Dir, sub_path: []const u8) Dir.DeleteFileError!void {
|
|
2978
|
+
_ = userdata;
|
|
2979
|
+
_ = dir;
|
|
2980
|
+
_ = sub_path;
|
|
2981
|
+
return error.FileNotFound;
|
|
2982
|
+
}
|
|
2983
|
+
|
|
2984
|
+
pub fn failingDirDeleteDir(userdata: ?*anyopaque, dir: Dir, sub_path: []const u8) Dir.DeleteDirError!void {
|
|
2985
|
+
_ = userdata;
|
|
2986
|
+
_ = dir;
|
|
2987
|
+
_ = sub_path;
|
|
2988
|
+
return error.FileNotFound;
|
|
2989
|
+
}
|
|
2990
|
+
|
|
2991
|
+
pub fn failingDirRename(userdata: ?*anyopaque, old_dir: Dir, old_sub_path: []const u8, new_dir: Dir, new_sub_path: []const u8) Dir.RenameError!void {
|
|
2992
|
+
_ = userdata;
|
|
2993
|
+
_ = old_dir;
|
|
2994
|
+
_ = old_sub_path;
|
|
2995
|
+
_ = new_dir;
|
|
2996
|
+
_ = new_sub_path;
|
|
2997
|
+
return error.FileNotFound;
|
|
2998
|
+
}
|
|
2999
|
+
|
|
3000
|
+
pub fn failingDirRenamePreserve(userdata: ?*anyopaque, old_dir: Dir, old_sub_path: []const u8, new_dir: Dir, new_sub_path: []const u8) Dir.RenamePreserveError!void {
|
|
3001
|
+
_ = userdata;
|
|
3002
|
+
_ = old_dir;
|
|
3003
|
+
_ = old_sub_path;
|
|
3004
|
+
_ = new_dir;
|
|
3005
|
+
_ = new_sub_path;
|
|
3006
|
+
return error.FileNotFound;
|
|
3007
|
+
}
|
|
3008
|
+
|
|
3009
|
+
pub fn failingDirSymLink(userdata: ?*anyopaque, dir: Dir, target_path: []const u8, sym_link_path: []const u8, flags: Dir.SymLinkFlags) Dir.SymLinkError!void {
|
|
3010
|
+
_ = userdata;
|
|
3011
|
+
_ = dir;
|
|
3012
|
+
_ = target_path;
|
|
3013
|
+
_ = sym_link_path;
|
|
3014
|
+
_ = flags;
|
|
3015
|
+
return error.FileNotFound;
|
|
3016
|
+
}
|
|
3017
|
+
|
|
3018
|
+
pub fn failingDirReadLink(userdata: ?*anyopaque, dir: Dir, sub_path: []const u8, buffer: []u8) Dir.ReadLinkError!usize {
|
|
3019
|
+
_ = userdata;
|
|
3020
|
+
_ = dir;
|
|
3021
|
+
_ = sub_path;
|
|
3022
|
+
_ = buffer;
|
|
3023
|
+
return error.FileNotFound;
|
|
3024
|
+
}
|
|
3025
|
+
|
|
3026
|
+
pub fn failingDirSetOwner(userdata: ?*anyopaque, dir: Dir, owner: ?File.Uid, group: ?File.Gid) Dir.SetOwnerError!void {
|
|
3027
|
+
_ = userdata;
|
|
3028
|
+
_ = dir;
|
|
3029
|
+
_ = owner;
|
|
3030
|
+
_ = group;
|
|
3031
|
+
return error.FileNotFound;
|
|
3032
|
+
}
|
|
3033
|
+
|
|
3034
|
+
pub fn failingDirSetFileOwner(userdata: ?*anyopaque, dir: std.Io.Dir, sub_path: []const u8, owner: ?File.Uid, group: ?File.Gid, options: Dir.SetFileOwnerOptions) Dir.SetFileOwnerError!void {
|
|
3035
|
+
_ = userdata;
|
|
3036
|
+
_ = dir;
|
|
3037
|
+
_ = sub_path;
|
|
3038
|
+
_ = owner;
|
|
3039
|
+
_ = group;
|
|
3040
|
+
_ = options;
|
|
3041
|
+
return error.FileNotFound;
|
|
3042
|
+
}
|
|
3043
|
+
|
|
3044
|
+
pub fn failingDirSetPermissions(userdata: ?*anyopaque, dir: Dir, permissions: Dir.Permissions) Dir.SetPermissionsError!void {
|
|
3045
|
+
_ = userdata;
|
|
3046
|
+
_ = dir;
|
|
3047
|
+
_ = permissions;
|
|
3048
|
+
return error.FileNotFound;
|
|
3049
|
+
}
|
|
3050
|
+
|
|
3051
|
+
pub fn failingDirSetFilePermissions(userdata: ?*anyopaque, dir: Dir, sub_path: []const u8, permissions: File.Permissions, options: Dir.SetFilePermissionsOptions) Dir.SetFilePermissionsError!void {
|
|
3052
|
+
_ = userdata;
|
|
3053
|
+
_ = dir;
|
|
3054
|
+
_ = sub_path;
|
|
3055
|
+
_ = permissions;
|
|
3056
|
+
_ = options;
|
|
3057
|
+
return error.FileNotFound;
|
|
3058
|
+
}
|
|
3059
|
+
|
|
3060
|
+
pub fn noDirSetTimestamps(userdata: ?*anyopaque, dir: Dir, sub_path: []const u8, options: Dir.SetTimestampsOptions) Dir.SetTimestampsError!void {
|
|
3061
|
+
_ = userdata;
|
|
3062
|
+
_ = dir;
|
|
3063
|
+
_ = sub_path;
|
|
3064
|
+
_ = options;
|
|
3065
|
+
// no-op
|
|
3066
|
+
}
|
|
3067
|
+
|
|
3068
|
+
pub fn failingDirHardLink(userdata: ?*anyopaque, old_dir: Dir, old_sub_path: []const u8, new_dir: Dir, new_sub_path: []const u8, options: Dir.HardLinkOptions) Dir.HardLinkError!void {
|
|
3069
|
+
_ = userdata;
|
|
3070
|
+
_ = old_dir;
|
|
3071
|
+
_ = old_sub_path;
|
|
3072
|
+
_ = new_dir;
|
|
3073
|
+
_ = new_sub_path;
|
|
3074
|
+
_ = options;
|
|
3075
|
+
return error.FileNotFound;
|
|
3076
|
+
}
|
|
3077
|
+
|
|
3078
|
+
pub fn failingFileStat(userdata: ?*anyopaque, file: File) File.StatError!File.Stat {
|
|
3079
|
+
_ = userdata;
|
|
3080
|
+
_ = file;
|
|
3081
|
+
return error.Streaming;
|
|
3082
|
+
}
|
|
3083
|
+
|
|
3084
|
+
pub fn failingFileLength(userdata: ?*anyopaque, file: File) File.LengthError!u64 {
|
|
3085
|
+
_ = userdata;
|
|
3086
|
+
_ = file;
|
|
3087
|
+
return error.Streaming;
|
|
3088
|
+
}
|
|
3089
|
+
|
|
3090
|
+
pub fn unreachableFileClose(userdata: ?*anyopaque, files: []const File) void {
|
|
3091
|
+
_ = userdata;
|
|
3092
|
+
_ = files;
|
|
3093
|
+
unreachable;
|
|
3094
|
+
}
|
|
3095
|
+
|
|
3096
|
+
pub fn failingFileWritePositional(userdata: ?*anyopaque, file: File, header: []const u8, data: []const []const u8, splat: usize, offset: u64) File.WritePositionalError!usize {
|
|
3097
|
+
_ = userdata;
|
|
3098
|
+
_ = file;
|
|
3099
|
+
_ = header;
|
|
3100
|
+
_ = offset;
|
|
3101
|
+
for (data[0 .. data.len - 1]) |item| {
|
|
3102
|
+
if (item.len > 0) return error.BrokenPipe;
|
|
3103
|
+
}
|
|
3104
|
+
if (data[data.len - 1].len != 0 and splat != 0) return error.BrokenPipe;
|
|
3105
|
+
return 0;
|
|
3106
|
+
}
|
|
3107
|
+
|
|
3108
|
+
pub fn noFileWriteFileStreaming(userdata: ?*anyopaque, file: File, header: []const u8, file_reader: *Io.File.Reader, limit: Io.Limit) File.Writer.WriteFileError!usize {
|
|
3109
|
+
_ = userdata;
|
|
3110
|
+
_ = file;
|
|
3111
|
+
_ = header;
|
|
3112
|
+
_ = file_reader;
|
|
3113
|
+
_ = limit;
|
|
3114
|
+
return error.Unimplemented;
|
|
3115
|
+
}
|
|
3116
|
+
|
|
3117
|
+
pub fn noFileWriteFilePositional(userdata: ?*anyopaque, file: File, header: []const u8, file_reader: *Io.File.Reader, limit: Io.Limit, offset: u64) File.WriteFilePositionalError!usize {
|
|
3118
|
+
_ = userdata;
|
|
3119
|
+
_ = file;
|
|
3120
|
+
_ = header;
|
|
3121
|
+
_ = file_reader;
|
|
3122
|
+
_ = limit;
|
|
3123
|
+
_ = offset;
|
|
3124
|
+
return error.Unimplemented;
|
|
3125
|
+
}
|
|
3126
|
+
|
|
3127
|
+
pub fn failingFileReadPositional(userdata: ?*anyopaque, file: File, data: []const []u8, offset: u64) File.ReadPositionalError!usize {
|
|
3128
|
+
_ = userdata;
|
|
3129
|
+
_ = file;
|
|
3130
|
+
_ = offset;
|
|
3131
|
+
for (data) |item| {
|
|
3132
|
+
if (item.len > 0) return error.InputOutput;
|
|
3133
|
+
}
|
|
3134
|
+
return 0;
|
|
3135
|
+
}
|
|
3136
|
+
|
|
3137
|
+
pub fn failingFileSeekBy(userdata: ?*anyopaque, file: File, relative_offset: i64) File.SeekError!void {
|
|
3138
|
+
_ = userdata;
|
|
3139
|
+
_ = file;
|
|
3140
|
+
_ = relative_offset;
|
|
3141
|
+
return error.Unseekable;
|
|
3142
|
+
}
|
|
3143
|
+
|
|
3144
|
+
pub fn failingFileSeekTo(userdata: ?*anyopaque, file: File, absolute_offset: u64) File.SeekError!void {
|
|
3145
|
+
_ = userdata;
|
|
3146
|
+
_ = file;
|
|
3147
|
+
_ = absolute_offset;
|
|
3148
|
+
return error.Unseekable;
|
|
3149
|
+
}
|
|
3150
|
+
|
|
3151
|
+
pub fn failingFileSync(userdata: ?*anyopaque, file: File) File.SyncError!void {
|
|
3152
|
+
_ = userdata;
|
|
3153
|
+
_ = file;
|
|
3154
|
+
return error.NoSpaceLeft;
|
|
3155
|
+
}
|
|
3156
|
+
|
|
3157
|
+
pub fn unreachableFileIsTty(userdata: ?*anyopaque, file: File) Cancelable!bool {
|
|
3158
|
+
_ = userdata;
|
|
3159
|
+
_ = file;
|
|
3160
|
+
unreachable;
|
|
3161
|
+
}
|
|
3162
|
+
|
|
3163
|
+
pub fn unreachableFileEnableAnsiEscapeCodes(userdata: ?*anyopaque, file: File) File.EnableAnsiEscapeCodesError!void {
|
|
3164
|
+
_ = userdata;
|
|
3165
|
+
_ = file;
|
|
3166
|
+
unreachable;
|
|
3167
|
+
}
|
|
3168
|
+
|
|
3169
|
+
pub fn unreachableFileSupportsAnsiEscapeCodes(userdata: ?*anyopaque, file: File) Cancelable!bool {
|
|
3170
|
+
_ = userdata;
|
|
3171
|
+
_ = file;
|
|
3172
|
+
unreachable;
|
|
3173
|
+
}
|
|
3174
|
+
|
|
3175
|
+
pub fn failingFileSetLength(userdata: ?*anyopaque, file: File, length: u64) File.SetLengthError!void {
|
|
3176
|
+
_ = userdata;
|
|
3177
|
+
_ = file;
|
|
3178
|
+
_ = length;
|
|
3179
|
+
return error.NonResizable;
|
|
3180
|
+
}
|
|
3181
|
+
|
|
3182
|
+
pub fn failingFileSetOwner(userdata: ?*anyopaque, file: File, owner: ?File.Uid, group: ?File.Gid) File.SetOwnerError!void {
|
|
3183
|
+
_ = userdata;
|
|
3184
|
+
_ = file;
|
|
3185
|
+
_ = owner;
|
|
3186
|
+
_ = group;
|
|
3187
|
+
return error.FileNotFound;
|
|
3188
|
+
}
|
|
3189
|
+
|
|
3190
|
+
pub fn failingFileSetPermissions(userdata: ?*anyopaque, file: File, permissions: File.Permissions) File.SetPermissionsError!void {
|
|
3191
|
+
_ = userdata;
|
|
3192
|
+
_ = file;
|
|
3193
|
+
_ = permissions;
|
|
3194
|
+
return error.FileNotFound;
|
|
3195
|
+
}
|
|
3196
|
+
|
|
3197
|
+
pub fn noFileSetTimestamps(userdata: ?*anyopaque, file: File, options: File.SetTimestampsOptions) File.SetTimestampsError!void {
|
|
3198
|
+
_ = userdata;
|
|
3199
|
+
_ = file;
|
|
3200
|
+
_ = options;
|
|
3201
|
+
// no-op
|
|
3202
|
+
}
|
|
3203
|
+
|
|
3204
|
+
pub fn failingFileLock(userdata: ?*anyopaque, file: File, lock: File.Lock) File.LockError!void {
|
|
3205
|
+
_ = userdata;
|
|
3206
|
+
_ = file;
|
|
3207
|
+
_ = lock;
|
|
3208
|
+
return error.FileLocksUnsupported;
|
|
3209
|
+
}
|
|
3210
|
+
|
|
3211
|
+
pub fn failingFileTryLock(userdata: ?*anyopaque, file: File, lock: File.Lock) File.LockError!bool {
|
|
3212
|
+
_ = userdata;
|
|
3213
|
+
_ = file;
|
|
3214
|
+
_ = lock;
|
|
3215
|
+
return error.FileLocksUnsupported;
|
|
3216
|
+
}
|
|
3217
|
+
|
|
3218
|
+
pub fn unreachableFileUnlock(userdata: ?*anyopaque, file: File) void {
|
|
3219
|
+
_ = userdata;
|
|
3220
|
+
_ = file;
|
|
3221
|
+
unreachable;
|
|
3222
|
+
}
|
|
3223
|
+
|
|
3224
|
+
pub fn failingFileDowngradeLock(userdata: ?*anyopaque, file: File) File.DowngradeLockError!void {
|
|
3225
|
+
_ = userdata;
|
|
3226
|
+
_ = file;
|
|
3227
|
+
// no-op
|
|
3228
|
+
}
|
|
3229
|
+
|
|
3230
|
+
pub fn failingFileRealPath(userdata: ?*anyopaque, file: File, out_buffer: []u8) File.RealPathError!usize {
|
|
3231
|
+
_ = userdata;
|
|
3232
|
+
_ = file;
|
|
3233
|
+
_ = out_buffer;
|
|
3234
|
+
return error.FileNotFound;
|
|
3235
|
+
}
|
|
3236
|
+
|
|
3237
|
+
pub fn failingFileHardLink(userdata: ?*anyopaque, file: File, new_dir: Dir, new_sub_path: []const u8, options: File.HardLinkOptions) File.HardLinkError!void {
|
|
3238
|
+
_ = userdata;
|
|
3239
|
+
_ = file;
|
|
3240
|
+
_ = new_dir;
|
|
3241
|
+
_ = new_sub_path;
|
|
3242
|
+
_ = options;
|
|
3243
|
+
return error.FileNotFound;
|
|
3244
|
+
}
|
|
3245
|
+
|
|
3246
|
+
pub fn failingFileMemoryMapCreate(userdata: ?*anyopaque, file: File, options: File.MemoryMap.CreateOptions) File.MemoryMap.CreateError!File.MemoryMap {
|
|
3247
|
+
_ = userdata;
|
|
3248
|
+
_ = file;
|
|
3249
|
+
_ = options;
|
|
3250
|
+
return error.AccessDenied;
|
|
3251
|
+
}
|
|
3252
|
+
|
|
3253
|
+
pub fn unreachableFileMemoryMapDestroy(userdata: ?*anyopaque, mm: *File.MemoryMap) void {
|
|
3254
|
+
_ = userdata;
|
|
3255
|
+
_ = mm;
|
|
3256
|
+
unreachable;
|
|
3257
|
+
}
|
|
3258
|
+
|
|
3259
|
+
pub fn unreachableFileMemoryMapSetLength(userdata: ?*anyopaque, mm: *File.MemoryMap, new_len: usize) File.MemoryMap.SetLengthError!void {
|
|
3260
|
+
_ = userdata;
|
|
3261
|
+
_ = mm;
|
|
3262
|
+
_ = new_len;
|
|
3263
|
+
unreachable;
|
|
3264
|
+
}
|
|
3265
|
+
|
|
3266
|
+
pub fn unreachableFileMemoryMapRead(userdata: ?*anyopaque, mm: *File.MemoryMap) File.ReadPositionalError!void {
|
|
3267
|
+
_ = userdata;
|
|
3268
|
+
_ = mm;
|
|
3269
|
+
unreachable;
|
|
3270
|
+
}
|
|
3271
|
+
|
|
3272
|
+
pub fn unreachableFileMemoryMapWrite(userdata: ?*anyopaque, mm: *File.MemoryMap) File.WritePositionalError!void {
|
|
3273
|
+
_ = userdata;
|
|
3274
|
+
_ = mm;
|
|
3275
|
+
unreachable;
|
|
3276
|
+
}
|
|
3277
|
+
|
|
3278
|
+
pub fn failingProcessExecutableOpen(userdata: ?*anyopaque, flags: File.OpenFlags) std.process.OpenExecutableError!File {
|
|
3279
|
+
_ = userdata;
|
|
3280
|
+
_ = flags;
|
|
3281
|
+
return error.FileNotFound;
|
|
3282
|
+
}
|
|
3283
|
+
|
|
3284
|
+
pub fn failingProcessExecutablePath(userdata: ?*anyopaque, buffer: []u8) std.process.ExecutablePathError!usize {
|
|
3285
|
+
_ = userdata;
|
|
3286
|
+
_ = buffer;
|
|
3287
|
+
return error.FileNotFound;
|
|
3288
|
+
}
|
|
3289
|
+
|
|
3290
|
+
pub fn unreachableLockStderr(userdata: ?*anyopaque, terminal_mode: ?Terminal.Mode) Cancelable!LockedStderr {
|
|
3291
|
+
_ = userdata;
|
|
3292
|
+
_ = terminal_mode;
|
|
3293
|
+
unreachable;
|
|
3294
|
+
}
|
|
3295
|
+
|
|
3296
|
+
pub fn noTryLockStderr(userdata: ?*anyopaque, terminal_mode: ?Terminal.Mode) Cancelable!?LockedStderr {
|
|
3297
|
+
_ = userdata;
|
|
3298
|
+
_ = terminal_mode;
|
|
3299
|
+
return null;
|
|
3300
|
+
}
|
|
3301
|
+
|
|
3302
|
+
pub fn unreachableUnlockStderr(userdata: ?*anyopaque) void {
|
|
3303
|
+
_ = userdata;
|
|
3304
|
+
unreachable;
|
|
3305
|
+
}
|
|
3306
|
+
|
|
3307
|
+
pub fn failingProcessCurrentPath(userdata: ?*anyopaque, buffer: []u8) std.process.CurrentPathError!usize {
|
|
3308
|
+
_ = userdata;
|
|
3309
|
+
_ = buffer;
|
|
3310
|
+
return error.CurrentDirUnlinked;
|
|
3311
|
+
}
|
|
3312
|
+
|
|
3313
|
+
pub fn failingProcessSetCurrentDir(userdata: ?*anyopaque, dir: Dir) std.process.SetCurrentDirError!void {
|
|
3314
|
+
_ = userdata;
|
|
3315
|
+
_ = dir;
|
|
3316
|
+
return error.FileNotFound;
|
|
3317
|
+
}
|
|
3318
|
+
|
|
3319
|
+
pub fn failingProcessSetCurrentPath(userdata: ?*anyopaque, path: []const u8) std.process.SetCurrentPathError!void {
|
|
3320
|
+
_ = userdata;
|
|
3321
|
+
_ = path;
|
|
3322
|
+
return error.FileNotFound;
|
|
3323
|
+
}
|
|
3324
|
+
|
|
3325
|
+
pub fn failingProcessReplace(userdata: ?*anyopaque, options: std.process.ReplaceOptions) std.process.ReplaceError {
|
|
3326
|
+
_ = userdata;
|
|
3327
|
+
_ = options;
|
|
3328
|
+
return error.OperationUnsupported;
|
|
3329
|
+
}
|
|
3330
|
+
|
|
3331
|
+
pub fn failingProcessReplacePath(userdata: ?*anyopaque, dir: Dir, options: std.process.ReplaceOptions) std.process.ReplaceError {
|
|
3332
|
+
_ = userdata;
|
|
3333
|
+
_ = dir;
|
|
3334
|
+
_ = options;
|
|
3335
|
+
return error.OperationUnsupported;
|
|
3336
|
+
}
|
|
3337
|
+
|
|
3338
|
+
pub fn failingProcessSpawn(userdata: ?*anyopaque, options: std.process.SpawnOptions) std.process.SpawnError!std.process.Child {
|
|
3339
|
+
_ = userdata;
|
|
3340
|
+
_ = options;
|
|
3341
|
+
return error.OperationUnsupported;
|
|
3342
|
+
}
|
|
3343
|
+
|
|
3344
|
+
pub fn failingProcessSpawnPath(userdata: ?*anyopaque, dir: Dir, options: std.process.SpawnOptions) std.process.SpawnError!std.process.Child {
|
|
3345
|
+
_ = userdata;
|
|
3346
|
+
_ = dir;
|
|
3347
|
+
_ = options;
|
|
3348
|
+
return error.OperationUnsupported;
|
|
3349
|
+
}
|
|
3350
|
+
|
|
3351
|
+
pub fn unreachableChildWait(userdata: ?*anyopaque, child: *std.process.Child) std.process.Child.WaitError!std.process.Child.Term {
|
|
3352
|
+
_ = userdata;
|
|
3353
|
+
_ = child;
|
|
3354
|
+
unreachable;
|
|
3355
|
+
}
|
|
3356
|
+
|
|
3357
|
+
pub fn unreachableChildKill(userdata: ?*anyopaque, child: *std.process.Child) void {
|
|
3358
|
+
_ = userdata;
|
|
3359
|
+
_ = child;
|
|
3360
|
+
unreachable;
|
|
3361
|
+
}
|
|
3362
|
+
|
|
3363
|
+
pub fn failingProgressParentFile(userdata: ?*anyopaque) std.Progress.ParentFileError!File {
|
|
3364
|
+
_ = userdata;
|
|
3365
|
+
return error.UnsupportedOperation;
|
|
3366
|
+
}
|
|
3367
|
+
|
|
3368
|
+
pub fn noRandom(userdata: ?*anyopaque, buffer: []u8) void {
|
|
3369
|
+
_ = userdata;
|
|
3370
|
+
@memset(buffer, 0);
|
|
3371
|
+
}
|
|
3372
|
+
|
|
3373
|
+
pub fn failingRandomSecure(userdata: ?*anyopaque, buffer: []u8) RandomSecureError!void {
|
|
3374
|
+
_ = userdata;
|
|
3375
|
+
_ = buffer;
|
|
3376
|
+
return error.EntropyUnavailable;
|
|
3377
|
+
}
|
|
3378
|
+
|
|
3379
|
+
pub fn noNow(userdata: ?*anyopaque, clock: Clock) Timestamp {
|
|
3380
|
+
_ = userdata;
|
|
3381
|
+
_ = clock;
|
|
3382
|
+
return .zero;
|
|
3383
|
+
}
|
|
3384
|
+
|
|
3385
|
+
pub fn failingClockResolution(userdata: ?*anyopaque, clock: Clock) Clock.ResolutionError!Duration {
|
|
3386
|
+
_ = userdata;
|
|
3387
|
+
_ = clock;
|
|
3388
|
+
return error.ClockUnavailable;
|
|
3389
|
+
}
|
|
3390
|
+
|
|
3391
|
+
pub fn noSleep(userdata: ?*anyopaque, clock: Timeout) Cancelable!void {
|
|
3392
|
+
_ = userdata;
|
|
3393
|
+
_ = clock;
|
|
3394
|
+
}
|
|
3395
|
+
|
|
3396
|
+
pub fn failingNetListenIp(userdata: ?*anyopaque, address: *const net.IpAddress, options: net.IpAddress.ListenOptions) net.IpAddress.ListenError!net.Socket {
|
|
3397
|
+
_ = userdata;
|
|
3398
|
+
_ = address;
|
|
3399
|
+
_ = options;
|
|
3400
|
+
return error.NetworkDown;
|
|
3401
|
+
}
|
|
3402
|
+
|
|
3403
|
+
pub fn failingNetAccept(userdata: ?*anyopaque, listen_fd: net.Socket.Handle, options: net.Server.AcceptOptions) net.Server.AcceptError!net.Socket {
|
|
3404
|
+
_ = userdata;
|
|
3405
|
+
_ = listen_fd;
|
|
3406
|
+
_ = options;
|
|
3407
|
+
return error.NetworkDown;
|
|
3408
|
+
}
|
|
3409
|
+
|
|
3410
|
+
pub fn failingNetBindIp(userdata: ?*anyopaque, address: *const net.IpAddress, options: net.IpAddress.BindOptions) net.IpAddress.BindError!net.Socket {
|
|
3411
|
+
_ = userdata;
|
|
3412
|
+
_ = address;
|
|
3413
|
+
_ = options;
|
|
3414
|
+
return error.NetworkDown;
|
|
3415
|
+
}
|
|
3416
|
+
|
|
3417
|
+
pub fn failingNetConnectIp(userdata: ?*anyopaque, address: *const net.IpAddress, options: net.IpAddress.ConnectOptions) net.IpAddress.ConnectError!net.Socket {
|
|
3418
|
+
_ = userdata;
|
|
3419
|
+
_ = address;
|
|
3420
|
+
_ = options;
|
|
3421
|
+
return error.NetworkDown;
|
|
3422
|
+
}
|
|
3423
|
+
|
|
3424
|
+
pub fn failingNetListenUnix(userdata: ?*anyopaque, address: *const net.UnixAddress, options: net.UnixAddress.ListenOptions) net.UnixAddress.ListenError!net.Socket.Handle {
|
|
3425
|
+
_ = userdata;
|
|
3426
|
+
_ = address;
|
|
3427
|
+
_ = options;
|
|
3428
|
+
return error.NetworkDown;
|
|
3429
|
+
}
|
|
3430
|
+
|
|
3431
|
+
pub fn failingNetConnectUnix(userdata: ?*anyopaque, address: *const net.UnixAddress) net.UnixAddress.ConnectError!net.Socket.Handle {
|
|
3432
|
+
_ = userdata;
|
|
3433
|
+
_ = address;
|
|
3434
|
+
return error.NetworkDown;
|
|
3435
|
+
}
|
|
3436
|
+
|
|
3437
|
+
pub fn failingNetSocketCreatePair(userdata: ?*anyopaque, options: net.Socket.CreatePairOptions) net.Socket.CreatePairError![2]net.Socket {
|
|
3438
|
+
_ = userdata;
|
|
3439
|
+
_ = options;
|
|
3440
|
+
return error.OperationUnsupported;
|
|
3441
|
+
}
|
|
3442
|
+
|
|
3443
|
+
pub fn failingNetSend(userdata: ?*anyopaque, handle: net.Socket.Handle, messages: []net.OutgoingMessage, flags: net.SendFlags) struct { ?net.Socket.SendError, usize } {
|
|
3444
|
+
_ = userdata;
|
|
3445
|
+
_ = handle;
|
|
3446
|
+
_ = messages;
|
|
3447
|
+
_ = flags;
|
|
3448
|
+
return .{ error.NetworkDown, 0 };
|
|
3449
|
+
}
|
|
3450
|
+
|
|
3451
|
+
pub fn failingNetWrite(userdata: ?*anyopaque, dest: net.Socket.Handle, header: []const u8, data: []const []const u8, splat: usize) net.Stream.Writer.Error!usize {
|
|
3452
|
+
_ = userdata;
|
|
3453
|
+
_ = dest;
|
|
3454
|
+
_ = header;
|
|
3455
|
+
_ = data;
|
|
3456
|
+
_ = splat;
|
|
3457
|
+
return error.NetworkDown;
|
|
3458
|
+
}
|
|
3459
|
+
|
|
3460
|
+
pub fn failingNetWriteFile(userdata: ?*anyopaque, handle: net.Socket.Handle, header: []const u8, file_reader: *Io.File.Reader, limit: Io.Limit) net.Stream.Writer.WriteFileError!usize {
|
|
3461
|
+
_ = userdata;
|
|
3462
|
+
_ = handle;
|
|
3463
|
+
_ = header;
|
|
3464
|
+
_ = file_reader;
|
|
3465
|
+
_ = limit;
|
|
3466
|
+
return error.NetworkDown;
|
|
3467
|
+
}
|
|
3468
|
+
|
|
3469
|
+
pub fn unreachableNetClose(userdata: ?*anyopaque, handle: []const net.Socket.Handle) void {
|
|
3470
|
+
_ = userdata;
|
|
3471
|
+
_ = handle;
|
|
3472
|
+
unreachable;
|
|
3473
|
+
}
|
|
3474
|
+
|
|
3475
|
+
pub fn failingNetShutdown(userdata: ?*anyopaque, handle: net.Socket.Handle, how: net.ShutdownHow) net.ShutdownError!void {
|
|
3476
|
+
_ = userdata;
|
|
3477
|
+
_ = handle;
|
|
3478
|
+
_ = how;
|
|
3479
|
+
return error.NetworkDown;
|
|
3480
|
+
}
|
|
3481
|
+
|
|
3482
|
+
pub fn failingNetInterfaceNameResolve(userdata: ?*anyopaque, name: *const net.Interface.Name) net.Interface.Name.ResolveError!net.Interface {
|
|
3483
|
+
_ = userdata;
|
|
3484
|
+
_ = name;
|
|
3485
|
+
return error.InterfaceNotFound;
|
|
3486
|
+
}
|
|
3487
|
+
|
|
3488
|
+
pub fn unreachableNetInterfaceName(userdata: ?*anyopaque, interface: net.Interface) net.Interface.NameError!net.Interface.Name {
|
|
3489
|
+
_ = userdata;
|
|
3490
|
+
_ = interface;
|
|
3491
|
+
unreachable;
|
|
3492
|
+
}
|
|
3493
|
+
|
|
3494
|
+
pub fn failingNetLookup(userdata: ?*anyopaque, host_name: net.HostName, resolved: *Queue(net.HostName.LookupResult), options: net.HostName.LookupOptions) net.HostName.LookupError!void {
|
|
3495
|
+
_ = userdata;
|
|
3496
|
+
_ = host_name;
|
|
3497
|
+
_ = resolved;
|
|
3498
|
+
_ = options;
|
|
3499
|
+
return error.NetworkDown;
|
|
3500
|
+
}
|
|
3501
|
+
|
|
3502
|
+
test failing {
|
|
3503
|
+
const f: Io = .failing;
|
|
3504
|
+
// file stuff
|
|
3505
|
+
try std.testing.expectError(error.NoSpaceLeft, Dir.createDir(.cwd(), f, "test", .default_dir));
|
|
3506
|
+
try std.testing.expectError(error.NoSpaceLeft, Dir.createFile(.cwd(), f, "test", .{}));
|
|
3507
|
+
try std.testing.expectError(error.FileNotFound, Dir.openDir(.cwd(), f, "test", .{}));
|
|
3508
|
+
try std.testing.expectError(error.FileNotFound, Dir.openFile(.cwd(), f, "test", .{}));
|
|
3509
|
+
try File.writeStreamingAll(.stdout(), f, &.{});
|
|
3510
|
+
try std.testing.expectError(error.AccessDenied, File.MemoryMap.create(f, .stdout(), .{ .len = 0 }));
|
|
3511
|
+
// async stuff
|
|
3512
|
+
const closure = struct {
|
|
3513
|
+
var foo: usize = 0;
|
|
3514
|
+
fn doOp() void {
|
|
3515
|
+
foo = 4;
|
|
3516
|
+
}
|
|
3517
|
+
};
|
|
3518
|
+
var future = f.async(closure.doOp, .{});
|
|
3519
|
+
_ = future.await(f);
|
|
3520
|
+
try std.testing.expect(closure.foo == 4);
|
|
3521
|
+
// random stuff
|
|
3522
|
+
var buffer: [1]u8 = undefined;
|
|
3523
|
+
f.random(&buffer);
|
|
3524
|
+
try std.testing.expect(buffer[0] == 0);
|
|
3525
|
+
}
|