9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] APE exit()
@ 2007-01-09 17:44 lucio
  2007-01-09 19:47 ` Charles Forsyth
  0 siblings, 1 reply; 6+ messages in thread
From: lucio @ 2007-01-09 17:44 UTC (permalink / raw)
  To: 9fans

I have had qualified success porting the latest release of the
OpenLDAP client tools to APE.  I will raise some of the issues I
encountered in a separate discussion, but I had one really bothersome
problem and I wonder if there is a trivial fix for something I fail to
understand.

It seems that exit() performs a kill() that causes the window in
which, in this case, ldapsearch runs to close.  Using _EXITS(0)
instead, naturally, has the desired effect, but there has to be a more
appropriate fix.  Any suggestions?

++L

PS: I'm trying very hard to consolidate all the various adjustments I
have made to APE and the release software into a single offering.
Sadly, the scope is rather wide and I too often lose track of which
change had which effect.

What I will continue to do is to post copies of the development stuff
on sources (contrib/proxima) although I cannot vouch that older
postings will still be viable if I have not looked at them for a
while.

I am documenting what I feel is important and will be posting here a
couple of RFCs as soon as I have an infrastructure that is more stable
than right now.



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

* Re: [9fans] APE exit()
  2007-01-09 17:44 [9fans] APE exit() lucio
@ 2007-01-09 19:47 ` Charles Forsyth
  2007-01-10  4:17   ` lucio
  0 siblings, 1 reply; 6+ messages in thread
From: Charles Forsyth @ 2007-01-09 19:47 UTC (permalink / raw)
  To: 9fans

>It seems that exit() performs a kill() that causes the window in
>which, in this case, ldapsearch runs to close.  Using _EXITS(0)

does it do a setsid()? either way i can't see how it can destroy the window,
but unless it does setsid() its call to exit shouldn't then call kill


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

* Re: [9fans] APE exit()
  2007-01-09 19:47 ` Charles Forsyth
@ 2007-01-10  4:17   ` lucio
  2007-01-29 23:58     ` andrey mirtchovski
  0 siblings, 1 reply; 6+ messages in thread
From: lucio @ 2007-01-10  4:17 UTC (permalink / raw)
  To: 9fans

>>It seems that exit() performs a kill() that causes the window in
>>which, in this case, ldapsearch runs to close.  Using _EXITS(0)
>
> does it do a setsid()? either way i can't see how it can destroy the window,
> but unless it does setsid() its call to exit shouldn't then call kill

I'll have to look.  I fear Unix and Plan 9 process control are a bit
of a mystery to me, but I can check the sources, of course.

And I agree with you that it shouldn't destroy the window, but it is
the type of inconvenient behaviour that one can't help noticing.  In
ACME/win it is slightly different, but I think analogous.  Thanks for
putting me on some sort of track.

++L



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

* Re: [9fans] APE exit()
  2007-01-10  4:17   ` lucio
@ 2007-01-29 23:58     ` andrey mirtchovski
  2007-01-30  9:21       ` lucio
  2007-02-02 19:33       ` lucio
  0 siblings, 2 replies; 6+ messages in thread
From: andrey mirtchovski @ 2007-01-29 23:58 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

I think I figured that one out.

/sys/src/ape/lib/ap/plan9/_buf.c:66 sets _killmuxsid() to be called
during exit, then forks the process nodefile. this is all fine until
exit time, when there is a race: _killmuxsid is called and tries to
kill the child via kill(-pidgroup) but the child has already exited.
kill() calls setpgid() on itself trying to become the same group as
the child, but since the child has exited setpgid() fails (there is no
such group anymore). kill() will then happily proceed and send SIGTERM
to the original note group with which it was born, which unfortunately
is the same notegroup of the shell, hence killing them both.

a proposed fix for /sys/src/ape/lib/ap/plan9/kill.c:

49,54c49,51
< 		if(setpgid(mpid, -pid) > 0) {
< 			r = note(mpid, msg, "/proc/%d/notepg");
< 			setpgid(mpid, sid);
< 		} else {
< 			r = -1;
< 		}
---
> 		setpgid(mpid, -pid);
> 		r = note(mpid, msg, "/proc/%d/notepg");
> 		setpgid(mpid, sid);


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

* Re: [9fans] APE exit()
  2007-01-29 23:58     ` andrey mirtchovski
@ 2007-01-30  9:21       ` lucio
  2007-02-02 19:33       ` lucio
  1 sibling, 0 replies; 6+ messages in thread
From: lucio @ 2007-01-30  9:21 UTC (permalink / raw)
  To: mirtchovski, 9fans

> I think I figured that one out.

Cool, I'll give you some feedback as soon as I can test it this side.
It would make all the difference, to me.

++L



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

* Re: [9fans] APE exit()
  2007-01-29 23:58     ` andrey mirtchovski
  2007-01-30  9:21       ` lucio
@ 2007-02-02 19:33       ` lucio
  1 sibling, 0 replies; 6+ messages in thread
From: lucio @ 2007-02-02 19:33 UTC (permalink / raw)
  To: mirtchovski, 9fans

> a proposed fix for /sys/src/ape/lib/ap/plan9/kill.c:

Worked a treat.  Thank you, Andrey, very, very much.

I now have functional OpenLDAP client tools and libraries.  If anyone
else needs them, please contact me.  I'll be rebuilding them to
tighten down the procedure, but I can provide working versions for the
386.  I'd be curious, if anyone has alternative architectures handy,
to have them tested on different platforms.

++L



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

end of thread, other threads:[~2007-02-02 19:33 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-01-09 17:44 [9fans] APE exit() lucio
2007-01-09 19:47 ` Charles Forsyth
2007-01-10  4:17   ` lucio
2007-01-29 23:58     ` andrey mirtchovski
2007-01-30  9:21       ` lucio
2007-02-02 19:33       ` lucio

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