- while (ready) {
- for (Fifo *f = cfg->fifos; f; f = f->next) {
- if (FD_ISSET(f->fd, &fds)) {
- debug("reading: %s\n", f->name);
- switch (fifo_read_one(f, t, buf)) {
+ if (ready == -1) {
+ switch (errno) {
+ case EINTR:
+ khlib_error(
+ "pselect temp failure: %d, errno: %d, msg: %s\n",
+ ready,
+ errno,
+ strerror(errno)
+ );
+ /* TODO: Reconsider what to do here. */
+ return;
+ default:
+ khlib_fatal(
+ "pselect failed: %d, errno: %d, msg: %s\n",
+ ready,
+ errno,
+ strerror(errno)
+ );
+ }
+ }
+ /* At-least-once ensures that expiries are still checked on timeouts. */
+ do {
+ for (s = cfg->slots; s; s = s->next) {
+ if (FD_ISSET(s->in_fd, &fds)) {
+ khlib_debug("reading: %s\n", s->in_fifo);
+ switch (slot_read(s, t, buf)) {