X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=stdin.c;h=c683b56073ae05c0b057b2b1909be220f7b066ad;hp=5b6bf520cb6b09f54e6dc30cb3f21c8d7118ba63;hb=b764977e54d34650a4529cc05abb4ca7603735f7;hpb=0810e4932d4d8fb477d4af5596d4b263d2538ff6 diff --git a/stdin.c b/stdin.c index 5b6bf520..c683b560 100644 --- a/stdin.c +++ b/stdin.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006-2008 Andre Noll + * Copyright (C) 2006-2009 Andre Noll * * Licensed under the GPL v2. For licencing details see COPYING. */ @@ -31,6 +31,11 @@ static void stdin_pre_select(struct sched *s, struct task *t) { struct stdin_task *sit = container_of(t, struct stdin_task, task); + + if (sit->output_error && *sit->output_error < 0) { + t->error = *sit->output_error; + return; + } t->error = 0; sit->check_fd = 0; if (sit->loaded >= sit->bufsize) @@ -55,6 +60,10 @@ static void stdin_post_select(struct sched *s, struct task *t) struct stdin_task *sit = container_of(t, struct stdin_task, task); ssize_t ret; + if (sit->output_error && *sit->output_error < 0) { + t->error = *sit->output_error; + return; + } t->error = 0; if (!sit->check_fd) return; @@ -82,13 +91,14 @@ void stdin_set_defaults(struct stdin_task *sit) { int ret; - sit->bufsize = 16 * 1024, + sit->bufsize = 32 * 1024, sit->task.pre_select = stdin_pre_select; sit->task.post_select = stdin_post_select; sprintf(sit->task.status, "stdin reader"); ret = mark_fd_nonblocking(STDIN_FILENO); if (ret >= 0) return; + sit->output_error = NULL; PARA_EMERG_LOG("%s\n", para_strerror(-ret)); exit(EXIT_FAILURE); }