develooper Front page | perl.perl5.porters | Postings from April 2000

[PATCH 5.6.0] Re: [DOC] 4-arg select

From:
M.J.T. Guy
Date:
April 26, 2000 08:29
Subject:
[PATCH 5.6.0] Re: [DOC] 4-arg select
Message ID:
E12kTkP-0006gv-00@ursa.cus.cam.ac.uk
Hugo <hv@crypt.compulink.co.uk> wrote
> The documentation refers to $nfound, but doesn't at any point explain
> what it is. I don't understand it well enough myself to offer a patch -
> is it the number of different file handles, of those on which you are
> selecting, for which one of readable/writable/error is true?

On Solaris 2.6, "man -s 3c select" tells me

     On successful completion, select() returns the total  number
     of  bits  set  in the bit masks.  Otherwise, -1 is returned,
     and errno is set to indicate the error.

So I guess the attached patch is OK on at least one platform.


Mike Guy

--- ./pod/perlfunc.pod.orig	Mon Mar 20 22:13:52 2000
+++ ./pod/perlfunc.pod	Wed Apr 26 16:24:55 2000
@@ -3900,8 +3900,11 @@
 
     $nfound = select($rout=$rin, $wout=$win, $eout=$ein, undef);
 
-Most systems do not bother to return anything useful in $timeleft, so
-calling select() in scalar context just returns $nfound.
+$nfound will be set to the total number of bits set in the $rout,
+$wout and $eout bitmaps.    $nfound is zero if the select timed out.
+If $nfound is negative, the select terminated abnormally and the error
+is in $!.  Most systems do not bother to return anything useful in
+$timeleft, so calling select() in scalar context just returns $nfound.
 
 Any of the bit masks can also be undef.  The timeout, if specified, is
 in seconds, which may be fractional.  Note: not all implementations are

End of patch



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About