I would suggest to define an abstraction of "input stream" or "output stream" or "stream", depending on the needs of libvirt, and use that.
I agree. And maybe make it sure that it can be implemented on top of hookable stdio streams on glibc.
There used to be GNU snprintfv too. The stream parts of it could be recycled for this.
http://git.sv.gnu.org/cgit/smalltalk.git/tree/snprintfv/snprintfv/stream.c http://git.sv.gnu.org/cgit/smalltalk.git/tree/snprintfv/snprintfv/stream.h Paolo