Displaying 1 result from an estimated 1 matches for "stdin_to_stream".
2013 Sep 18
2
Trouble using virStream with callbacks
...e <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <libvirt/libvirt.h>
#include <fcntl.h>
#define CONNECT_URI "qemu:///system"
#define DOMAIN "TestVM"
#define CHANNEL "channel.0"
#define BUF_SIZE 80
int stream_active = 1;
void
stdin_to_stream(int watch, int fd, int events, void *opaque)
{
virStreamPtr stream = *((virStreamPtr*)(opaque));
if (events & VIR_EVENT_HANDLE_READABLE) {
char buf[1024];
int bytes_read = read(fd, buf, sizeof(buf));
if (bytes_read > 0)
virStreamSend(stream, buf, bytes_read);...