9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] waitpid
@ 2006-11-08  1:02 Joel Salomon
  2006-11-08  1:08 ` Joel Salomon
  2006-11-08  1:10 ` Russ Cox
  0 siblings, 2 replies; 9+ messages in thread
From: Joel Salomon @ 2006-11-08  1:02 UTC (permalink / raw)
  To: 9fans

I’m trying to wait for all child processes to finish.  The lunix code my professor gave me for this was:
	while (wait(&wstat)>0)
		;
which I naïvely translated as:
	while(waitpid() != 0)
		;
which hangs.  Evidently waitpid returns something other than 0 when there are no children, but what?  The man page wait(2) doesn’t say, nor does it point to the source for waitpid.

--Joel



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

* Re: [9fans] waitpid
  2006-11-08  1:02 [9fans] waitpid Joel Salomon
@ 2006-11-08  1:08 ` Joel Salomon
  2006-11-08  1:13   ` geoff
  2006-11-08  1:10 ` Russ Cox
  1 sibling, 1 reply; 9+ messages in thread
From: Joel Salomon @ 2006-11-08  1:08 UTC (permalink / raw)
  To: 9fans

Never mind; I found /sys/src/libc/9sys/waitpid.c so I know that wait pid returns -1 if there are no children, and I’ve submitted a patch to wait(2).

--Joel



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

* Re: [9fans] waitpid
  2006-11-08  1:02 [9fans] waitpid Joel Salomon
  2006-11-08  1:08 ` Joel Salomon
@ 2006-11-08  1:10 ` Russ Cox
  2006-11-08  1:15   ` Joel Salomon
  1 sibling, 1 reply; 9+ messages in thread
From: Russ Cox @ 2006-11-08  1:10 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

> The man page wait(2) doesn't say,
> nor does it point to the source for waitpid.

The source for the entire C library is in /sys/src/libc/*/*.
It might take a few milliseconds to grep through.

Also:
http://www.google.com/search?q=plan9%20waitpid

Russ


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

* Re: [9fans] waitpid
  2006-11-08  1:08 ` Joel Salomon
@ 2006-11-08  1:13   ` geoff
  0 siblings, 0 replies; 9+ messages in thread
From: geoff @ 2006-11-08  1:13 UTC (permalink / raw)
  To: 9fans

Don't bother submitting a patch; I've updated the SOURCE section of
wait(2).  You didn't need the source to get the answer to your
question either; note the phrase `These routines set errstr.' and see
intro(2) for what this means.



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

* Re: [9fans] waitpid
  2006-11-08  1:10 ` Russ Cox
@ 2006-11-08  1:15   ` Joel Salomon
  2006-11-08  1:25     ` Joel Salomon
  2006-11-08  1:28     ` Bruce Ellis
  0 siblings, 2 replies; 9+ messages in thread
From: Joel Salomon @ 2006-11-08  1:15 UTC (permalink / raw)
  To: 9fans

> The source for the entire C library is in /sys/src/libc/*/*.
> It might take a few milliseconds to grep through.

Plus a few seconds to open a window, type the grep command; compared to right-clicking in acme, it’s practically an eternity ☺.

--Joel



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

* Re: [9fans] waitpid
  2006-11-08  1:15   ` Joel Salomon
@ 2006-11-08  1:25     ` Joel Salomon
  2006-11-08  1:28     ` Bruce Ellis
  1 sibling, 0 replies; 9+ messages in thread
From: Joel Salomon @ 2006-11-08  1:25 UTC (permalink / raw)
  To: 9fans

> Don't bother submitting a patch; I've updated the SOURCE section of wait(2).

That was half my patch.

> You didn't need the source to get the answer to your question
> either; note the phrase `These routines set errstr.' and see
> intro(2) for what this means.

Is waiting without children considered an error condition?  Checking…
	waitpid returned -1: no living children
…looks like.  OK, a lack of understanding on my part; never mind.

