⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.93
Server IP:
65.108.141.171
Server:
Linux server.heloix.com 5.4.0-214-generic #234-Ubuntu SMP Fri Mar 14 23:50:27 UTC 2025 x86_64
Server Software:
Apache
PHP Version:
7.4.33
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
usr
/
share
/
doc
/
libipc-shareable-perl
/
examples
/
Edit File: hvtest2
#!/usr/bin/perl -w # # Test of shared hashes courtesy Robert Emmery <roberte@netscape.com> use IPC::Shareable; use Data::Dumper; use strict; my %shareOpts = ( create => 'yes', exclusive => 'no', mode => 0644, destroy => 'yes', ); my %childShareOpts = ( create => 'no', exclusive => 'no', mode => 0644, destroy => 'yes' ); $SIG{'INT'} = sub { die; }; # create shared memory segment my %hashTable = (); print "\n\nPress any key to start.. (Press Ctrl+C to exit)\n\n"; <STDIN>; tie(%hashTable, 'IPC::Shareable', "glue", {%shareOpts }) || die "Failed to share hashTable"; if (fork() == 0) { # we're in process 1 # tie to hashTable... tie(%hashTable, 'IPC::Shareable', "glue", {%childShareOpts} ) || die "Failed to tie from process 1"; my $count = 0; while (1) { (tied %hashTable)->shlock(); $hashTable{$count++ . " - proc 1"} = "proc 1"; print "proc 1: " . Dumper(\%hashTable); (tied %hashTable)->shunlock(); sleep(2); } } if (fork() == 0) { # we're in proces 2 # tie to hashTable... tie(%hashTable, 'IPC::Shareable', "glue", {%childShareOpts} ) || die "Failed to tie from process 2"; my $count = 0; while (1) { (tied %hashTable)->shlock(); $hashTable{$count++ . " - proc 2"} = "proc 2"; print "proc 2: " . Dumper(\%hashTable); (tied %hashTable)->shunlock(); sleep(2); } } # do not exit as shared memory will get lost while (1) { sleep(9999); }
Simpan