This was previously 128KiB and increasing to 256KiB was seen to increase
throughput by 10-20% when reading cached files on modern systems.
+ env,kill,timeout now support unnamed signals. kill(1) for example now
+ supports sending such signals, and env(1) will list them appropriately.
+
SELinux operations in file copy operations are now more efficient,
avoiding unneeded MCS/MLS label translation.
static void
parse_signal_action_params (char const *arg, bool set_default)
{
- char signame[SIG2STR_MAX];
char *opt_sig;
char *optarg_writable;
Some signals cannot be set to ignore or default (e.g., SIGKILL,
SIGSTOP on most OSes, and SIGCONT on AIX.) - so ignore errors. */
for (int i = 1 ; i <= SIGNUM_BOUND; i++)
- if (sig2str (i, signame) == 0)
- signals[i] = set_default ? DEFAULT_NOERR : IGNORE_NOERR;
+ signals[i] = set_default ? DEFAULT_NOERR : IGNORE_NOERR;
return;
}
opt_sig = strtok (optarg_writable, ",");
while (opt_sig)
{
- int signum = operand2sig (opt_sig, signame);
+ int signum = operand2sig (opt_sig);
/* operand2sig accepts signal 0 (EXIT) - but we reject it. */
if (signum == 0)
error (0, 0, _("%s: invalid signal"), quote (opt_sig));
if (dev_debug)
{
char signame[SIG2STR_MAX];
- sig2str (i, signame);
+ if (sig2str (i, signame) != 0)
+ snprintf (signame, sizeof signame, "SIG%d", i);
devmsg ("Reset signal %s (%d) to %s%s\n",
signame, i,
set_to_default ? "DEFAULT" : "IGNORE",
static void
parse_block_signal_params (char const *arg, bool block)
{
- char signame[SIG2STR_MAX];
char *opt_sig;
char *optarg_writable;
opt_sig = strtok (optarg_writable, ",");
while (opt_sig)
{
- int signum = operand2sig (opt_sig, signame);
+ int signum = operand2sig (opt_sig);
/* operand2sig accepts signal 0 (EXIT) - but we reject it. */
if (signum == 0)
error (0, 0, _("%s: invalid signal"), quote (opt_sig));
if (signum <= 0)
usage (exit_failure);
- sigaddset (block ? &block_signals : &unblock_signals, signum);
- sigdelset (block ? &unblock_signals : &block_signals, signum);
+ if (sigaddset (block ? &block_signals : &unblock_signals, signum) == -1)
+ {
+ if (block)
+ error (EXIT_CANCELED, errno,
+ _("failed to block signal %d"), signum);
+ /* else diagnosed in parse_signal_action_params(). */
+ }
+ else
+ sigdelset (block ? &unblock_signals : &block_signals, signum);
opt_sig = strtok (nullptr, ",");
}
if (dev_debug && debug_act)
{
char signame[SIG2STR_MAX];
- sig2str (i, signame);
+ if (sig2str (i, signame) != 0)
+ snprintf (signame, sizeof signame, "SIG%d", i);
devmsg ("signal %s (%d) mask set to %s\n",
signame, i, debug_act);
}
if (! *ignored && ! *blocked)
continue;
- sig2str (i, signame);
+ if (sig2str (i, signame) != 0)
+ snprintf (signame, sizeof signame, "SIG%d", i);
fprintf (stderr, "%-10s (%2d): %s%s%s\n", signame, i,
blocked, connect, ignored);
}
if (argv)
for (; *argv; argv++)
{
- signum = operand2sig (*argv, signame);
+ signum = operand2sig (*argv);
if (signum < 0)
status = EXIT_FAILURE;
else
- print_table_row (num_width, signum, name_width, signame);
+ {
+ if (sig2str (signum, signame) != 0)
+ snprintf (signame, sizeof signame, "SIG%d", signum);
+ print_table_row (num_width, signum, name_width, signame);
+ }
}
else
for (signum = 1; signum <= SIGNUM_BOUND; signum++)
if (argv)
for (; *argv; argv++)
{
- signum = operand2sig (*argv, signame);
+ signum = operand2sig (*argv);
if (signum < 0)
status = EXIT_FAILURE;
- else
+ else if (ISDIGIT (**argv))
{
- if (ISDIGIT (**argv))
+ if (sig2str (signum, signame) == 0)
puts (signame);
else
printf ("%d\n", signum);
}
+ else
+ printf ("%d\n", signum);
}
else
for (signum = 1; signum <= SIGNUM_BOUND; signum++)
}
else if (kill (pid, signum) != 0)
{
- error (0, errno, "%s", quote (arg));
+ if (errno == EINVAL)
+ error (0, errno, "%d", signum);
+ else
+ error (0, errno, "%s", quote (arg));
status = EXIT_FAILURE;
}
}
bool list = false;
bool table = false;
int signum = -1;
- char signame[SIG2STR_MAX];
initialize_main (&argc, &argv);
set_program_name (argv[0]);
error (0, 0, _("%s: multiple signals specified"), quote (optarg));
usage (EXIT_FAILURE);
}
- signum = operand2sig (optarg, signame);
+ signum = operand2sig (optarg);
if (signum < 0)
usage (EXIT_FAILURE);
break;
FIXME: Move this to gnulib/str2sig.c */
-/* Convert OPERAND to a signal number with printable representation SIGNAME.
- Return the signal number, or -1 if unsuccessful. */
+/* Convert OPERAND to a signal number. Return the signal number, or -1 if
+ unsuccessful. */
#include <config.h>
#include <stdio.h>
#include "operand2sig.h"
extern int
-operand2sig (char const *operand, char *signame)
+operand2sig (char const *operand)
{
int signum;
free (upcased);
}
- if (signum < 0 || sig2str (signum, signame) != 0)
+ if (0 > signum || signum > SIGNUM_BOUND)
{
error (0, 0, _("%s: invalid signal"), quote (operand));
return -1;
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */
-extern int operand2sig (char const *operand, char *signame)
+extern int operand2sig (char const *operand)
_GL_ATTRIBUTE_NONNULL ();
main (int argc, char **argv)
{
double timeout;
- char signame[SIG2STR_MAX];
int c;
initialize_main (&argc, &argv);
break;
case 's':
- term_signal = operand2sig (optarg, signame);
+ term_signal = operand2sig (optarg);
if (term_signal == -1)
usage (EXIT_CANCELED);
break;
# along with this program. If not, see <https://www.gnu.org/licenses/>.
. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
-print_ver_ kill
+print_ver_ kill seq
# params required
returns_ 1 env kill || fail=1
returns_ 1 env kill -l -1 0 || fail=1
returns_ 1 env kill -l INVALID TERM || fail=1
+# Verify all signal numbers can be listed
+SIG_LAST_STR=$(env kill -l | tail -n1) || framework_failure_
+SIG_LAST_NUM=$(env kill -l -- "$SIG_LAST_STR") || framework_failure_
+SIG_SEQ=$(env seq -- 0 "$SIG_LAST_NUM") || framework_failure_
+test -n "$SIG_SEQ" || framework_failure_
+env kill -l -- $SIG_SEQ || fail=1
+env kill -t -- $SIG_SEQ || fail=1
+
Exit $fail