--Joel



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

* Re: [9fans] waitpid
  2006-11-08  1:15   ` Joel Salomon
  2006-11-08  1:25     ` Joel Salomon
@ 2006-11-08  1:28     ` Bruce Ellis
  2006-11-08  2:30       ` Federico Benavento
  1 sibling, 1 reply; 9+ messages in thread
From: Bruce Ellis @ 2006-11-08  1:28 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

i good trick for finding a function's src is to run acid
on a program that uses it and ...

src(fname)

will you give you something which starts with a nice
plumbable string.

brucee

On 11/8/06, Joel Salomon <chesky@plan9.jp> wrote:
> > The source for the entire C library is in /sys/src/libc/*/*.
> > It might take a few milliseconds to grep through.
>
> Plus a few seconds to open a window, type the grep command; compared to right-clicking in acme, it's practically an eternity ☺.
>
> --Joel
>
>

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

* Re: [9fans] waitpid
  2006-11-08  1:28     ` Bruce Ellis
@ 2006-11-08  2:30       ` Federico Benavento
  2006-11-08  6:55         ` Bruce Ellis
  0 siblings, 1 reply; 9+ messages in thread
From: Federico Benavento @ 2006-11-08  2:30 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

yep, like:

src -s fname binary

On 11/8/06, Bruce Ellis <bruce.ellis@gmail.com> wrote:
> i good trick for finding a function's src is to run acid
> on a program that uses it and ...
>
> src(fname)
>
> will you give you something which starts with a nice
> plumbable string.
>
> brucee
>
> On 11/8/06, Joel Salomon <chesky@plan9.jp> wrote:
> > > The source for the entire C library is in /sys/src/libc/*/*.
> > > It might take a few milliseconds to grep through.
> >
> > Plus a few seconds to open a window, type the grep command; compared to right-clicking in acme, it's practically an eternity ☺.
> >
> > --Joel
> >
> >
>


-- 
Federico G. Benavento

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

* Re: [9fans] waitpid
  2006-11-08  2:30       ` Federico Benavento
@ 2006-11-08  6:55         ` Bruce Ellis
  0 siblings, 0 replies; 9+ messages in thread
From: Bruce Ellis @ 2006-11-08  6:55 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

great, didn't know about that ... but i live in the past - the
rent is cheaper. one decade gdb will add some of its
obvious utility (blame it on bedbug if you like) but by then
it will be larger than all of plan9, if it isn't already.

brucee

On 11/8/06, Federico Benavento <benavento@gmail.com> wrote:
> yep, like:
>
> src -s fname binary
>
> On 11/8/06, Bruce Ellis <bruce.ellis@gmail.com> wrote:
> > i good trick for finding a function's src is to run acid
> > on a program that uses it and ...
> >
> > src(fname)
> >
> > will you give you something which starts with a nice
> > plumbable string.
> >
> > brucee
> >
> > On 11/8/06, Joel Salomon <chesky@plan9.jp> wrote:
> > > > The source for the entire C library is in /sys/src/libc/*/*.
> > > > It might take a few milliseconds to grep through.
> > >
> > > Plus a few seconds to open a window, type the grep command; compared to right-clicking in acme, it's practically an eternity ☺.
> > >
> > > --Joel
> > >
> > >
> >
>
>
> --
> Federico G. Benavento
>

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

end of thread, other threads:[~2006-11-08  6:55 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-11-08  1:02 [9fans] waitpid Joel Salomon
2006-11-08  1:08 ` Joel Salomon
2006-11-08  1:13   ` geoff
2006-11-08  1:10 ` Russ Cox
2006-11-08  1:15   ` Joel Salomon
2006-11-08  1:25     ` Joel Salomon
2006-11-08  1:28     ` Bruce Ellis
2006-11-08  2:30       ` Federico Benavento
2006-11-08  6:55         ` Bruce Ellis

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