.B kill
.RB [ \-s
.IR signal | \fB\-p\fP ]
+.RB [ \-q
+.IR sigval ]
.RN [ \-a ]
.RB [ \-\- ]
.IR pid ...
.B kill
should only print the process id (pid)
of the named processes, and not send any signals.
+.TP
+.BI \-q " sigval"
+Use
+.BR sigqueue (2)
+rather than
+.BR kill (2)
+and the sigval argument is used to specify an integer to be sent with the
+signal. If the receiving process has installed a handler for this signal using
+the SA_SIGINFO flag to
+.BR sigaction (2),
+then it can obtain this data via the si_value field of the siginfo_t structure.
.SH "SEE ALSO"
.BR bash (1),
.BR tcsh (1),
#include "c.h"
#include "kill.h"
#include "nls.h"
+#include "strutils.h"
struct signv {
char *name;
static char *progname;
+#ifdef HAVE_SIGQUEUE
+static int use_sigval;
+static union sigval sigdata;
+#endif
+
int main (int argc, char *argv[])
{
int errors, numsig, pid;
}
continue;
}
+ if (! strcmp (arg, "-q")) {
+ if (argc < 2)
+ return usage (1);
+ argc--, argv++;
+ arg = *argv;
+#ifdef HAVE_SIGQUEUE
+ sigdata.sival_int = strtol_or_err(arg, _("failed to parse sigval"));
+ use_sigval = 1;
+#endif
+ continue;
+ }
/* `arg' begins with a dash but is not a known option.
so it's probably something like -HUP, or -1/-n
try to deal with it.
int kill_verbose (char *procname, int pid, int sig)
{
+ int rc;
+
if (sig < 0) {
printf ("%d\n", pid);
return 0;
}
- if (kill (pid, sig) < 0) {
+#ifdef HAVE_SIGQUEUE
+ if (use_sigval)
+ rc = sigqueue(pid, sig, sigdata);
+ else
+#endif
+ rc = kill (pid, sig);
+
+ if (rc < 0) {
fprintf (stderr, "%s ", progname);
perror (procname);
return 1;