[patch] older /proc damage

Albert D. Cahalan (acahalan@cs.uml.edu)
Sat, 27 Jun 1998 13:46:49 -0400 (EDT)


Signal information appears in both /proc/*/stat and /proc/*/status.
Two changes make Linux 2.1 incompatible with Linux 2.0.

/proc/*/stat
When the real-time signals were added, the data in this file
was changed to hex. The latest "fixed" procps shows garbage
for Linux 2.0, while the versions used by most distributions
show garbage for Linux 2.1. (try "ps axs")

/proc/*/status
Linux 2.0 uses "SigCgt" for caught signals. Linux 2.1
uses "SigCat" for caught signals.

Proposed changes:

1. /proc/*/stat is considered obsolete, and will return to
the original behavior.

2. /proc/*/status uses "SigCgt" like Linux 2.0. The data in
this file should be used to get real-time signal information.
(it always was and still is hex)

diff -u --recursive --new-file v2.1.108/fs/proc/array.c linux/fs/proc/array.c
--- v2.1.108/fs/proc/array.c Fri Jun 26 19:09:35 1998
+++ linux/fs/proc/array.c Fri Jun 26 19:25:49 1998
@@ -762,7 +762,7 @@
buffer += sprintf(buffer, "SigIgn:\t");
buffer = render_sigset_t(&ign, buffer);
*buffer++ = '\n';
- buffer += sprintf(buffer, "SigCat:\t");
+ buffer += sprintf(buffer, "SigCgt:\t"); /* Linux 2.0 uses "SigCgt" */
buffer = render_sigset_t(&catch, buffer);
*buffer++ = '\n';

@@ -805,10 +805,6 @@
long priority, nice;
int tty_pgrp;
sigset_t sigign, sigcatch;
- char signal_str[sizeof(sigset_t)*2+1];
- char blocked_str[sizeof(sigset_t)*2+1];
- char sigign_str[sizeof(sigset_t)*2+1];
- char sigcatch_str[sizeof(sigset_t)*2+1];
char state;

read_lock(&tasklist_lock);
@@ -831,10 +827,6 @@
wchan = get_wchan(tsk);

collect_sigign_sigcatch(tsk, &sigign, &sigcatch);
- render_sigset_t(&tsk->signal, signal_str);
- render_sigset_t(&tsk->blocked, blocked_str);
- render_sigset_t(&sigign, sigign_str);
- render_sigset_t(&sigcatch, sigcatch_str);

if (tsk->tty)
tty_pgrp = tsk->tty->pgrp;
@@ -850,7 +842,7 @@

return sprintf(buffer,"%d (%s) %c %d %d %d %d %d %lu %lu \
%lu %lu %lu %lu %lu %ld %ld %ld %ld %ld %ld %lu %lu %ld %lu %lu %lu %lu %lu \
-%lu %s %s %s %s %lu %lu %lu\n",
+%lu %lu %lu %lu %lu %lu %lu %lu\n",
pid,
tsk->comm,
state,
@@ -881,10 +873,14 @@
tsk->mm ? tsk->mm->start_stack : 0,
esp,
eip,
- signal_str,
- blocked_str,
- sigign_str,
- sigcatch_str,
+ /* The signal information here is obsolete.
+ * It must be decimal for Linux 2.0 compatibility.
+ * Use /proc/#/status for real-time signals.
+ */
+ tsk->signal .sig[0] & 0x7fffffffUL,
+ tsk->blocked.sig[0] & 0x7fffffffUL,
+ sigign .sig[0] & 0x7fffffffUL,
+ sigcatch .sig[0] & 0x7fffffffUL,
wchan,
tsk->nswap,
tsk->cnswap);

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu