9 void stdout_pre_select(struct sched
*s
, struct task
*t
)
11 struct stdout_task
*sot
= t
->private_data
;
16 if (*sot
->input_eof
) {
17 t
->ret
= -E_STDOUT_EOF
;
18 s
->timeout
.tv_sec
= 0;
19 s
->timeout
.tv_usec
= 1;
24 para_fd_set(STDOUT_FILENO
, &s
->wfds
, &s
->max_fileno
);
27 void stdout_post_select(struct sched
*s
, struct task
*t
)
29 struct stdout_task
*sot
= t
->private_data
;
35 t
->ret
= -E_STDOUT_EOF
;
38 if (!FD_ISSET(STDOUT_FILENO
, &s
->wfds
))
40 t
->ret
= -E_STDOUT_WRITE
;
41 ret
= write(STDOUT_FILENO
, sot
->buf
, *sot
->loaded
);
48 void stdout_default_event_handler(struct task
*t
)
50 PARA_NOTICE_LOG("%p: %s\n", t
, PARA_STRERROR(-t
->ret
));
55 void stdout_set_defaults(struct stdout_task
*sot
)
57 sot
->task
.private_data
= sot
;
58 sot
->task
.pre_select
= stdout_pre_select
;
59 sot
->task
.post_select
= stdout_post_select
;
60 sot
->task
.event_handler
= stdout_default_event_handler
;
62 sprintf(sot
->task
.status
, "stdout writer");