]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - server.c
Switch to the new afs.
[paraslash.git] / server.c
index e94de736f81b9508739dbf0f4c38c180ede29fdb..5777ec438d418eead0affdb00af289af889fcbed 100644 (file)
--- a/server.c
+++ b/server.c
  *
  */
 
+#include <signal.h>
+#include <sys/types.h>
+#include <dirent.h>
 
 #include "para.h"
+#include "error.h"
 #include "server.cmdline.h"
 #include "afs_common.h"
 #include "afh.h"
+#include "string.h"
+#include "afs.h"
 #include "server.h"
 #include "vss.h"
 #include "config.h"
 #include "close_on_fork.h"
 #include "send.h"
-#include "error.h"
 #include "net.h"
 #include "daemon.h"
-#include "string.h"
 #include "ipc.h"
 #include "fd.h"
 #include "list.h"
 #include "sched.h"
 #include "signal.h"
 #include "user_list.h"
-#include "afs.h"
 
 /** define the array of error lists needed by para_server */
 INIT_SERVER_ERRLISTS;
@@ -349,8 +352,8 @@ out:
 }
 
 uint32_t afs_socket_cookie;
-static int afs_socket;
-pid_t afs_pid;
+int afs_socket;
+static pid_t afs_pid;
 
 static void init_afs(void)
 {
@@ -441,6 +444,8 @@ static void handle_sighup(void)
        mmd->selector_change = mmd->selector_num; /* do not change selector.. */
        change_selector(); /* .. just reload */
        init_user_list(user_list_file); /* reload user list */
+       if (afs_pid)
+               kill(afs_pid, SIGHUP);
 }
 
 static void status_refresh(void)
@@ -494,14 +499,14 @@ repeat:
        /* check socket and signal pipe in any case */
        para_fd_set(sockfd, &rfds, &max_fileno);
        para_fd_set(signal_pipe, &rfds, &max_fileno);
-       timeout = vss_preselect();
+       timeout = vss_preselect(&rfds, &wfds, &max_fileno);
        status_refresh();
        for (i = 0; senders[i].name; i++) {
                if (senders[i].status != SENDER_ON)
                        continue;
                if (!senders[i].pre_select)
                        continue;
-               senders[i].pre_select( &max_fileno, &rfds, &wfds);
+               senders[i].pre_select(&max_fileno, &rfds, &wfds);
        }
        if (selectors[mmd->selector_num].pre_select) {
                ret = selectors[mmd->selector_num].pre_select(&rfds, &wfds);
@@ -510,6 +515,7 @@ repeat:
        mmd_unlock();
        ret = para_select(max_fileno + 1, &rfds, &wfds, timeout);
        mmd_lock();
+       vss_post_select(&rfds, &wfds);
        if (mmd->selector_change >= 0)
                change_selector();
        if (selectors[mmd->selector_num].post_select)
@@ -535,8 +541,8 @@ repeat:
                        break;
                case SIGCHLD:
                        for (;;) {
-                               pid = para_reap_child();
-                               if (pid <= 0)
+                               ret = para_reap_child(&pid);
+                               if (ret <= 0)
                                        break;
                                if (pid != afs_pid)
                                        continue;