zig/lib/std/os
Andrew Kelley 3169f0529b eliminate posix_spawn from the standard library
Today I found out that posix_spawn is trash. It's actually implemented
on top of fork/exec inside of libc (or libSystem in the case of macOS).

So, anything posix_spawn can do, we can do better. In particular, what
we can do better is handle spawning of child processes that are
potentially foreign binaries. If you try to spawn a wasm binary, for
example, posix spawn does the following:

 * Goes ahead and creates a child process.
 * The child process writes "foo.wasm: foo.wasm: cannot execute binary file"
   to stderr (yes, it prints the filename twice).
 * The child process then exits with code 126.

This behavior is indistinguishable from the binary being successfully
spawned, and then printing to stderr, and exiting with a failure -
something that is an extremely common occurrence.

Meanwhile, using the lower level fork/exec will simply return ENOEXEC
code from the execve syscall (which is mapped to zig error.InvalidExe).

The posix_spawn behavior means the zig build runner can't tell the
difference between a failure to run a foreign binary, and a binary that
did run, but failed in some other fashion. This is unacceptable, because
attempting to excecve is the proper way to support things like Rosetta.
2023-03-10 15:41:07 -05:00
..
darwin Add std.os.darwin.cssm 2023-01-17 09:51:39 -08:00
linux Update Linux syscall list for 6.1, support Mips64 2023-02-05 03:25:21 -05:00
plan9 plan9: more syscalls 2021-11-09 07:08:27 -05:00
uefi update std lib and compiler sources to new for loop syntax 2023-02-18 19:17:21 -07:00
windows std.os.windows.advapi32: Add RegCloseKey 2023-03-07 18:14:37 -05:00
darwin.zig Add std.os.darwin.cssm 2023-01-17 09:51:39 -08:00
linux.zig std: add fchmodat 2023-03-03 02:37:45 -05:00
plan9.zig remove 'builtin.stage2_arch', Sema is smart enough now 2022-08-07 16:07:08 -07:00
ptrace.zig darwin: add even more wrappers for Mach syscalls 2022-12-14 00:10:26 +01:00
test.zig std: add fchmodat 2023-03-03 02:37:45 -05:00
uefi.zig Make invalidFmtError public and use in place of compileErrors for bad format strings (#13526) 2022-11-12 21:03:24 +02:00
wasi.zig std: fix WASI regressions 2022-12-06 12:15:05 -07:00
windows.zig Fixes #13893 - some standard library networking tests are failing on Windows 2023-03-01 02:54:43 -05:00