So what does it mean when the following code:

$! = 0; $res = $sock->read($data, 255); # $res: #chars, or 0 for EOF, or undef for error $err = $!; $iologger->debug("bufrd res " . safe($res) . ": " . safe($data) . " err $err");

Logs this:

2011-10-13 09:21:39,782 DEBUG kcmdproxy.child.io(30674):366 bufrd res +<<127>>: <<simkserver<sp>30665<sp>port<sp>2001<sp>client<sp>127.0.0.1 +<sp>command<sp>special<lf>1,8,7,2,13,1,12<lf>13,5,11,10,8,0,13<lf>5,2 +,11,4,5,10,5<lf>3,5,7,10,12,2,12<lf>>> err Resource temporarily unava +ilable

The socket call returned 127, which should be a number of characters (and looks about right). And it also set $! (which I had carefully set to 0 before the call). There isn't threading going on, and the signal handling is at the level of setting one variable in the handler, so nothing else should be interrupting to set $!. I suppose I could localize it, just as a test, to see if this still happens, but I don't see how something else can be getting in to set it. Does the $! value mean anything in this case, or is it just garbage?


In reply to Re: Socket descriptor passed across fork -- hanging by dd-b
in thread Socket descriptor passed across fork -- hanging by dd-b

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.