+ ret = -ERRNO_TO_PARA_ERROR(errno);
+ if (ret == 0)
+ ret = -E_STDIN_EOF;
+ if (ret < 0)
+ goto err;
+ btr_add_output_pool(sit->btrp, ret, sit->btrn);
+ return;
+err:
+ btr_remove_node(sit->btrn);
+ //btr_pool_free(sit->btrp);
+ t->error = ret;
+}
+
+/**
+ * Initialize a stdin task structure with default values.
+ *
+ * \param sit The stdin task structure.
+ *
+ * This fills in the pre/post select function pointers of the task structure
+ * given by \a sit. Moreover, the stdin file desctiptor is set to nonblocking
+ * mode, and a buffer tree is created.
+ */
+void stdin_set_defaults(struct stdin_task *sit)
+{
+ int ret;
+
+ sit->task.pre_select = stdin_pre_select;
+ sit->task.post_select = stdin_post_select;
+ sit->btrp = btr_pool_new("stdin", 64 * 1024);
+ sprintf(sit->task.status, "stdin reader");
+ ret = mark_fd_nonblocking(STDIN_FILENO);
+ if (ret >= 0)
+ return;
+ PARA_EMERG_LOG("%s\n", para_strerror(-ret));
+ exit(EXIT_FAILURE);