Share file offset across execve() on Windows

This is a breaking change. It defines the new environment variable named
_COSMO_FDS_V2 which is used for inheriting non-stdio file descriptors on
execve() or posix_spawn(). No effort has been spent thus far integrating
with the older variable. If a new binary launches the older ones or vice
versa they'll only be able to pass stdin / stdout / stderr to each other
therefore it's important that you upgrade all your cosmo binaries if you
depend on this functionality. You'll be glad you did because inheritance
of file descriptors is more aligned with the POSIX standard than before.
This commit is contained in:
Justine Tunney 2024-08-03 17:48:00 -07:00
parent 761c6ad615
commit 3f26dfbb31
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
29 changed files with 572 additions and 249 deletions

View file

@ -28,9 +28,8 @@
*/
textstartup int __strace_init(int argc, char **argv, char **envp, long *auxv) {
/* asan isn't initialized yet at runlevel 300 */
if ((__intercept_flag(&argc, argv, "--strace") ||
__atoul(nulltoempty(__getenv(envp, "STRACE").s))) &&
!issetugid()) {
if (__intercept_flag(&argc, argv, "--strace") ||
__atoul(nulltoempty(__getenv(envp, "STRACE").s))) {
strace_enabled(+1);
}
return (__argc = argc);