title: how to set file descriptor non-blocking?
body: <p>I have two ways to set file descriptor non-blocking.</p>
  
  <pre><code>fcntl(conn_fd, F_SETFD, (fcntl(conn_fd, F_GETFD, 0)|O_NONBLOCK));
  </code></pre>
  
  <p>or </p>
  
  <pre><code> fcntl(conn_fd, F_SETFD, (fcntl(conn_fd, F_GETFD)|O_NONBLOCK));
  </code></pre>
  
  <p>and</p>
  
  <pre><code>void setnonblocking(int sock) {
      int opt;
  
      opt = fcntl(sock, F_GETFL);
      if (opt &lt; 0) {
          printf("fcntl(F_GETFL) fail.");
      }
      opt |= O_NONBLOCK;
      if (fcntl(sock, F_SETFL, opt) &lt; 0) {
          printf("fcntl(F_SETFL) fail.");
      }
  }
  </code></pre>
  
  <p>why the function setnonblocking can set file descriptor non-blocking .but the other can't.I use this when epoll get a new connection.</p>