Heray-Was-Here
Server : Apache
System : Linux vps103298.mylogin.co 4.18.0-513.11.1.el8_9.x86_64 #1 SMP Wed Jan 17 02:00:40 EST 2024 x86_64
User : calvet ( 273824)
PHP Version : 7.4.33
Disable Function : NONE
Directory :  /proc/self/root/proc/self/root/usr/share/doc/perl-Sys-Virt/examples/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //proc/self/root/proc/self/root/usr/share/doc/perl-Sys-Virt/examples/emulator-pin.pl
#!/usr/bin/perl

use Sys::Virt;


my $uri = shift @ARGV;

my $c = Sys::Virt->new(uri => $uri);


my $d = $c->get_domain_by_name("vm1");

unless ($d->is_active()) {
    $d->create;
}



my $mask = $d->get_emulator_pin_info;

@bits = split(//, unpack("b*", $mask));
print join(":", @bits), "\n";

if ($bits[0] == '1' && $bits[1] == '1') {
    @bits[0] = 0;
    my $newmask = '';
    for(my $i = 0 ; $i <= $#bits ; $i++) {
	vec($newmask, $i, 1) = $bits[$i];
    }
    @bits = split(//, unpack("b*", $newmask));
    print join(":", @bits), "\n";
    $d->pin_emulator($newmask);

    $newermask = $d->get_emulator_pin_info;
    @bits = split(//, unpack("b*", $newermask));
    print join(":", @bits), "\n";

    $d->pin_emulator($mask);

    $newermask = $d->get_emulator_pin_info;
    @bits = split(//, unpack("b*", $newermask));
    print join(":", @bits), "\n";

}

Hry