title: listen called on socket more than once -- expected behavior?
body: <p>I noticed something odd while working with a simple C-based server
  program on my Linux (4.10.3) system. I accidentally ended up calling
  <code>listen()</code> twice on a socket (from the server process) I had
  called <code>bind()</code> on earlier. I noticed that both the listen calls
  succeeded without any errors. In fact, it doesn't seem to matter how many
  calls to listen I make, all calls to listen succeed.</p>
  
  <p>I was expecting all the calls to listen after the first one to fail
  with <code>EADDRINUSE</code>. Am I missing something? Linux/POSIX man pages don't
  seem to say anything about this. I did find one reference about
  this behavior on the following web-page:</p>
  
  <p><a href="https://www.mkssoftware.com/docs/man3/listen.3.asp" rel="nofollow noreferrer">https://www.mkssoftware.com/docs/man3/listen.3.asp</a></p>
  
  <blockquote>
    <p>An application may call listen() more than once on the same socket.
    This has the effect of updating the current backlog for the listening
    socket. Should there be more pending connections than the new backlog
    value, the excess pending connections are reset and dropped.</p>
  </blockquote>
  
  <p>It's unclear to me if this also applies to Linux. And so my question is:
  what happens when listen is called on the same socket more than once from
  the same process? (Apparently there are no visible side-effects in user space,
  but does the Linux kernel do something special in kernel space?)</p>
  
  <p>Thanks.</p>