shared pending signal queue added to sig command

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Dave,
This patch adds the shared pending signal queue to the private pending signal queue.
With the following small variation on procsig.c, we get this result:
============================================================
crash> sig 5747
PID: 5747   TASK: f7827020  CPU: 1   COMMAND: "procsig"
SIGNAL_STRUCT: f7d71380  COUNT: 1
SIG SIGACTION  HANDLER       MASK       FLAGS
[1]  f7833384  SIG_DFL 0000000000000000 0
[...]
[64]  f7833870  804867a 0000000000000000 0
SIGPENDING: no
   SIGNAL: 0000000200000800
  BLOCKED: 8000000200000800
SIGQUEUE:  SIG  SIGINFO
           12  f4d74ed4
           34  f4d74e40
SHARED_PENDING
   SIGNAL: 8000000000000800
SIGQUEUE:  SIG  SIGINFO
           12  f4d74060
           64  f4d740f4
           64  f4d74188
============================================================

#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include <linux/unistd.h>

#ifndef GETTID
pid_t gettid(void) {return syscall(__NR_gettid);}
#endif
#ifndef TKILL
int tkill(pid_t tid, int sig) {return syscall (__NR_tkill,tid,sig); }
#endif

void sigusr2(int sig, siginfo_t *sp, void *uc)
{
}

void sigcatch()
{
       struct sigaction sa;
       sigemptyset(&sa.sa_mask);
       sa.sa_flags = 0 ; //SA_SIGINFO;
       sa.sa_sigaction = sigusr2;
       if (sigaction(SIGUSR2, &sa, NULL)==-1) {
               perror("sigaction() - SIGUSR2"); exit(1);
       }
       if (sigaction(SIGRTMIN, &sa, NULL)==-1) {
               perror("sigaction() - SIGRTMIN"); exit(1);
       }
       if (sigaction(SIGRTMAX, &sa, NULL)==-1) {
               perror("sigaction() - SIGRTMAX"); exit(1);
       }
}
void sig_block()
{
       sigset_t set;
       sigemptyset(&set);
       sigaddset(&set, SIGUSR2);
       sigaddset(&set, SIGRTMIN);
       sigaddset(&set, SIGRTMAX);
       if (sigprocmask(SIG_SETMASK, &set,NULL) == -1) {
               perror("sigprocmask()"); exit(1);
       }
}
void sig_send() {
       if(tkill(gettid(), SIGUSR2)==-1){
               perror("tkill()"); exit(1);
       }
       if(tkill(gettid(), SIGRTMIN)==-1){
               perror("tkill()"); exit(1);
       }
       if(kill(getpid(), SIGUSR2)==-1){
               perror("tkill()"); exit(1);
       }
       if(kill(getpid(), SIGRTMAX)==-1){
               perror("tkill()"); exit(1);
       }
       if(kill(getpid(), SIGRTMAX)==-1){
               perror("tkill()"); exit(1);
       }
}


main(int argc)
{
   sigcatch();
   sig_block();
   sig_send();

   pause();
}

Attachment: sig2.patch
Description: Binary data

--
Crash-utility mailing list
Crash-utility@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/crash-utility

[Index of Archives]     [Fedora Development]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]     [Fedora Tools]

 

Powered by Linux