]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - server.c
Switch from select(2) to poll(2).
[paraslash.git] / server.c
index 5da384d8a935f9e02f830b7aadf079c2701145fe..2c66cc279c9faa99e009ae747fd4d8a54738e2e8 100644 (file)
--- a/server.c
+++ b/server.c
@@ -388,8 +388,8 @@ static int command_task_accept(unsigned listen_idx, struct sched *s,
         * schedule() to return as there are no more runnable tasks.
         *
         * Note that semaphores are not inherited across a fork(), so we don't
-        * hold the lock at this point. Since server_select() drops the lock
-        * prior to calling para_select(), we need to acquire it here.
+        * hold the lock at this point. Since server_poll() drops the lock
+        * prior to calling poll(), we need to acquire it here.
         */
        mutex_lock(mmd_mutex);
        return -E_CHILD_CONTEXT;
@@ -617,14 +617,13 @@ out:
        killpg(0, SIGUSR1);
 }
 
-static int server_select(int max_fileno, fd_set *readfds, fd_set *writefds,
-               int timeout)
+static int server_poll(struct pollfd *fds, nfds_t nfds, int timeout)
 {
        int ret;
 
        status_refresh();
        mutex_unlock(mmd_mutex);
-       ret = para_select(max_fileno + 1, readfds, writefds, timeout);
+       ret = xpoll(fds, nfds, timeout);
        mutex_lock(mmd_mutex);
        return ret;
 }
@@ -659,14 +658,14 @@ int main(int argc, char *argv[])
                *sct = &server_command_task_struct;
 
        sched.default_timeout = 1000;
-       sched.select_function = server_select;
+       sched.poll_function = server_poll;
 
        server_init(argc, argv, sct);
        mutex_lock(mmd_mutex);
        ret = schedule(&sched);
        /*
-        * We hold the mmd lock: it was re-acquired in server_select()
-        * after the select call.
+        * We hold the mmd lock: it was re-acquired in server_poll()
+        * after the poll(2) call.
         */
        mutex_unlock(mmd_mutex);
        sched_shutdown(&sched);