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 sigset_t and signal 64 :
SIGHUP (signal 1) use bit 0, so SIGRTMAX (when it is _NSIG or 64) use bit
63.
A sample of the new result :
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
This new patch try to take care of 2.4 and 2.6
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) {
--
Crash-utility mailing list
Crash-utility@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/crash-utility