commande sig

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

 



Hi Dave and Jeff
I hope this one will be correct.
Olivier.

----------------------------------------------------------------
Ce message a ete envoye par IMP, grace a l'Universite Paris 10 Nanterre


--- 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

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

 

Powered by Linux