Olivier Daudel wrote: > Dave Anderson <anderson@xxxxxxxxxx> a écrit : > > > Olivier Daudel wrote: > > > >> Hi Dave, > >> I think we have an other small problem with sig : > >> > >> crash> sig > >> PID: 14836 TASK: f7d89020 CPU: 1 COMMAND: "crash" > >> SIGPENDING: no > >> SIGNAL: 0000000000000000 > >> BLOCKED: 0000000000000000 > >> SIGNAL_STRUCT: c1e7ae00 COUNT: 1 > >> SIG SIGACTION HANDLER MASK FLAGS [1] f5129804 817af58 > >> 0000000000000001 10000000 (SA_RESTART) > >> [...] > >> [63] f5129cdc SIG_DFL 0000000000000000 0 SIGQUEUE: (empty) > >> > >> The last slot should be 64 ? > >> > > > > I might be missing something, as I'm not particularly clear on this one. > > In 2.4 kernels, SIGRTMAX was: > > > > #define SIGRTMAX (_NSIG-1) > > > > and now in 2.6.17 I see this: > > > > #define SIGRTMAX _NSIG > > > > But SIGRTMAX is rarely used, and I don't see how a signal "64" can fit > > into a sigset_t. > > > > Dave > > > > > I think there is no problem with signal 64 (SIGRTMAX with 2.6) and sigset_t. > SIGHUP (signal 1) use bit 0, so bit 63 is used by signal 64. > > This new patch try to take care of 2.4 and 2.6. > > A sample of the new service : > crash> sig -s 8000FFFF1111001F > SIGHUP SIGINT SIGQUIT SIGILL SIGTRAP SIGCHLD SIGTTIN SIGXFSZ SIGIO SIGRTMIN+1 > SIGRTMIN+2 SIGRTMIN+3 SIGRTMIN+4 SIGRTMIN+5 SIGRTMIN+6 SIGRTMIN+7 SIGRTMIN+8 > SIGRTMIN+9 SIGRTMIN+10 SIGRTMIN+11 SIGRTMIN+12 SIGRTMIN+13 SIGRTMIN+14 > SIGRTMIN+15 SIGRTMIN+16 SIGRTMAX > > Olivier > > ================================================================== > --- crash-4.0-3.2/task.c 2006-08-25 23:55:20.000000000 +0200 > +++ crash-4.0-3.2-patch/task.c 2006-09-01 18:46:02.000000000 +0200 > @@ -50,6 +50,7 @@ > static void task_struct_member(struct task_context *,ulong,struct > reference *); > static void signal_reference(struct task_context *, ulong, struct > reference *); > static void dump_signal_data(struct task_context *); > +static int sigrt_minmax(int *, int*); > static void signame_list(void); > static ulonglong task_signal(ulong); > static ulonglong task_blocked(ulong); > @@ -5518,6 +5519,9 @@ > #define _NSIG_BPW machdep->bits > #define _NSIG_WORDS (_NSIG / _NSIG_BPW) > > +#undef SIGRTMIN > +#define SIGRTMIN 32 > + > static struct signame { > char *name; > char *altname; > @@ -5553,16 +5557,41 @@ > /* 28 */ {"SIGWINCH", NULL}, > /* 29 */ {"SIGIO", "SIGPOLL"}, > /* 30 */ {"SIGPWR", NULL}, > - /* 31 */ {"SIGSYS", NULL}, > + /* 31 */ {"SIGSYS", "SIGUNUSED"}, > {NULL, NULL}, /* Real time signals start here. */ > }; > > +static int > +sigrt_minmax(int *min, int*max) { > + int sigrtmax,j; > + sigrtmax= (kt->kernel_version[1] <5) ? _NSIG - 1 : _NSIG ; > + if(min != NULL && max !=NULL) { > + j=sigrtmax-SIGRTMIN-1; > + *max=j / 2; > + *min = j - *max; > + } > + return sigrtmax; > +} > + > static void > signame_list(void) > { > - int i; > + int i,sigrtmax,j,min,max; > > - for (i = 0; i < _NSIG; i++) { > + sigrtmax = sigrt_minmax(&min, &max); > + j=1; > + for (i = 1; i <= sigrtmax; i++) { > + if (i == SIGRTMIN || i == sigrtmax){ > + fprintf(fp, "[%d] %s", i , (i== SIGRTMIN) ? > "SIGRTMIN" : "SIGRTMAX"); > + } else if (i > SIGRTMIN) { > + if( j<= min){ > + fprintf(fp, "[%d] %s%d", i , "SIGRTMIN+",j); > + j++; > + } else if (max >=1) { > + fprintf(fp, "[%d] %s%d", i , "SIGRTMAX-",max); > + max--; > + } > + } else { > if (!signame[i].name) > continue; > > @@ -5570,6 +5599,7 @@ > i, signame[i].name); > if (signame[i].altname) > fprintf(fp, "/%s", signame[i].altname); > + } > fprintf(fp, "\n"); > } > } > @@ -5580,7 +5610,7 @@ > static void translate_sigset(ulonglong sigset) > { > - int i, c, bit, len; > + int sigrtmax, min, max, i, j, c, len; > ulonglong mask, sig; > char buf[BUFSIZE]; > > @@ -5590,13 +5620,21 @@ > } > > len = 0; > - > - for (i = c = 0; i < (_NSIG/2); i++) { > - mask = (ulong)(1) << i; > - if ((sig = (sigset & mask))) { > - bit = ffs((int)sig); > + sigrtmax= sigrt_minmax(&min, &max); > + j=1; > + for (i =1, c = 0; i <= sigrtmax; i++) { > + if (sigset & (ulonglong)1) { > + if (i == SIGRTMIN || i == sigrtmax) > sprintf(buf, "%s%s", c++ ? " " : "", - > signame[bit].name); > + (i==SIGRTMIN) ? "SIGRTMIN" : > "SIGRTMAX"); > + else if (i > SIGRTMIN) { > + if( j <= min) > + sprintf(buf, "%s%s%d", c++ ? " > " : "", "SIGRTMIN+",j); > + else if (max >= 1) > + sprintf(buf, "%s%s%d", c++ ? " > " : "", "SIGRTMAX-",max); > + } else > + sprintf(buf, "%s%s", c++ ? " " : "", + > signame[i].name); > if ((len + strlen(buf)) > 80) { > shift_string_left(buf, 1); > fprintf(fp, "\n"); > @@ -5605,6 +5643,13 @@ > len += strlen(buf); > fprintf(fp, buf); > } > + sigset>>=1; > + if (i > SIGRTMIN ) { > + if (j <= min) + j++; > + else if (max >= 1) > + max--; > + } > } > fprintf(fp, "\n"); > } > @@ -5747,7 +5792,7 @@ > static void > dump_signal_data(struct task_context *tc) > { > - int i, others, use_sighand; > + int i, sigrtmax, others, use_sighand; > int translate, sig, sigpending; > uint ti_flags; > ulonglong sigset, blocked, mask; > @@ -5826,8 +5871,8 @@ > use_sighand = TRUE; > } else > use_sighand = FALSE; > - > - for (i = 1; i < _NSIG; i++) { > + sigrtmax=sigrt_minmax(NULL,NULL); > + for (i = 1; i <=sigrtmax; i++) { > fprintf(fp, "%s[%d] ", i < 10 ? " " : "", i); > > if (use_sighand) { > > ---------------------------------------------------------------- > Ce message a ete envoye par IMP, grace a l'Universite Paris 10 Nanterre > > -- > Crash-utility mailing list > Crash-utility@xxxxxxxxxx > https://www.redhat.com/mailman/listinfo/crash-utility Olivier, I believe both of your sig command patches are supposed to be the same (?), but I cannot utilize either of them. I have unsuccessfully tried to fix them, but for some reason, something in your mailer (or mine?) is destroying parts of the patch. I don't usually see this type of problem with other patch postings to the crash-utility list, but whenever you send one, it typically needs fixing up. Can you send the sig patch file as an attached file, directly to me? Thanks, Dave -- Crash-utility mailing list Crash-utility@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/crash-utility