Displaying 1 result from an estimated 1 matches for "stream_to_stdout".
2013 Sep 18
2
Trouble using virStream with callbacks
...ENT_HANDLE_READABLE) {
char buf[1024];
int bytes_read = read(fd, buf, sizeof(buf));
if (bytes_read > 0)
virStreamSend(stream, buf, bytes_read);
}
if (events & (VIR_EVENT_HANDLE_ERROR|VIR_EVENT_HANDLE_HANGUP)) {
stream_active = 0;
}
return;
}
void
stream_to_stdout(virStreamPtr stream, int events, void *opaque)
{
if (events & VIR_EVENT_HANDLE_READABLE) {
char buf[1024];
int bytes_read = virStreamRecv(stream, buf, sizeof(buf));
if (bytes_read > 0) {
fwrite(buf, bytes_read, 1, stdout);
fflush(stdout);
}
}...