afs.c: Trivial whitespace cleanup.
[paraslash.git] / afs.c
diff --git a/afs.c b/afs.c
index 65d6ed958d17d3238c5b55535bf661ec782d5c5f..e73c668fb6d93b3a200eb841e4d4c34ce4b48e59 100644 (file)
--- a/afs.c
+++ b/afs.c
@@ -28,8 +28,8 @@
 #include "ipc.h"
 #include "list.h"
 #include "sched.h"
-#include "signal.h"
 #include "fd.h"
+#include "signal.h"
 #include "mood.h"
 #include "sideband.h"
 #include "command.h"
@@ -89,7 +89,7 @@ extern struct misc_meta_data *mmd;
 
 static int server_socket;
 static struct command_task command_task_struct;
-static struct signal_task signal_task_struct;
+static struct signal_task *signal_task;
 
 static enum play_mode current_play_mode;
 static char *current_mop; /* mode or playlist specifier. NULL means dummy mood */
@@ -195,7 +195,7 @@ static int dispatch_result(int result_shmid, callback_result_handler *handler,
  * copied.  It then notifies the afs process that the callback function \a f
  * should be executed by sending the shared memory identifier (shmid) to the
  * socket.
-
+ *
  * If the callback produces a result, it sends any number of shared memory
  * identifiers back via the socket. For each such identifier received, \a
  * result_handler is called. The contents of the sma identified by the received
@@ -236,8 +236,8 @@ int send_callback_request(callback_function *f, struct osl_object *query,
        if (ret < 0)
                goto out;
 
-       *(uint32_t *) buf = afs_socket_cookie;
-       *(int *) (buf + sizeof(afs_socket_cookie)) = query_shmid;
+       *(uint32_t *)buf = afs_socket_cookie;
+       *(int *)(buf + sizeof(afs_socket_cookie)) = query_shmid;
 
        ret = connect_local_socket(conf.afs_socket_arg);
        if (ret < 0)
@@ -607,8 +607,9 @@ static void com_select_callback(int fd, const struct osl_object *query)
                        activate_mood_or_playlist(NULL, &num_admissible);
                }
        } else
-               ret2 = para_printf(&pb, "activated %s (%d admissible files)\n", current_mop?
-                       current_mop : "dummy mood", num_admissible);
+               ret2 = para_printf(&pb, "activated %s (%d admissible files)\n",
+                       current_mop?  current_mop : "dummy mood",
+                       num_admissible);
 out:
        if (ret2 >= 0 && pb.offset)
                pass_buffer_as_shm(fd, SBD_OUTPUT, pb.buf, pb.offset);
@@ -713,12 +714,6 @@ static int open_afs_tables(void)
        return ret;
 }
 
-static void signal_pre_select(struct sched *s, void *context)
-{
-       struct signal_task *st = context;
-       para_fd_set(st->fd, &s->rfds, &s->max_fileno);
-}
-
 static int afs_signal_post_select(struct sched *s, __a_unused void *context)
 {
        int signum, ret;
@@ -747,20 +742,17 @@ shutdown:
 
 static void register_signal_task(struct sched *s)
 {
-       struct signal_task *st = &signal_task_struct;
-
        para_sigaction(SIGPIPE, SIG_IGN);
-       st->fd = para_signal_init();
-       PARA_INFO_LOG("signal pipe: fd %d\n", st->fd);
+       signal_task = signal_init_or_die();
        para_install_sighandler(SIGINT);
        para_install_sighandler(SIGTERM);
        para_install_sighandler(SIGHUP);
 
-       st->task = task_register(&(struct task_info) {
+       signal_task->task = task_register(&(struct task_info) {
                .name = "signal",
                .pre_select = signal_pre_select,
                .post_select = afs_signal_post_select,
-               .context = st,
+               .context = signal_task,
 
        }, s);
 }