Muli Ben-Yehuda wrote:
> check for KVM_GET/SET_REGS ioctl failures
>
> Signed-off-by: Muli Ben-Yehuda <[EMAIL PROTECTED]>
>
> diff -r ee6f88782b5f -r 9a3e101daf18 user/kvmctl.c
> --- a/user/kvmctl.c Tue Feb 06 10:55:17 2007 +0000
> +++ b/user/kvmctl.c Tue Feb 06 17:05:56 2007 +0200
> @@ -235,19 +235,23 @@ static int handle_io(kvm_context_t kvm,
> int delta;
> struct translation_cache tr;
> int _in = (run->io.direction == KVM_EXIT_IO_IN);
> + int r;
>
> translation_cache_init(&tr);
>
> if (run->io.string || _in) {
> regs.vcpu = run->vcpu;
> - ioctl(kvm->fd, KVM_GET_REGS, ®s);
> + r = ioctl(kvm->fd, KVM_GET_REGS, ®s);
> + if (r == -1) {
> + perror("KVM_GET_REGS");
> + exit(1);
>
Please don't add exit()'s to a library, these are the sort of things we
should be trying to remove.
In the very least, you should probably expect to see EINTRs.
Regards,
Anthony Liguori
> + }
> }
>
> delta = run->io.string_down ? -run->io.size : run->io.size;
>
> while (more_io(run, first_time)) {
> void *value_addr;
> - int r;
>
> if (!run->io.string) {
> if (_in)
> @@ -327,13 +331,25 @@ static int handle_io(kvm_context_t kvm,
> }
> first_time = 0;
> if (r) {
> - ioctl(kvm->fd, KVM_SET_REGS, ®s);
> - return r;
> - }
> - }
> -
> - if (run->io.string || _in)
> - ioctl(kvm->fd, KVM_SET_REGS, ®s);
> + int savedret = r;
> + r = ioctl(kvm->fd, KVM_SET_REGS, ®s);
> + if (r == -1) {
> + perror("KVM_SET_REGS");
> + exit(1);
> + }
> +
> + return savedret;
> + }
> + }
> +
> + if (run->io.string || _in) {
> + r = ioctl(kvm->fd, KVM_SET_REGS, ®s);
> + if (r == -1) {
> + perror("KVM_SET_REGS");
> + exit(1);
> + }
> + }
> +
> run->emulated = 1;
> return 0;
> }
>
> -------------------------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job easier.
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> kvm-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/kvm-devel
>
>
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
kvm-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/kvm-devel