Statistics
| Branch: | Revision:

root / qga / commands-posix.c @ 4c1b8f1e

History | View | Annotate | Download (39.3 kB)

# Date Author Comment
84d18f06 02/17/2014 06:57 pm Markus Armbruster

Use error_is_set() only when necessary

error_is_set(&var) is the same as var != NULL, but it takes
whole-program analysis to figure that out. Unnecessarily hard for
optimizers, static checkers, and human readers. Dumb it down to
obvious.

Gets rid of several dozen Coverity false positives....

d607a523 11/21/2013 06:39 pm Stefan Weil

qga: Fix compiler warnings (missing format attribute, wrong format strings)

gcc 4.8.2 reports this warning when extra warnings are enabled (-Wextra):

CC    qga/commands.o
qga/commands.c: In function ‘slog’:
qga/commands.c:28:5: error:
function might be possible candidate for ‘gnu_printf’ format attribute [-Werror=suggest-attribute=format]...
485e741c 11/16/2013 12:04 pm whitearchey

qga: Fix shutdown command of guest agent to work with SysV

For now guest agent uses following command to shutdown system:
shutdown -P +0 "blabla"
but this syntax works only with shutdown command from systemd or upstart,
because SysV shutdown requires -h switch....

e5d9adbd 10/10/2013 10:52 pm Tomoki Sekiyama

qemu-ga: execute fsfreeze-freeze in reverse order of mounts

Currently, fsfreeze-freeze may cause deadlock if a guest has loopback mounts
of image files in its disk; e.g.:

  1. mount | grep ^/
    /dev/vda1 / type ext4 (rw,noatime,seclabel,data=ordered)...
8fe6bbca 05/13/2013 05:45 pm Laszlo Ersek

qga: distinguish binary modes in "guest_file_open_modes" map

In Windows guests this may make a difference.

Since the original patch (commit c689b4f1) sought to be pedantic and to
consider theoretical corner cases of portability, we should fix it up
where it failed to come through in that pursuit....

2b720018 05/13/2013 05:45 pm Laszlo Ersek

qga: unlink just created guest-file if fchmod() or fdopen() fails on it

We shouldn't allow guest filesystem pollution on error paths.

Suggested-by: Eric Blake <>
Signed-off-by: Laszlo Ersek <>
Reviewed-by: Eric Blake <>...

c689b4f1 05/07/2013 02:46 pm Laszlo Ersek

qga: set umask 0077 when daemonizing (CVE-2013-2007)

The qemu guest agent creates a bunch of files with insecure permissions
when started in daemon mode. For example:

rw-rw-rw 1 root root /var/log/qemu-ga.log
rw-rw-rw 1 root root /var/run/qga.state...
085d8134 03/22/2013 02:25 pm Peter Maydell

Fix typos and misspellings

Fix various typos and misspellings. The bulk of these were found with
codespell.

Signed-off-by: Peter Maydell <>
Reviewed-by: Stefan Weil <>
Signed-off-by: Stefan Hajnoczi <>

cbb65fc2 03/12/2013 01:58 am Laszlo Ersek

qga: implement qmp_guest_set_vcpus() for Linux with sysfs

Signed-off-by: Laszlo Ersek <>
Reviewed-by: Eric Blake <>
Signed-off-by: Michael Roth <>

d2baff62 03/12/2013 01:58 am Laszlo Ersek

qga: implement qmp_guest_get_vcpus() for Linux with sysfs

Signed-off-by: Laszlo Ersek <>
Reviewed-by: Eric Blake <>
Signed-off-by: Michael Roth <>

70e133a7 03/12/2013 01:57 am Laszlo Ersek

qga: introduce guest-get-vcpus / guest-set-vcpus with stubs

Signed-off-by: Laszlo Ersek <>
Reviewed-by: Eric Blake <>
Signed-off-by: Michael Roth <>

39097daf 03/12/2013 01:53 am Michael Roth

qemu-ga: use key-value store to avoid recycling fd handles after restart

Hosts hold on to handles provided by guest-file-open for periods that can
span beyond the life of the qemu-ga process that issued them. Since these
are issued starting from 0 on every restart, we run the risk of issuing...

