Name
SPVM::Sys::Signal - Signal System Call
Usage
use Sys::Signal;
use Sys::Signal::Constant as SIGNAL;
Sys::Signal->raise(SIGNAL->SIGTERM);
Sys::Signal->kill($process_id, SIGNAL->SIGINT);
my $old_signal_handler = Sys::Signal->signal(SIGNAL->SIGTERM, Sys::Signal->SIG_IGN);
Description
Sys::Signal
provides the methods to call the system call for the signal.
Class Methods
raise
static method raise : int ($sig : int)
The raise() function sends a signal to the calling process or thread.
See raise(3) - Linux man page in Linux.
Constant values specified in $sig
is defined in Sys::Signal::Constant.
kill
static method kill : int ($pid : int, $sig : int)
The kill() system call can be used to send any signal to any process group or process.
See the kill(2) - Linux man page in Linux.
See Sys::Signal::Constant about the signal numbers specified by $sig
Constant values specified in $sig
is defined in Sys::Signal::Constant.
alarm
static method alarm : int ($seconds : int)
alarm() arranges for a SIGALRM signal to be delivered to the calling process in seconds seconds.
See alarm(2) - Linux man page in Linux.
ualarm
static method ualarm : int ($usecs : int, $interval : int)
The ualarm() function causes the signal SIGALRM to be sent to the invoking process after (not less than) usecs microseconds. The delay may be lengthened slightly by any system activity or by the time spent processing the call or by the granularity of system timers.
See ualarm(3) - Linux man page in Linux.
signal
static method signal : Sys::Signal::Handler ($signum : int, $handler : Sys::Signal::Handler);
signal() sets the disposition of the signal signum to handler.
See signal(2) - Linux man page in Linux.
Constant values specified in $signum
is defined in Sys::Signal::Constant.
Exceptions:
$handler must be defined. Otherwise an exception is thrown.
signal_go
static method signal_go : Sys::Signal::Handler ($signum : int);
signal() sets the disposition of the signal signum to "SIG_GO" handler. This must not be used except for Go::OS::Signal.
Returns the old signal handler.
SIG_DFL
static method SIG_DFL : L<Sys::Signal::Handler|SPVM::Sys::Signal::Handler> ()
Creates a new signal handler that represents SIG_DFL
.
SIG_IGN
static method SIG_IGN : L<Sys::Signal::Handler|SPVM::Sys::Signal::Handler> ();
Creates a new signal handler that represents SIG_IGN
.
SIG_GO
static method SIG_GO : L<Sys::Signal::Handler|SPVM::Sys::Signal::Handler> ();
Creates a new signal handler that represents the signal handler for Go::OS::Signal.
SET_SIG_GO_WRITE_FD
static method SET_SIG_GO_WRITE_FD : void ();
Set a write file descriptor for Go::OS::Signal. This must not be used except for Go::OS::Signal.
Copyright & License
Copyright (c) 2023 Yuki Kimoto
MIT License