X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=afs.c;h=e2a517ece2c8451b7a2715bc7f7a943b7680d079;hp=1350db3423c3a184cb645e09cae9a2ebb060358b;hb=9bf4bc297a7cb88f4f886c6b8d600fd6c584139c;hpb=4108592dd3ac3a4cbee530b64c6f9c8b6a60be99 diff --git a/afs.c b/afs.c index 1350db34..e2a517ec 100644 --- a/afs.c +++ b/afs.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2009 Andre Noll + * Copyright (C) 2007-2010 Andre Noll * * Licensed under the GPL v2. For licencing details see COPYING. */ @@ -710,14 +710,16 @@ static void signal_pre_select(struct sched *s, struct task *t) static void afs_signal_post_select(struct sched *s, struct task *t) { struct signal_task *st = container_of(t, struct signal_task, task); + int signum; + if (getppid() == 1) { PARA_EMERG_LOG("para_server died\n"); goto shutdown; } if (!FD_ISSET(st->fd, &s->rfds)) return; - st->signum = para_next_signal(); - if (st->signum == SIGHUP) { + signum = para_next_signal(); + if (signum == SIGHUP) { close_afs_tables(); parse_config_or_die(1); t->error = open_afs_tables(); @@ -726,7 +728,7 @@ static void afs_signal_post_select(struct sched *s, struct task *t) init_admissible_files(current_mop); return; } - PARA_EMERG_LOG("terminating on signal %d\n", st->signum); + PARA_EMERG_LOG("terminating on signal %d\n", signum); shutdown: sched_shutdown(); t->error = -E_AFS_SIGNAL; @@ -930,14 +932,11 @@ static void command_post_select(struct sched *s, struct task *t) free(client); } /* Accept connections on the local socket. */ - if (!FD_ISSET(ct->fd, &s->rfds)) - return; - ret = para_accept(ct->fd, &unix_addr, sizeof(unix_addr)); - if (ret < 0) { + ret = para_accept(ct->fd, &s->rfds, &unix_addr, sizeof(unix_addr), &fd); + if (ret < 0) PARA_NOTICE_LOG("%s\n", para_strerror(-ret)); + if (ret <= 0) return; - } - fd = ret; ret = mark_fd_nonblocking(fd); if (ret < 0) { PARA_NOTICE_LOG("%s\n", para_strerror(-ret)); @@ -1151,12 +1150,30 @@ void afs_event(enum afs_events event, struct para_buffer *pb, } } +/** + * Dummy event handler for the images table. + * + * \param event Unused. + * \param pb Unused. + * \param data Unused. + * + * This table does not honor events. + */ int images_event_handler(__a_unused enum afs_events event, __a_unused struct para_buffer *pb, __a_unused void *data) { return 1; } +/** + * Dummy event handler for the lyrics table. + * + * \param event Unused. + * \param pb Unused. + * \param data Unused. + * + * This table does not honor events. + */ int lyrics_event_handler(__a_unused enum afs_events event, __a_unused struct para_buffer *pb, __a_unused void *data) {