HOME


Mini Shell 1.0
Redirecting to https://devs.lapieza.net/iniciar-sesion Redirecting to https://devs.lapieza.net/iniciar-sesion.
DIR: /proc/1780863/root/usr/share/doc/libhtml-template-perl/examples/
Upload File :
Current File : //proc/1780863/root/usr/share/doc/libhtml-template-perl/examples/clean_shm.pl
#!/usr/bin/perl
use strict;
use warnings;

# this script deletes all shared memory segments accessible by the
# running user.  Probably only works on Linux systems.

open(IPCS, 'ipcs |') or die "Probs opening icps : $!";

my $mode = 0;
while (<IPCS>) {
    if (/(Shared)|(Semaphore)|(Message)/) {
        $mode++;
        next;
    }
    next unless /^0x[0-9a-f]+\s(\d+)\s.*$/;
    system("ipcrm shm $1") if ($mode == 1);
    system("ipcrm sem $1") if ($mode == 2);
    system("ipcrm msg $1") if ($mode == 3);
}