X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=audiod.c;h=a072071c199d6fd3f90bb9448101ff62790c9db4;hp=ee1364433e77de965e715fe59692040e6e590989;hb=bc15c3ff65eb00e04ebc303cfa9ee3d1a4675b35;hpb=ba0c0797c76a2c94cb4a9f6938274fea5ba0226f diff --git a/audiod.c b/audiod.c index ee136443..a072071c 100644 --- a/audiod.c +++ b/audiod.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2005-2014 Andre Noll + * Copyright (C) 2005-2014 Andre Noll * * Licensed under the GPL v2. For licencing details see COPYING. */ @@ -93,11 +93,7 @@ enum vss_status_flags { */ struct sched sched = {.max_fileno = 0}; -/** - * The task for obtaining para_server's status (para_client stat). - * - * \sa struct task, struct sched. - */ +/* The task for obtaining para_server's status (para_client stat). */ struct status_task { /** The associated task structure of audiod. */ struct task *task; @@ -1004,16 +1000,15 @@ err: exit(EXIT_FAILURE); } -static void signal_pre_select(struct sched *s, struct task *t) +static void signal_pre_select(struct sched *s, void *context) { - struct signal_task *st = task_context(t); + struct signal_task *st = context; para_fd_set(st->fd, &s->rfds, &s->max_fileno); } -static int signal_post_select(struct sched *s, __a_unused struct task *t) +static int signal_post_select(struct sched *s, __a_unused void *context) { int signum; - signum = para_next_signal(&s->rfds); switch (signum) { case SIGINT: @@ -1025,16 +1020,16 @@ static int signal_post_select(struct sched *s, __a_unused struct task *t) return 0; } -static void command_pre_select(struct sched *s, struct task *t) +static void command_pre_select(struct sched *s, void *context) { - struct command_task *ct = task_context(t); + struct command_task *ct = context; para_fd_set(ct->fd, &s->rfds, &s->max_fileno); } -static int command_post_select(struct sched *s, struct task *t) +static int command_post_select(struct sched *s, void *context) { int ret; - struct command_task *ct = task_context(t); + struct command_task *ct = context; static struct timeval last_status_dump; struct timeval tmp, delay; bool force = true; @@ -1083,8 +1078,8 @@ static void close_stat_pipe(void) { if (!stat_task->ct) return; - client_close(stat_task->ct); task_reap(&stat_task->ct->task); + client_close(stat_task->ct); stat_task->ct = NULL; clear_and_dump_items(); stat_task->length_seconds = 0; @@ -1196,9 +1191,9 @@ static void start_stop_decoders(void) btr_log_tree(sl->receiver_node->btrn, LL_NOTICE); } -static void status_pre_select(struct sched *s, struct task *t) +static void status_pre_select(struct sched *s, void *context) { - struct status_task *st = task_context(t); + struct status_task *st = context; int i, ret, cafn = stat_task->current_audio_format_num; if (must_start_decoder()) @@ -1228,9 +1223,9 @@ min_delay: } /* restart the client task if necessary */ -static int status_post_select(struct sched *s, struct task *t) +static int status_post_select(struct sched *s, void *context) { - struct status_task *st = task_context(t); + struct status_task *st = context; if (audiod_status == AUDIOD_OFF) { if (!st->ct) @@ -1399,7 +1394,7 @@ int main(int argc, char *argv[]) writer_init(); if (conf.help_given || conf.detailed_help_given) print_help_and_die(); - drop_privileges_or_die(conf.user_arg, conf.group_arg); + daemon_drop_privileges_or_die(conf.user_arg, conf.group_arg); parse_config_or_die(); init_colors_or_die(); init_random_seed_or_die(); @@ -1417,8 +1412,8 @@ int main(int argc, char *argv[]) PARA_EMERG_LOG("%s\n", para_strerror(-ret)); exit(EXIT_FAILURE); } - log_welcome("para_audiod"); - set_server_start_time(NULL); + daemon_log_welcome("para_audiod"); + daemon_set_start_time(); set_initial_status(); FOR_EACH_SLOT(i) clear_slot(i);