> OK, now, the current problem with syscall/exec_plan9.go is that it is > a little too eager to close FDs. It's doing the close by hand because > it's not possible on Plan 9 to take an fd and set to to close-on-exec > -- that's only done on open on Plan 9 (on unix the code does an > fcntl). But if an FD is used twice for a child -- as it is with > combined stdout/stderr -- then the close closes the fd before it can > be dup'ed a second time. Bad. > > I did the lazy thing and commented out the erroneous close for now. > The easy fix is to track the fds to be closed in a map and then close > them all later. That's next. Another possibility is to allow '#d/*ctl' > to be writeable and implement a > closeonexec > control message for fds. But maybe that's just too much. It is > certainly easy to do, but is that kind of feature something we want to > add?
just a silly idea, perhaps dup takes an additional argument int dup(int old, int new, int flags); if old and new are the same, flags are applied as if they were given on open. e.g. dupf(fd, fd, OCEXEC); (by the way, i would put in a word for OCFORK.) - erik