title: How come revents is 0 when the cable is unplugged?
body: <p>I have a function to check the ethernet link status. When the cable is plugged in, then revents is POLLIN. So the line &quot;Status is changed.&quot; is printed out. But if the cable is unplugged, the revents is 0. Then the &quot;Status is changed.&quot; isn't printed out. Why revents is 0 when the cable is unplugged? In this case, how can I know if the cable is unplugged?</p>
  <pre><code>void pollLink()
  {
      struct pollfd poll_data[1];
      
      poll_data[0].fd = 0;
      poll_data[0].events = POLLIN;
  
      poll(poll_data, 1, 0);
      if (poll_data[0].revents == POLLIN)
      {
          printf(&quot;Status is changed.&quot;);
      }
  }
  </code></pre>