.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Linux::FD::Signal 3pm" .TH Linux::FD::Signal 3pm 2024-03-07 "perl v5.38.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME Linux::FD::Signal \- Signal filehandles for Linux .SH VERSION .IX Header "VERSION" version 0.016 .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 1 \& use Linux::FD::Signal; \& \& my $fh = Linux::FD::Signal\->new($sigset, @flags); .Ve .SH DESCRIPTION .IX Header "DESCRIPTION" This module creates a filehandle that can be used to accept signals targetted at the caller, similar but not identical to Signal::Pipe. It provides an alternative to conventional signal handlers or \f(CW\*(C`sigwaitinfo\*(C'\fR, with the advantage that the file descriptor may easily be monitored by mechanisms such as \f(CW\*(C`select\*(C'\fR, \f(CW\*(C`poll\*(C'\fR, and \f(CW\*(C`epoll\*(C'\fR. .SH METHODS .IX Header "METHODS" .SS new($sigmask) .IX Subsection "new($sigmask)" The \f(CW$sigmask\fR argument specifies the set of signals that the caller wishes to accept via the file descriptor. This should either be a signal name(without the \f(CW\*(C`SIG\*(C'\fR prefix) or a POSIX::SigSet object. Normally, the set of signals to be received via the file descriptor should be blocked to prevent the signals being handled according to their default dispositions. It is not possible to receive SIGKILL or SIGSTOP signals via a signalfd file descriptor; these signals are silently ignored if specified in \f(CW$sigmask\fR. \f(CW@flags\fR is an optional list of flags, currently limited to \f(CW\*(Aqnon\-blocking\*(Aq\fR (requires Linux 2.6.27). .SS set_mask($sigmask) .IX Subsection "set_mask($sigmask)" Sets the signal mask to a new value. Its argument works exactly the same as \f(CW\*(C`new\*(C'\fR's .SS \fBreceive()\fP .IX Subsection "receive()" If one or more of the signals specified in mask is pending for the process, then it returns the information of one signalfd_siginfo structures (see below) that describe the signals. .PP As a consequence of the receive, the signals are consumed, so that they are no longer pending for the process (i.e., will not be caught by signal handlers, and cannot be accepted using sigwaitinfo). .PP If none of the signals in mask is pending for the process, then the receive either blocks until one of the signals in mask is generated for the process, or fails with the error \f(CW\*(C`EAGAIN\*(C'\fR if the file descriptor has been made non-blocking. .PP The information is returned as a hashref with the following keys: \f(CW\*(C`signo\*(C'\fR, \f(CW\*(C`errno\*(C'\fR, \f(CW\*(C`code\*(C'\fR, \f(CW\*(C`pid\*(C'\fR, \f(CW\*(C`uid\*(C'\fR, \f(CW\*(C`fd\*(C'\fR, \f(CW\*(C`tid\*(C'\fR, \f(CW\*(C`band\*(C'\fR, \f(CW\*(C`overrun\*(C'\fR, \f(CW\*(C`trapno\*(C'\fR, \f(CW\*(C`status\*(C'\fR, \f(CW\*(C`int\*(C'\fR, \f(CW\*(C`ptr\*(C'\fR, \f(CW\*(C`utime\*(C'\fR, \f(CW\*(C`stime\*(C'\fR, \f(CW\*(C`address\*(C'\fR. All of these are returned as integers. Some of them are only useful in certain circumstances, others may not be useful from perl at all. .SH "SEE ALSO" .IX Header "SEE ALSO" Signal::Mask .SH AUTHOR .IX Header "AUTHOR" Leon Timmermans .SH "COPYRIGHT AND LICENSE" .IX Header "COPYRIGHT AND LICENSE" This software is copyright (c) 2010 by Leon Timmermans. .PP This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.