#!/usr/local/bin/perl -w use strict; # use ExtUtils::testlib; # use Solaris::Procfs qw(:control_codes writectl); # use POSIX qw(:signal_h); use lib '.'; $|++; my $pid; foreach $pid (@ARGV) { # Open the ctl file with a flag of 1, which means write-only. # unless( sysopen FILE, "/proc/$pid/ctl", 1) { warn "Could not open file /proc/$pid/ctl for writing: $!\n"; next; } # Just for fun we hardcode these constants, and avoid using # Solaris::Procfs and POSIX at all. # my $PCKILL = 9; my $SIGCONT = 25; my $PCRUN = 5; my $PCNULL = 0; # Pack the flags into a series of signed long integers # my $flags = pack( "l*", $PCKILL, $SIGCONT, $PCRUN, $PCNULL ); my $length = length $flags; # Now use syswrite to write the flags to the ctl file. # This will start the process again. # syswrite(FILE,$flags,$length); close FILE; }