On Fri, 27 Jun 2025, Corinna Vinschen wrote: > On Jun 27 13:14, Corinna Vinschen wrote: > > On Jun 26 16:55, Jeremy Drake via Cygwin-patches wrote: > > > stdin and stdout were alreadly allowed for popen, but implementing > > > posix_spawn in terms of spawn would require stderr as well. > > > > > > Signed-off-by: Jeremy Drake <cyg...@jdrake.com> > > > --- > > > winsup/cygwin/dcrt0.cc | 2 ++ > > > winsup/cygwin/local_includes/child_info.h | 6 +++--- > > > winsup/cygwin/spawn.cc | 5 +++-- > > > 3 files changed, 8 insertions(+), 5 deletions(-) > > > > LGTM. A sentence on why we can actually use the filler bytes now > > wouldn't hurt in the commit message. > > ....or rather... > > > int worker (const char *, const char *const *, const char *const [], > > - int, int = -1, int = -1); > > + int, int = -1, int = -1, int = -1); > > ....maybe this should actually get an array of three descriptors, > rather than getting one additional argument per descriptor, i.e. > > int worker (const char *, const char *const *, const char *const [], > - int, int = -1, int = -1); > + int, int[3]); > > There's no good reason for these default args anyway.
It's getting kind of silly how many args this function has. The construction of this function (using placement new to reconstruct "this" inside worker) is kind of awkward for using members and setters (though this was done for the posix_spawn semaphore). Might it make sense to pass a (pointer to a) struct/class instead?