MEDIUM: threads/fd: Initialize the process mask during the call to fd_insert

Listeners will allow any threads to process the corresponding fd. But for other
FDs, we limit the processing to the current thread.
diff --git a/src/dns.c b/src/dns.c
index 2d684b0..c2b87c0 100644
--- a/src/dns.c
+++ b/src/dns.c
@@ -193,7 +193,7 @@
 	dgram->t.sock.fd = fd;
 	fdtab[fd].owner  = dgram;
 	fdtab[fd].iocb   = dgram_fd_handler;
-	fd_insert(fd);
+	fd_insert(fd, (unsigned long)-1);
 	fd_want_recv(fd);
 	return 0;
 }
diff --git a/src/haproxy.c b/src/haproxy.c
index 7f48514..170b002 100644
--- a/src/haproxy.c
+++ b/src/haproxy.c
@@ -2228,7 +2228,7 @@
 	fcntl(mworker_pipe[0], F_SETFL, O_NONBLOCK);
 	fdtab[mworker_pipe[0]].owner = mworker_pipe;
 	fdtab[mworker_pipe[0]].iocb = mworker_pipe_handler;
-	fd_insert(mworker_pipe[0]);
+	fd_insert(mworker_pipe[0], MAX_THREADS_MASK);
 	fd_want_recv(mworker_pipe[0]);
 }
 
diff --git a/src/hathreads.c b/src/hathreads.c
index 4c795b1..470ee02 100644
--- a/src/hathreads.c
+++ b/src/hathreads.c
@@ -50,7 +50,7 @@
 
 	fdtab[rfd].owner = NULL;
 	fdtab[rfd].iocb = thread_sync_io_handler;
-	fd_insert(rfd);
+	fd_insert(rfd, MAX_THREADS_MASK);
 
 	all_threads_mask = mask;
 	return 0;
diff --git a/src/proto_tcp.c b/src/proto_tcp.c
index b43fdef..1a26bcc 100644
--- a/src/proto_tcp.c
+++ b/src/proto_tcp.c
@@ -1107,7 +1107,7 @@
 
 	fdtab[fd].owner = listener; /* reference the listener instead of a task */
 	fdtab[fd].iocb = listener->proto->accept;
-	fd_insert(fd);
+	fd_insert(fd, MAX_THREADS_MASK);
 
  tcp_return:
 	if (msg && errlen) {
diff --git a/src/proto_uxst.c b/src/proto_uxst.c
index 4210f5d..fc4a519 100644
--- a/src/proto_uxst.c
+++ b/src/proto_uxst.c
@@ -332,9 +332,9 @@
 	listener->state = LI_LISTEN;
 
 	/* the function for the accept() event */
-	fd_insert(fd);
 	fdtab[fd].iocb = listener->proto->accept;
 	fdtab[fd].owner = listener; /* reference the listener instead of a task */
+	fd_insert(fd, MAX_THREADS_MASK);
 	return err;
 
  err_rename:
diff --git a/src/ssl_sock.c b/src/ssl_sock.c
index 68f5d25..ca9647d 100644
--- a/src/ssl_sock.c
+++ b/src/ssl_sock.c
@@ -459,7 +459,7 @@
 		afd = add_fd[i];
 		fdtab[afd].owner = conn;
 		fdtab[afd].iocb = ssl_async_fd_handler;
-		fd_insert(afd);
+		fd_insert(afd, tid_bit);
 	}
 
 	num_add_fds = 0;