.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) .\" .\" 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 .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . 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 .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "Sympa::Process 3Sympa" .TH Sympa::Process 3Sympa "2022-11-25" "6.2.70" "sympa 6.2.70" .\" 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" Sympa::Process \- Process of Sympa .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 3 \& use Sympa::Process; \& my $process = Sympa::Process\->instance; \& $process\->init(pidname => \*(Aqsympa\*(Aq); \& \& $process\->daemonize; \& \& $process\->fork; .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" Sympa::Process implements the class to handle process itself of Sympa software. .SS "Signal handling" .IX Subsection "Signal handling" Once Sympa::Process is loaded, \&\f(CW\*(C`SIGCHLD\*(C'\fR signals are captured, and only defunct child processes invoked by \fBfork()\fR method are reaped. .SS "Methods" .IX Subsection "Methods" .IP "instance ( )" 4 .IX Item "instance ( )" \&\fIConstructor\fR. Creates a singleton instance of Sympa::Process object. .Sp Returns: .Sp A new Sympa::Process instance, or \fIundef\fR for failure. .IP "init ( key => value, ... )" 4 .IX Item "init ( key => value, ... )" \&\fIInstance method\fR. \&\s-1TBD.\s0 .IP "daemonize ( )" 4 .IX Item "daemonize ( )" \&\fIInstance method\fR. Daemonizes process itself. Process is given new process group, detached from \s-1TTY\s0 and given new process \s-1ID.\s0 .Sp Parameters: .Sp None. .Sp Returns: .Sp None. .ie n .IP "fork ( [ $tag ] )" 4 .el .IP "fork ( [ \f(CW$tag\fR ] )" 4 .IX Item "fork ( [ $tag ] )" \&\fIInstance method\fR. Forks process. Note that this method should be used instead of \fBfork()\fR in Perl core. .Sp Parameter: .RS 4 .ie n .IP "$tag" 4 .el .IP "\f(CW$tag\fR" 4 .IX Item "$tag" A string to determine new child process. By default the name of calling process. .RE .RS 4 .Sp Returns: .Sp See \*(L"fork\*(R" in perlfunc. .RE .IP "reap_child ( [ blocking => 1 ] )" 4 .IX Item "reap_child ( [ blocking => 1 ] )" \&\s-1DEPRECATED.\s0 .IP "wait_child ( )" 4 .IX Item "wait_child ( )" \&\fIInstance method\fR. Waits for any child process. .Sp Parameters: .Sp None. .Sp Returns: .Sp \&\f(CW0\fR. Returns \f(CW\*(C`\-1\*(C'\fR on failure. .IP "sync_child ( [ hash => \e%hash ], [ file => 1 ] )" 4 .IX Item "sync_child ( [ hash => %hash ], [ file => 1 ] )" Updates process information in external data. .Sp Parameters: .RS 4 .IP "hash => \e%hash" 4 .IX Item "hash => %hash" Syncs PIDs in local map \f(CW%hash\fR .IP "file => 1" 4 .IX Item "file => 1" Syncs child PIDs in \s-1PID\s0 file. If dead \s-1PID\s0 is found, notification will be sent to super-listmaster. .RE .RS 4 .Sp Returns: .Sp None. .RE .ie n .IP "remove_pid ([ pid => $pid ], [ final => 1 ] )" 4 .el .IP "remove_pid ([ pid => \f(CW$pid\fR ], [ final => 1 ] )" 4 .IX Item "remove_pid ([ pid => $pid ], [ final => 1 ] )" \&\fIInstance method\fR. Removes process \s-1ID\s0 from \s-1PID\s0 file. Then if the file is empty, it will be removed. .ie n .IP "write_pid ( [ initial => 1 ], [ pid => $pid ] )" 4 .el .IP "write_pid ( [ initial => 1 ], [ pid => \f(CW$pid\fR ] )" 4 .IX Item "write_pid ( [ initial => 1 ], [ pid => $pid ] )" \&\fIInstance method\fR. Writes or adds process \s-1ID\s0 to \s-1PID\s0 file. .Sp Parameters: .RS 4 .IP "initial => 1" 4 .IX Item "initial => 1" Initializes \s-1PID\s0 file. If the file remains, notification will be sent to super-listmaster. .ie n .IP "pid => $pid" 4 .el .IP "pid => \f(CW$pid\fR" 4 .IX Item "pid => $pid" Process \s-1ID\s0 to be written. By default \s-1PID\s0 of current process. .RE .RS 4 .RE .IP "direct_stderr_to_file ( )" 4 .IX Item "direct_stderr_to_file ( )" \&\fIInstance method\fR. \&\s-1TBD.\s0 .SS "Attributes" .IX Subsection "Attributes" Sympa::Process instance may have following attributes: .IP "{children}" 4 .IX Item "{children}" Hashref with child PIDs forked by \fBfork()\fR method as keys. .IP "{detached}" 4 .IX Item "{detached}" True value is set if \fBdaemonize()\fR method was called and the process has been detached from \s-1TTY.\s0 .IP "{generation}" 4 .IX Item "{generation}" Generation of process. If \fBfork()\fR method succeeds, it will be increased by child process. .SS "Utility functions" .IX Subsection "Utility functions" .ie n .IP "eval_in_time ( $subref, $timeout )" 4 .el .IP "eval_in_time ( \f(CW$subref\fR, \f(CW$timeout\fR )" 4 .IX Item "eval_in_time ( $subref, $timeout )" Evaluate subroutine \f(CW$subref\fR in \f(CW$timeout\fR seconds. .Sp \&\s-1TBD.\s0 .IP "register_handler ( )" 4 .IX Item "register_handler ( )" Registers \f(CW\*(C`SIGCHLD\*(C'\fR handler. This function is usually called automatically during initialization. .SH "HISTORY" .IX Header "HISTORY" Sympa::Tools::Daemon appeared on Sympa 6.2a.41. .PP Renamed Sympa::Process appeared on Sympa 6.2.12 and began to provide \s-1OO\s0 interface. .PP Sympa 6.2.13 introduced \fBdaemonize()\fR method and {detached} attribute. .PP As of Sympa 6.2.14, \f(CW\*(C`SIGCHLD\*(C'\fR signal was captured and child processes were reaped immediately. \fBreap_child()\fR method (formerly \fBreaper()\fR) was deprecated.