
On Mon, May 24, 2010 at 12:07:06AM -0700, Scott Feldman wrote:
+static int +nlCommWaitSuccess(struct nlmsghdr *nlmsg, int nl_groups, + char **respbuf, int *respbuflen, long to_usecs) +{ + int rc = 0; + struct sockaddr_nl nladdr = { + .nl_family = AF_NETLINK, + .nl_pid = getpid(), + .nl_groups = nl_groups, + }; + int rcvChunkSize = 1024; // expecting less than that + int rcvoffset = 0; + ssize_t nbytes; + int n; + struct timeval tv = { + .tv_sec = to_usecs / MICROSEC_PER_SEC, + .tv_usec = to_usecs % MICROSEC_PER_SEC, + }; + fd_set rfds; + bool gotvalid = false; + int fd = nlOpen(); + static uint32_t seq = 0x1234; + uint32_t myseq = seq++; + uint32_t mypid = getpid(); + + if (fd < 0) + return -1; + + nlmsg->nlmsg_pid = mypid; + nlmsg->nlmsg_seq = myseq; + nlmsg->nlmsg_flags |= NLM_F_ACK; + + nbytes = sendto(fd, (void *)nlmsg, nlmsg->nlmsg_len, 0, + (struct sockaddr *)&nladdr, sizeof(nladdr)); + if (nbytes < 0) { + virReportSystemError(errno, + "%s", _("cannot send to netlink socket")); + rc = -1; + goto err_exit; + } + fprintf(stderr,"sent %d bytes\n", (int)nbytes);
Can you change that to VIR_DEBUG("send %d bytes", (int)bytes), and likewise for all other places using fprintf() for debug output. NB VIR_DEBUG doesn't need a trailing \n, it adds one for you. If you want to view the debug messages from libvirtd then just run it using LIBVIRT_LOG_FILTERS=1:macvtap LIBVIRT_LOG_OUTPUTS=1:stderr /usr/sbin/libvirtd and it'll print all VIR_DEBUG() lines in macvtap.c Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|