6912e6a9 03/12/2013 01:53 am Lei Li

qga: add guest-get-time command

Signed-off-by: Lei Li <>
Reviewed-by: Eric Blake <>
Reviewed-by: Michael Roth <>

*added stub for w32

Signed-off-by: Michael Roth <>

a1bca57f 03/12/2013 01:53 am Lei Li

qga: add guest-set-time command

Signed-off-by: Lei Li <>
Reviewed-by: Eric Blake <>
Reviewed-by: Michael Roth <>

*added stub for w32

Signed-off-by: Michael Roth <>

10a2158f 01/28/2013 09:46 pm Markus Armbruster

qemu-ga: Plug leaks on qmp_guest_network_get_interfaces() error paths

Spotted by Coverity.

Signed-off-by: Markus Armbruster <>
Reviewed-by: Eric Blake <>
Reviewed-by: Luiz Capitulino <>
Signed-off-by: Michael Roth <>

6f686749 01/28/2013 09:46 pm Markus Armbruster

qemu-ga: Plug memory leak in guest_fsfreeze_cleanup()

Neglects to free errors allocated by qmp_guest_fsfreeze_thaw().
Spotted by Coverity.

While there, drop the test whether return value is negative (it's
never true), and improve logging.

Signed-off-by: Markus Armbruster <>...

e4ada482 01/19/2013 12:24 pm Stefan Weil

Replace non-portable asprintf by g_strdup_printf

g_strdup_printf already handles OOM errors, so some error handling in
QEMU code can be removed.

Signed-off-by: Stefan Weil <>
Signed-off-by: Blue Swirl <>

6b26e837 01/09/2013 12:38 am Luiz Capitulino

qemu-ga: bios_supports_mode(): improve error reporting

Most errors are QERR_UNDEFINED_ERROR today.

Signed-off-by: Luiz Capitulino <>
Reviewed-by: Michael Roth <>
Signed-off-by: Michael Roth <>

7b376087 01/09/2013 12:38 am Luiz Capitulino

qemu-ga: guest_suspend(): improve error reporting

Most errors are QERR_UNDEFINED_ERROR today.

Signed-off-by: Luiz Capitulino <>
Reviewed-by: Michael Roth <>
Signed-off-by: Michael Roth <>

ec0f694c 01/09/2013 12:38 am Tomoki Sekiyama

qemu-ga: execute hook to quiesce the guest on fsfreeze-freeze/thaw

To use the online disk snapshot for online-backup, application-level
consistency of the snapshot image is required. However, currently the
guest agent can provide only filesystem-level consistency, and the...

db3edb66 01/09/2013 12:38 am Luiz Capitulino

qemu-ga: qmp_guest_file_*: improve error reporting

Use error_setg_errno() when possible with an improved error description.

Signed-off-by: Luiz Capitulino <>
Signed-off-by: Michael Roth <>

d220a6df 01/09/2013 12:38 am Luiz Capitulino

qemu-ga: qmp_guest_shutdown(): improve error reporting

Most errors are QERR_UNDEFINED_ERROR. Also, adds ga_wait_child() as
a future commit will use it too.

Signed-off-by: Luiz Capitulino <>
Reviewed-by: Michael Roth <>...

261551d1 01/09/2013 12:38 am Luiz Capitulino

qemu-ga: build_fs_mount_list(): take an Error argument

Signed-off-by: Luiz Capitulino <>
Signed-off-by: Michael Roth <>

617fbbc1 01/09/2013 12:38 am Luiz Capitulino

qemu-ga: qmp_guest_fsfreeze_*(): get rid of sprintf() + error_set()

Convert them to error_setg_errno().

Signed-off-by: Luiz Capitulino <>
Reviewed-by: Michael Roth <>
Signed-off-by: Michael Roth <>

071673b0 01/09/2013 12:38 am Luiz Capitulino

qemu-ga: qmp_guest_fstrim(): get rid of sprintf() + error_set()

Convert them to error_setg_errno().

Signed-off-by: Luiz Capitulino <>
Reviewed-by: Michael Roth <>
Signed-off-by: Michael Roth <>

878a0ae0 01/09/2013 12:38 am Luiz Capitulino

