Implement the "wait" checkpoint action.

This action instructs tar to pause until given signal is delivered.
The newer genfile tool uses this action for communication between
genfile and tar in exec mode. This eliminates race conitions and
speeds up the tests based on exec mode.

* doc/tar.texi: Document changes.
* paxutils: Upgrade.
* src/checkpoint.c: Implement the wait action.
* src/common.h (decode_signal): New proto.
* src/tar.c (decode_signal): New function.
(set_stat_signal): Rewrite.
* tests/dirrem01.at: Adjust genfile and tar command line arguments
to use the new feature.
* tests/dirrem02.at: Likewise.
* tests/filerem01.at: Likewise.
* tests/filerem02.at: Likewise.
* tests/grow.at: Likewise.
* tests/sptrcreat.at: Likewise.
* tests/sptrdiff00.at: Likewise.
* tests/sptrdiff01.at: Likewise.
* tests/truncate.at: Likewise.
This commit is contained in:
Sergey Poznyakoff
2018-12-28 13:17:44 +02:00
parent c15c42ccd1
commit e7cd377f78
14 changed files with 111 additions and 58 deletions

View File

@@ -2553,6 +2553,12 @@ Wait for @var{time} seconds.
@item ttyout=@var{string}
Output @var{string} on the current console (@file{/dev/tty}).
@item totals
Print statistics (see @pxref{totals}).
@item wait=@var{signo}
Wait for signal @var{signo}.
@end table
Several @option{--checkpoint-action} options can be specified. The
@@ -4452,6 +4458,25 @@ checkpoint:
$ @kbd{tar -c --checkpoint=1000 --checkpoint-action=sleep=30}
@end smallexample
@anchor{checkpoint wait}
@cindex @code{wait}, checkpoint action
The @code{wait=@var{signo}} action stops further execution until the
signal @var{signo} is delivered. Valid values for @var{signo} are:
@code{SIGHUP}, @code{SIGQUIT}, @code{SIGINT}, @code{SIGUSR1} and
@code{SIGUSR2}. The @samp{SIG} prefix is optional. For example:
@example
$ @kbd{tar -c -f arc --checkpoint=1000 --checkpoint-action wait=USR1 .}
@end example
In this example, @GNUTAR{} will stop archivation at each 1000th
checkpoint. wait until the @samp{SIGUSR1} signal is delivered,
and resume processing.
This action is used by the @command{genfile} utility to perform
modifications on the input files upon hitting certain checkpoints
(@pxref{Exec Mode, genfile}).
@anchor{checkpoint exec}
@cindex @code{exec}, checkpoint action
Finally, the @code{exec} action executes a given external command.