diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2014-12-12 17:10:44 +0000 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2014-12-12 17:10:44 +0000 |
commit | e0d3795654b7eb5b91b478bc7e6b717b192a8bce (patch) | |
tree | 7be4908dfc8a445a28a622ecd514f81ea31619bb /qemu-io-cmds.c | |
parent | 99c9c3cb24e566258a0a141178934f9cb5198842 (diff) | |
parent | 82595da8dedde128d8004ec47441aeb720c08704 (diff) | |
download | qemu-e0d3795654b7eb5b91b478bc7e6b717b192a8bce.zip qemu-e0d3795654b7eb5b91b478bc7e6b717b192a8bce.tar.gz qemu-e0d3795654b7eb5b91b478bc7e6b717b192a8bce.tar.bz2 |
Merge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into staging
# gpg: Signature made Fri 12 Dec 2014 17:09:56 GMT using RSA key ID 81AB73C8
# gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>"
# gpg: aka "Stefan Hajnoczi <stefanha@gmail.com>"
* remotes/stefanha/tags/block-pull-request:
linux-aio: simplify removal of completed iocbs from the list
linux-aio: drop return code from laio_io_unplug and ioq_submit
linux-aio: rename LaioQueue idx field to "n"
linux-aio: track whether the queue is blocked
linux-aio: queue requests that cannot be submitted
block: drop unused bdrv_clear_incoming_migration_all() prototype
block: Don't add trailing space in "Formating..." message
qemu-iotests: Remove traling whitespaces in *.out
block: vhdx - set .bdrv_has_zero_init to bdrv_has_zero_init_1
iotests: Fix test 039
iotests: Filter for "Killed" in qemu-io output
qemu-io: Add sigraise command
block: vhdx - change .vhdx_create default block state to ZERO
block: vhdx - update PAYLOAD_BLOCK_UNMAPPED value to match 1.00 spec
block: vhdx - remove redundant comments
block/rbd: fix memory leak
iotests: Add test for vmdk JSON file names
vmdk: Fix error for JSON descriptor file names
block migration: fix return value
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'qemu-io-cmds.c')
-rw-r--r-- | qemu-io-cmds.c | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/qemu-io-cmds.c b/qemu-io-cmds.c index d94fb1e..e708552 100644 --- a/qemu-io-cmds.c +++ b/qemu-io-cmds.c @@ -2048,6 +2048,51 @@ static const cmdinfo_t abort_cmd = { .oneline = "simulate a program crash using abort(3)", }; +static void sigraise_help(void) +{ + printf( +"\n" +" raises the given signal\n" +"\n" +" Example:\n" +" 'sigraise %i' - raises SIGTERM\n" +"\n" +" Invokes raise(signal), where \"signal\" is the mandatory integer argument\n" +" given to sigraise.\n" +"\n", SIGTERM); +} + +static int sigraise_f(BlockDriverState *bs, int argc, char **argv); + +static const cmdinfo_t sigraise_cmd = { + .name = "sigraise", + .cfunc = sigraise_f, + .argmin = 1, + .argmax = 1, + .flags = CMD_NOFILE_OK, + .args = "signal", + .oneline = "raises a signal", + .help = sigraise_help, +}; + +static int sigraise_f(BlockDriverState *bs, int argc, char **argv) +{ + int sig = cvtnum(argv[1]); + if (sig < 0) { + printf("non-numeric signal number argument -- %s\n", argv[1]); + return 0; + } + + /* Using raise() to kill this process does not necessarily flush all open + * streams. At least stdout and stderr (although the latter should be + * non-buffered anyway) should be flushed, though. */ + fflush(stdout); + fflush(stderr); + + raise(sig); + return 0; +} + static void sleep_cb(void *opaque) { bool *expired = opaque; @@ -2202,4 +2247,5 @@ static void __attribute((constructor)) init_qemuio_commands(void) qemuio_add_command(&wait_break_cmd); qemuio_add_command(&abort_cmd); qemuio_add_command(&sleep_cmd); + qemuio_add_command(&sigraise_cmd); } |