]> git.ipfire.org Git - thirdparty/libvirt.git/commit
virfdstream: Drop iohelper in favour of a thread
authorMichal Privoznik <mprivozn@redhat.com>
Thu, 6 Apr 2017 16:21:39 +0000 (18:21 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Fri, 28 Apr 2017 12:17:10 +0000 (14:17 +0200)
commitd1a60f4c3bf0236165c3bb39d04228934b45e805
treeb1f814e94889798648d437cdd9a4462c6cfdfb60
parent585eb4692085e04225332e795cf8deabac67da73
virfdstream: Drop iohelper in favour of a thread

Currently we use iohelper for virFDStream implementation. This is
because UNIX I/O can lie sometimes: even though a FD for a
file/block device is set as unblocking, actual read()/write() can
block. To avoid this, a pipe is created and one end is kept for
read/write while the other is handed over to iohelper to
write/read the data for us. Thus it's iohelper which gets blocked
and not our event loop.

This approach has two problems:
1) we are spawning a new process.
2) any exchange of information between daemon and iohelper can be
done only through the pipe.

Therefore, iohelper is replaced with an implementation in thread
which is created just for the stream lifetime. The data are still
transferred through pipe (for now), but both problems described
above are solved.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
src/util/virfdstream.c
src/util/virfdstream.h