qemu-ga: qmp_guest_network_get_interfaces(): get rid of snprintf() + error_set()

Convert them to error_setg_errno().

Signed-off-by: Luiz Capitulino <>
Reviewed-by: Michael Roth <>
Signed-off-by: Michael Roth <>

a9de6d01 01/09/2013 12:38 am Luiz Capitulino

qemu-ga: guest_file_handle_find(): take an Error argument

Signed-off-by: Luiz Capitulino <>
Reviewed-by: Michael Roth <>

*Fixed missing space character in error message

Signed-off-by: Michael Roth <>

3ac4b7c5 01/09/2013 12:38 am Luiz Capitulino

qemu-ga: qmp_guest_file_close(): fix fclose() error check

fclose() returns EOF on error.

Signed-off-by: Luiz Capitulino <>
Reviewed-by: Michael Roth <>
Signed-off-by: Michael Roth <>

1de7afc9 12/19/2012 09:32 am Paolo Bonzini

misc: move include files to include/qemu/

Signed-off-by: Paolo Bonzini <>

7b1b5d19 12/19/2012 09:31 am Paolo Bonzini

qapi: move include files to include/qobject/

Signed-off-by: Paolo Bonzini <>

048d3612 10/06/2012 07:54 pm Aurelien Jarno

Merge branch 'trivial-patches' of git://github.com/stefanha/qemu

  • 'trivial-patches' of git://github.com/stefanha/qemu:
    versatilepb: Use symbolic indices for ARM PIC
    qdev: kill bogus comment
    qemu-barrier: Fix compiler version check for future gcc versions...
4d5b97da 10/05/2012 04:10 pm Amos Kong

cleanup useless return sentence

This patch cleans up return sentences in the end of void functions.

Reported-by: Paolo Bonzini <>
Signed-off-by: Amos Kong <>
Signed-off-by: Stefan Hajnoczi <>

1ab516ed 10/05/2012 03:58 pm Jim Meyering

qemu-ga: prefer pstrcpy: consistently NUL-terminate ifreq.ifr_name

NUL-termination of the .ifr_name field is not required, but is fine
(and preferable to using strncpy and leaving the reader to wonder),
since the first thing the linux kernel does is to clear the last byte....

eab5fd59 06/22/2012 01:59 am Paolo Bonzini

qemu-ga: add guest-fstrim command

FITRIM is a mounted filesystem feature to discard (or "trim") blocks which
are not in use by the filesystem. This is useful for solid-state drives
(SSDs) and thinly-provisioned storage. Provide access to the feature
from the host so that filesystems can be trimmed periodically or before...

af02203f 06/22/2012 01:59 am Paolo Bonzini

qemu-ga: make names more generic for mount list functions

We will use these functions and types for more than FSFREEZE, so rename them.

Signed-off-by: Paolo Bonzini <>
Reviewed-by: Luiz Capitulino <>
Reviewed-by: Michal Privoznik <>...

9e2fa418 05/30/2012 05:00 am Michael Roth

qemu-ga: avoid blocking on atime update when reading /etc/mtab

Currently we re-read/re-process /etc/mtab to get an updated list of
mounts when guest-fsfreeze-thaw is called. This can cause an atime
update on /etc/mtab, which will block if we're in a frozen state....

eecae147 05/30/2012 05:00 am Andreas Färber

qemu-ga: Fix use of environ on Darwin

Use _NSGetEnviron() helper to access the environment.

Signed-off-by: Andreas Färber <>
Cc: Charlie Somerville <>
Signed-off-by: Michael Roth <>

2c02cbf6 05/24/2012 09:06 pm Luiz Capitulino

qemu-ga: Fix missing environ declaration

Commit 3674838cd05268954bb6473239cd7f700a79bf0f uses the environ global
variable, but is relying on environ to be declared somewhere else.

This worked for me because on F16 environ is declared in <unistd.h>, but
that doesn't happen in OpenBSD for example, causing a build failure....

04b4e75f 05/15/2012 05:15 pm Luiz Capitulino

qemu-ga: make reopen_fd_to_null() public

The next commit wants to use it.

Signed-off-by: Luiz Capitulino <>
Reviewed-by: Eric Blake <>
Signed-off-by: Michael Roth <>

