<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Problem on poll(2) system call in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/problem-on-poll-2-system-call/m-p/4297669#M537302</link>
    <description>In the code you have provided is the commented-out stuff before while(!terminate) supposed to imply that fds has been initialized before the while loop?&lt;BR /&gt;&lt;BR /&gt;Apart from wondering if folks using poll should always be checking for POLLERR anyway, regardless of past HP-UX behaviour, you might check for current patches to 11iv3.  If you haven't already done so, checking the 11iv3 manpage for poll might be a good idea.&lt;BR /&gt;&lt;BR /&gt;When you say closed socket, closed how exactly?  And by that you mean a socket closed on the remote, or do you mean a local socket closed by another thread in the same appliction?&lt;BR /&gt;&lt;BR /&gt;Is there any chance that data could have been in flight to this remote socket being closed and so triggering an RST?&lt;BR /&gt;&lt;BR /&gt;Can you expand a bit on the comment "recv on a closed socket returns 0 on hp v2 but 4 on hpv3?&lt;BR /&gt;&lt;BR /&gt;When/if you do go to the response center with this, they'll probably want a complete test case.</description>
    <pubDate>Thu, 30 Oct 2008 22:57:49 GMT</pubDate>
    <dc:creator>rick jones</dc:creator>
    <dc:date>2008-10-30T22:57:49Z</dc:date>
    <item>
      <title>Problem on poll(2) system call</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/problem-on-poll-2-system-call/m-p/4297668#M537301</link>
      <description>I am seeing problem with ‘poll’ system call on “HP-UX 11i v3” but not on earlier versions.&lt;BR /&gt;&lt;BR /&gt;count = poll(fds, MAXFDS, timeout);&lt;BR /&gt;&lt;BR /&gt;fds[n].revents is set to POLLERR on a closed file descriptor but on other UNIX and earlier HP operating system fds[n].revents is set to POLLIN. Is this a bug on HP v3 system?&lt;BR /&gt;&lt;BR /&gt;Aziz Ahmad&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;#include &lt;SYS&gt; &lt;BR /&gt;..........&lt;BR /&gt;#define MAXFDS 1000&lt;BR /&gt;&lt;BR /&gt;int main(int argc, char** argv)&lt;BR /&gt;{&lt;BR /&gt;  int count;&lt;BR /&gt;  bool terminate = false;&lt;BR /&gt;  struct pollfd fds[MAXFDS]; &lt;BR /&gt;&lt;BR /&gt;  // fds.fd[n] are either -1 or a valid file descriptor&lt;BR /&gt;  // fds.events[n]  = POLLIN for valif fds&lt;BR /&gt;  // fds.revents[n] = 0&lt;BR /&gt;&lt;BR /&gt;  while(!terminate)&lt;BR /&gt;  {&lt;BR /&gt;    do&lt;BR /&gt;    {&lt;BR /&gt;      count = poll(fds, MAXFDS, 30); &lt;BR /&gt;    } while ((count == -1) &amp;amp;&amp;amp; (errno == EINTR));&lt;BR /&gt;    if (count == -1) {&lt;BR /&gt;      // clear bad file descriptor from poll array fds&lt;BR /&gt;      // print error message&lt;BR /&gt;      continue;&lt;BR /&gt;    }&lt;BR /&gt;    for int i=0; i&lt;MAXFDS&gt;&lt;/MAXFDS&gt;    {&lt;BR /&gt;      // on v3 revents is set to POLLERR for a closed socket&lt;BR /&gt;      // on v2 and earlier revents is set to POLLIN for a closed socket&lt;BR /&gt;      if (fds[i].revents &amp;amp; POLLIN) // works fine on UNIX and HP except v3&lt;BR /&gt;        // read fds[i].fd and do something&lt;BR /&gt;        ;&lt;BR /&gt;      // recv on a closed socket returns 0 on hp v2 but 4 on v3&lt;BR /&gt;      // &lt;BR /&gt;      if (fds[i].revents &amp;amp; POLLIN | POLLERR)  // POLLERR needed in v3 to work properly&lt;BR /&gt;        // remove fd with POLLERR from fds array&lt;BR /&gt;        // read fds[i].fd and do something&lt;BR /&gt;        ;&lt;BR /&gt;    }&lt;BR /&gt;  }&lt;BR /&gt;}&lt;BR /&gt;&lt;/SYS&gt;</description>
      <pubDate>Thu, 30 Oct 2008 20:51:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/problem-on-poll-2-system-call/m-p/4297668#M537301</guid>
      <dc:creator>Blade Doyle</dc:creator>
      <dc:date>2008-10-30T20:51:43Z</dc:date>
    </item>
    <item>
      <title>Re: Problem on poll(2) system call</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/problem-on-poll-2-system-call/m-p/4297669#M537302</link>
      <description>In the code you have provided is the commented-out stuff before while(!terminate) supposed to imply that fds has been initialized before the while loop?&lt;BR /&gt;&lt;BR /&gt;Apart from wondering if folks using poll should always be checking for POLLERR anyway, regardless of past HP-UX behaviour, you might check for current patches to 11iv3.  If you haven't already done so, checking the 11iv3 manpage for poll might be a good idea.&lt;BR /&gt;&lt;BR /&gt;When you say closed socket, closed how exactly?  And by that you mean a socket closed on the remote, or do you mean a local socket closed by another thread in the same appliction?&lt;BR /&gt;&lt;BR /&gt;Is there any chance that data could have been in flight to this remote socket being closed and so triggering an RST?&lt;BR /&gt;&lt;BR /&gt;Can you expand a bit on the comment "recv on a closed socket returns 0 on hp v2 but 4 on hpv3?&lt;BR /&gt;&lt;BR /&gt;When/if you do go to the response center with this, they'll probably want a complete test case.</description>
      <pubDate>Thu, 30 Oct 2008 22:57:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/problem-on-poll-2-system-call/m-p/4297669#M537302</guid>
      <dc:creator>rick jones</dc:creator>
      <dc:date>2008-10-30T22:57:49Z</dc:date>
    </item>
  </channel>
</rss>

