X-Git-Url: http://git.tuebingen.mpg.de/?a=blobdiff_plain;f=stdin.c;h=5f9259f7171c50dbdb1e164f6bc36257f45cc253;hb=bb899fb1a0c279a2890ff30d11bf7aec50fb92ed;hp=a4e81bd3d9828d67a77bce09e905ea1dc7bc1d47;hpb=bc15c3ff65eb00e04ebc303cfa9ee3d1a4675b35;p=paraslash.git diff --git a/stdin.c b/stdin.c index a4e81bd3..5f9259f7 100644 --- a/stdin.c +++ b/stdin.c @@ -1,12 +1,7 @@ -/* - * Copyright (C) 2006-2014 Andre Noll - * - * Licensed under the GPL v2. For licencing details see COPYING. - */ +/* Copyright (C) 2006 Andre Noll , see file COPYING. */ /** \file stdin.c Functions that deal with reading from stdin. */ -#include #include #include "para.h" @@ -33,7 +28,7 @@ static void stdin_pre_select(struct sched *s, void *context) if (ret <= 0) return; if (btr_pool_unused(sit->btrp) > 0) - return para_fd_set(STDIN_FILENO, &s->rfds, &s->max_fileno); + return sched_monitor_readfd(STDIN_FILENO, s); sched_request_timeout_ms(100, s); } @@ -42,7 +37,7 @@ static void stdin_pre_select(struct sched *s, void *context) * during the previous pre_select call. If so, and if STDIN_FILENO is readable, * data is read from stdin and fed into the buffer tree. */ -static int stdin_post_select(struct sched *s, void *context) +static int stdin_post_select(__a_unused struct sched *s, void *context) { struct stdin_task *sit = context; ssize_t ret; @@ -69,7 +64,7 @@ static int stdin_post_select(struct sched *s, void *context) * reference can not be freed, we're stuck. */ sz = PARA_MIN(sz, btr_pool_size(sit->btrp) / 2); - ret = read_nonblock(STDIN_FILENO, buf, sz, &s->rfds, &n); + ret = read_nonblock(STDIN_FILENO, buf, sz, &n); if (n > 0) btr_add_output_pool(sit->btrp, n, sit->btrn); if (ret >= 0) @@ -115,6 +110,7 @@ void stdin_task_register(struct stdin_task *sit, struct sched *s) exit(EXIT_FAILURE); } sit->fd_flags = ret; - sit->must_set_nonblock_flag = (sit->fd_flags & O_NONBLOCK) == 0; + sit->must_set_nonblock_flag = (sit->fd_flags & O_NONBLOCK) == 0 + && !isatty(STDIN_FILENO); sit->task = task_register(&ti, s); }