| Server IP : 82.208.35.60 / Your IP : 216.73.217.33 Web Server : Apache/2.4.55 (FreeBSD) OpenSSL/1.1.1q-freebsd PHP/7.3.31 System : FreeBSD server7.d2m.cz 12.4-RELEASE-p9 FreeBSD 12.4-RELEASE-p9 GENERIC amd64 User : studiokobylisy_cz ( 1008) PHP Version : 7.3.31 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /usr/ports/benchmarks/linux-gputest/files/ |
Upload File : |
#!/usr/bin/env perl
use strict;
use warnings;
use Sys::Mmap;
my $fh;
my $flen;
my $fdata;
sub commit {
return unless $fh;
munmap $fdata or die "munmap: $!";
close $fh or die "close: $!";
}
while (<>) {
chomp;
if (/^([0-9A-F]{8}):? ([0-9A-F]{2}) ([0-9A-F]{2})$/i) {
my ($offset, $old, $new) = map hex, $1, $2, $3;
next unless $fdata;
next unless $offset < $flen;
next if ord substr($fdata, $offset, 1) != $old;
substr($fdata, $offset, 1) = chr $new;
} elsif (-e) {
commit;
open $fh, '+<', $_ or die "open: $!";
mmap $fdata, 0, PROT_READ | PROT_WRITE, MAP_SHARED, $fh
or die "mmap: $!";
$flen = -s;
}
}
commit;