9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: erik quanstrom <quanstro@quanstro.net>
To: rminnich@gmail.com, 9fans@9fans.net
Subject: Re: [9fans] native (mostly) go for plan9
Date: Mon, 31 Oct 2011 18:24:13 -0400	[thread overview]
Message-ID: <d5d05362e0a7b827b56761a2c06d519b@chula.quanstro.net> (raw)
In-Reply-To: <CAP6exYJf1UKFdpeXyFXRt0Y7hPc=Hyq7oBdvi9uX3Z7+FQbxsA@mail.gmail.c>

> 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



  parent reply	other threads:[~2011-10-31 22:24 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-31 15:11 ron minnich
2011-10-31 16:41 ` Stanley Lieber
2011-10-31 16:51   ` andrey mirtchovski
2011-10-31 17:08   ` ron minnich
2011-10-31 17:30     ` Stanley Lieber
2011-10-31 17:41       ` andrey mirtchovski
2011-10-31 17:44         ` ron minnich
2011-10-31 17:45         ` Stanley Lieber
2011-10-31 17:50           ` ron minnich
2011-10-31 19:23             ` Stanley Lieber
2011-10-31 19:32               ` ron minnich
2011-10-31 19:44                 ` Stanley Lieber
2011-10-31 19:48                   ` ron minnich
2011-10-31 21:01                     ` ron minnich
2011-10-31 22:10                       ` Skip Tavakkolian
2011-10-31 22:17                         ` ron minnich
2011-10-31 22:34                           ` Bakul Shah
2011-10-31 22:38                             ` ron minnich
2011-10-31 22:21                         ` ron minnich
2011-11-01 10:20                 ` Charles Forsyth
     [not found]               ` <CAP6exYJ8MQdcRa1vofMVjgaFK0Xu-po4eZBOOb>
     [not found]                 ` <CAP6exYJf1UKFdpeXyFXRt0Y7hPc=Hyq7oBdvi9uX3Z7+FQbxsA@mail.gmail.c>
2011-10-31 22:24                   ` erik quanstrom [this message]
2011-10-31 22:34                     ` cinap_lenrek
2011-10-31 22:44                       ` erik quanstrom
2011-10-31 22:47                     ` cinap_lenrek
     [not found]                 ` <CAP6exYKue2e7NWx07+RMNDs38aXex0y9urfT6eT1LKbjvvA_yw@mail.gmail.c>
2011-10-31 22:46                   ` erik quanstrom
2011-11-01 10:41     ` Yaroslav
2011-11-01 16:57 ` Skip Tavakkolian
2011-11-01 17:26   ` ron minnich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d5d05362e0a7b827b56761a2c06d519b@chula.quanstro.net \
    --to=quanstro@quanstro.net \
    --cc=9fans@9fans.net \
    --cc=rminnich@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).