Libvirt provides a portable, long term stable C API for managing the virtualization technologies provided by many operating systems. It includes support for QEMU, KVM, Xen, LXC, bhyve, Virtuozzo, VMware vCenter and ESX, VMware Desktop, Hyper-V, VirtualBox and the POWER Hypervisor.
Go to file
Jim Meyering b59d9c85f1 Use safewrite in place of write, in many cases.
Also add "make syntax-check" rules to ensure no new uses sneak in.

There are many uses of write like this:

    if (write (fd, xml, towrite) != towrite)
        return -1;

The problem is that the syscall can succeed, yet write less than
the requested number of bytes, so the caller should retry
rather than simply failing.

This patch changes most of them to use util.c's safewrite wrapper,
which encapsulates the process.  Also, there were a few cases in
which the retry loop was open-coded, and I replaced those, too.

* Makefile.maint (sc_avoid_write): New rule, to avoid recurrence.
* .x-sc_avoid_write: New file.  Record two legitimate exemptions.
* qemud/qemud.c (sig_handler, qemudClientWriteBuf): Use safewrite, not write.
* src/conf.c (__virConfWriteFile): Likewise.
* src/qemu_conf.c (qemudSaveConfig, qemudSaveNetworkConfig): Likewise.
* src/qemu_driver.c (qemudWaitForMonitor, qemudStartVMDaemon)
(qemudVMData, PROC_IP_FORWARD): Likewise.
* proxy/libvirt_proxy.c: Include "util.h".
(proxyWriteClientSocket): Use safewrite.
* src/test.c (testDomainSave, testDomainCoreDump): Likewise.
* src/proxy_internal.c (virProxyWriteClientSocket): Likewise.
* src/virsh.c: Include "util-lib.h".
(vshOutputLogFile): Use safewrite.
* src/console.c: Include "util-lib.h".
(vshRunConsole): Use safewrite.
2008-02-22 15:55:04 +00:00
build-aux Pull useless-if-before-free from gnulib, and update. 2008-02-13 21:52:19 +00:00
docs Avoid "make syntax-check" failure. 2008-02-20 17:26:01 +00:00
gnulib Pull useless-if-before-free from gnulib, and update. 2008-02-13 21:52:19 +00:00
include Added main internal storage driver impl 2008-02-20 15:34:52 +00:00
m4 Use gnulib, starting with its physmem and getaddrinfo modules. 2007-12-05 21:31:07 +00:00
po Update to work with new policy kit APIs 2008-02-20 16:54:35 +00:00
proxy Move safewrite and saferead to a separate file. 2008-02-22 15:53:13 +00:00
python Added python binding for storage APIs 2008-02-20 15:26:22 +00:00
qemud Use safewrite in place of write, in many cases. 2008-02-22 15:55:04 +00:00
scripts Ignore /usr/include in coverage reports 2007-07-25 23:18:15 +00:00
src Use safewrite in place of write, in many cases. 2008-02-22 15:55:04 +00:00
tests With --without-xen, avoid warning about unused function. 2008-02-22 12:33:47 +00:00
.cvsignore Ignore a few more files 2008-01-02 16:31:21 +00:00
.x-sc_avoid_if_before_free Remove more useless if tests before "free"-like functions. 2008-02-07 16:49:29 +00:00
.x-sc_avoid_write Use safewrite in place of write, in many cases. 2008-02-22 15:55:04 +00:00
.x-sc_no_have_config_h Enable another syntax-check rule. 2008-02-07 19:20:36 +00:00
.x-sc_require_config_h Enable the <config.h>-requiring test; fix violations 2008-01-29 18:15:54 +00:00
.x-sc_trailing_blank Ignore doc files for syntax check 2008-02-20 15:57:34 +00:00
acinclude.m4 Fix compat for old pkg-config and gnutls 2008-01-22 21:30:05 +00:00
AUTHORS Support VNC keymap option with QEMU (Daniel Hokka Zakrisson) 2008-01-15 15:18:33 +00:00
autobuild.sh autobuild.sh: Run "make syntax-check", so the autobuilder does this. 2008-02-07 19:19:45 +00:00
autogen.sh Remove all trailing blanks; turn on the rule to detect them. 2008-02-05 19:27:37 +00:00
bootstrap Pull useless-if-before-free from gnulib, and update. 2008-02-13 21:52:19 +00:00
ChangeLog Use safewrite in place of write, in many cases. 2008-02-22 15:55:04 +00:00
configure.in Update to work with new policy kit APIs 2008-02-20 16:54:35 +00:00
COPYING.LIB Initial revision 2005-11-02 12:50:21 +00:00
GNUmakefile Add framework for code style- and syntax-checking rules. 2008-01-29 17:42:39 +00:00
libvirt.pc.in * libvirt.pc.in: applied patch from Daniel Berrange to fix --cflags 2006-03-24 13:18:12 +00:00
libvirt.spec.in Added disk partition storage pool backend 2008-02-20 15:52:17 +00:00
Makefile.am Enable the <config.h>-requiring test; fix violations 2008-01-29 18:15:54 +00:00
Makefile.cfg Enable another syntax-check rule. 2008-02-07 19:20:36 +00:00
Makefile.maint Use safewrite in place of write, in many cases. 2008-02-22 15:55:04 +00:00
NEWS Regenerate docs to include storage APIs 2008-02-20 15:20:44 +00:00
README Correct typos in the documentation (Atsushi SAKAI) 2008-01-24 10:15:13 +00:00
RENAMES Mon Jun 11 13:25:00 BST 2007 Richard W.M. Jones <rjones@redhat.com> 2007-06-11 12:25:06 +00:00
TODO Remove all trailing blanks; turn on the rule to detect them. 2008-02-05 19:27:37 +00:00
virsh.1 Remove all trailing blanks; turn on the rule to detect them. 2008-02-05 19:27:37 +00:00

         LibVirt : simple API for virtualization

  Libvirt is a C toolkit to interact with the virtualization capabilities
of recent versions of Linux (and other OSes). It is free software
available under the GNU Lesser General Public License. Virtualization of
the Linux Operating System means the ability to run multiple instances of
Operating Systems concurrently on a single hardware system where the basic
resources are driven by a Linux instance. The library aim at providing
long term stable C API initially for the Xen paravirtualization but
should be able to integrate other virtualization mechanisms if needed.

Daniel Veillard <veillard@redhat.com>