dc8764f0 05/15/2012 05:15 pm Luiz Capitulino

qemu-ga: guest-suspend: make the API synchronous

Currently, qemu-ga has a SIGCHLD handler that automatically reaps terminated
children processes. The idea is to avoid having qemu-ga commands blocked
waiting for children to terminate.

That approach has two problems:...

d5dd3498 05/15/2012 05:15 pm Luiz Capitulino

qemu-ga: guest-shutdown: become synchronous

Last commit dropped qemu-ga's SIGCHLD handler, used to automatically
reap terminated children processes. This introduced a bug to
qmp_guest_shutdown(): it will generate zombies.

This problem probably doesn't matter in the success case, as the VM...

3674838c 05/15/2012 05:15 pm Luiz Capitulino

qemu-ga: guest-shutdown: use only async-signal-safe functions

POSIX mandates1 that a child process of a multi-thread program uses
only async-signal-safe functions before exec(). We consider qemu-ga
to be multi-thread, because it uses glib.

However, qmp_guest_shutdown() uses functions that are not...

a31f0531 05/14/2012 08:27 am Jim Meyering

fix some common typos

These were identified using: http://github.com/lyda/misspell-check
and run like this to create a bourne shell script using GNU sed's
-i option:

git ls-files|grep -vF .bin | misspellings -f - |grep -v '^ERROR:' |perl \
-pe 's/^(.*?)\[(\d+)\]: (\w+) -> "(.*?)"$/sed -i '\''${2}s!$3!$4!'\'' $1/'...

f22d85e9 04/30/2012 04:42 pm Michael Roth

qemu-ga: add a whitelist for fsfreeze-safe commands

Currently we rely on fsfreeze/thaw commands disabling/enabling logging
then having other commands check whether logging is disabled to avoid
executing if they aren't safe for running while a filesystem is frozen....

9e8aded4 04/30/2012 04:41 pm Michael Roth

qemu-ga: improve recovery options for fsfreeze

guest-fsfreeze-thaw relies on state information obtained from
guest-fsfreeze-freeze to determine what filesystems to unfreeze.
This is unreliable due to the fact that that state does not account
for FIFREEZE being issued by other processes, or previous instances...

d35d4cb5 04/19/2012 06:42 pm Michael Roth

qemu-ga: generate missing stubs for fsfreeze

When linux-specific commands (including guest-fsfreeze-*) were consolidated
under defined(linux), we forgot to account for the case where
defined(linux) && !defined(FIFREEZE). As a result stubs are no longer...

e72c3f2e 03/25/2012 10:34 pm Michael Roth

qemu-ga: fix bsd build, and re-org linux-specific implementations

3cf0bed8 03/12/2012 10:09 pm Michael Roth

qemu-ga: add guest-sync-delimited

guest-sync leaves it as an exercise to the user as to how to reliably
obtain the response to guest-sync if the client had previously read in a
partial response (due qemu-ga previously being restarted mid-"sentence"
due to reboot, forced restart, etc)....

11d0f125 03/12/2012 10:09 pm Luiz Capitulino

qemu-ga: add guest-suspend-disk

As the command name implies, this command suspends the guest to disk.

The suspend operation is implemented by two functions: bios_supports_mode()
and guest_suspend(). Both functions are generic enough to be used by
other suspend modes (introduced by next commits)....

fbf42210 03/12/2012 10:09 pm Luiz Capitulino

qemu-ga: add guest-suspend-ram

Signed-off-by: Luiz Capitulino <>

95f4f404 03/12/2012 10:09 pm Luiz Capitulino

qemu-ga: add guest-suspend-hybrid

Signed-off-by: Luiz Capitulino <>

3424fc9f 03/12/2012 10:09 pm Michal Privoznik

qemu-ga: add guest-network-get-interfaces command

This command returns an array of:

[ifname, hwaddr, [ipaddr, ipaddr_family, prefix] ]

for each interface in the system.
Currently, only IPv4 and IPv6 are supported.

Signed-off-by: Michal Privoznik <>

c216e5ad 02/23/2012 11:40 pm Michael Roth

qemu-ga: rename guest-agent-commands.c -> commands-posix.c