+#include "buffer_tree.h"
+
+/**
+ * The pre_select function of the stdout task.
+ *
+ * \param s The scheduler this task was registered to.
+ * \param t The task structure of the stdout task.
+ *
+ * This function is always successful. If there is data available in the input
+ * buffer, it adds \p STDOUT_FILENO to the write fd set of \a s.
+ */
+static void stdout_pre_select(struct sched *s, struct task *t)
+{
+ struct stdout_task *sot = container_of(t, struct stdout_task, task);
+
+ t->error = 0;
+ sot->check_fd = 0;
+ if (!*sot->loaded) {
+ if (*sot->input_error < 0) {
+ t->error = *sot->input_error;
+ s->timeout.tv_sec = 0;
+ s->timeout.tv_usec = 1;
+ }
+ return;
+ }
+ sot->check_fd = 1;
+ para_fd_set(STDOUT_FILENO, &s->wfds, &s->max_fileno);
+}