// interrupted poll is ignored - see CR 7086177 if (poll_result == -1 && errno == EINTR) { continue;
}
if (poll_result == -1) {
err_sys("poll() failed in main_loop");
}
if (fds[1].revents & POLLIN) { if ((n = read(master_fd, buf, FRAGSIZ)) == -1) { #ifdef __CYGWIN__ // On Windows master_fd is invalid here // (bug #252202)
close(master_fd); return0; #else
err_sys("read from master failed\n"); #endif
}
if (n == 0) { break;
}
if (writen(STDOUT_FILENO, buf, n) == -1) {
err_sys("write to stdout failed\n");
}
}
if (to_master.offset != to_master.length) { int nwritten = writen_no_block(master_fd, &to_master); if (nwritten == -1) {
err_sys("write to master failed\n");
}
} elseif (fds[0].revents & POLLIN) { if ((n = read(STDIN_FILENO, to_master.buf, FRAGSIZ)) == -1) {
err_sys("read from stdin failed");
}
if (n == 0) { #ifdef __CYGWIN__ // On Windows when calling process is killed, // POLLIN flag is set, not POLLHUP. // So behave as if we have received POLLHUP in this case...
close(master_fd); return1; #endif break;
}
to_master.offset = 0;
to_master.length = n;
int nwritten = writen_no_block(master_fd, &to_master); if (nwritten == -1) {
err_sys("write to master failed\n");
}
}
if (fds[1].revents & POLLHUP) { break;
}
if (fds[0].revents & POLLHUP) { // STDIN END is broken... // Cannot just break at this point as 'child' process still alive. // [will hung on waitpid later.. ] // So will close the MASTER END => this causes a hangup to occur on // the other end of the pipe. // no data is drained in this case...
close(master_fd); return1;
}
}
return0;
} #endif
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.8 Sekunden
(vorverarbeitet am 2026-09-28)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.