9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] ctrl-d and rio
@ 2004-11-04 17:10 Steve Simon
  2004-11-04 17:21 ` andrey mirtchovski
  0 siblings, 1 reply; 4+ messages in thread
From: Steve Simon @ 2004-11-04 17:10 UTC (permalink / raw)
  To: 9fans

When I run a user level fileservers, eg my own cifs
and then close the window with ctrl-d the window doesn't close,
I have to use rio to delete the window.

This doesn't happen with the likes of ftpfs.

At first I though I was holding /dev/cons open so I close
fds 0, 1, and 2 and lsof shows me I only have the network
connection (and /dev/bintime) open.

why don't my programs cleanup nicely?

-Steve


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [9fans] ctrl-d and rio
  2004-11-04 17:10 [9fans] ctrl-d and rio Steve Simon
@ 2004-11-04 17:21 ` andrey mirtchovski
  2004-11-04 18:52   ` rog
  2004-11-04 19:11   ` rog
  0 siblings, 2 replies; 4+ messages in thread
From: andrey mirtchovski @ 2004-11-04 17:21 UTC (permalink / raw)
  To: 9fans

i've seen the same problem when starting the plumber in a new
namespace.  ctrl+d doesn't close the window, but if i hit 'del' (and
kill the plumber) it goes away.  it's very easy to reproduce.

never been bothered by it enough to look at the cause and assumed it's
just open file descriptors.  still, i am interested in hearing
explanations/solutions.

andrey



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [9fans] ctrl-d and rio
  2004-11-04 17:21 ` andrey mirtchovski
@ 2004-11-04 18:52   ` rog
  2004-11-04 19:11   ` rog
  1 sibling, 0 replies; 4+ messages in thread
From: rog @ 2004-11-04 18:52 UTC (permalink / raw)
  To: 9fans

> never been bothered by it enough to look at the cause and assumed it's
> just open file descriptors.  still, i am interested in hearing
> explanations/solutions.

this has nagged at me too in the past, so i just had a look into it.

there are two reasons (in in the plumber case, at any rate)
why the shell window doesn't disappear correctly.
the first is a bug in /sys/src/cmd/plumb/fsys.c:/^startfsys

	procrfork(fsysproc, nil, Stack, RFFDG);

should be:

	procrfork(fsysproc, nil, Stack, RFFDG|RFNAMEG);

otherwise the process serving the plumbing namespace is also holding
that namespace open.

but even with that fixed, the plumber automatically creates an entry
in /srv.  this holds the 9p pipe to the plumber open even when the
shell holding the plumber's namespace exits.

removing the /srv file allows the window to disappear correctly (a rio
window only exits when the window's namespace is no longer
referenced).

so, assuming the first fix,

	plumber
	rm `{cat /env/plumbsrv}

would be sufficient (although an option suppressing the /srv posting
would likely be preferable).



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [9fans] ctrl-d and rio
  2004-11-04 17:21 ` andrey mirtchovski
  2004-11-04 18:52   ` rog
@ 2004-11-04 19:11   ` rog
  1 sibling, 0 replies; 4+ messages in thread
From: rog @ 2004-11-04 19:11 UTC (permalink / raw)
  To: 9fans

this reminds me.

if i wish to run a command in the background from a window
without stopping the window from closing automatically when
the shell terminates, is there a simpler way than:

@ {
	rfork n
	unmount /mnt/wsys /dev
	unmount /mnt/wsys
	exec mycommand < /dev/null > /dev/null >[2] /dev/null &
}

?



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2004-11-04 19:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-11-04 17:10 [9fans] ctrl-d and rio Steve Simon
2004-11-04 17:21 ` andrey mirtchovski
2004-11-04 18:52   ` rog
2004-11-04 19:11   ` rog

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).