summaryrefslogtreecommitdiffstats
path: root/fs/proc
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>1997-12-16 05:34:03 +0000
committerRalf Baechle <ralf@linux-mips.org>1997-12-16 05:34:03 +0000
commit967c65a99059fd459b956c1588ce0ba227912c4e (patch)
tree8224d013ff5d255420713d05610c7efebd204d2a /fs/proc
parente20c1cc1656a66a2773bca4591a895cbc12696ff (diff)
Merge with Linux 2.1.72, part 1.
Diffstat (limited to 'fs/proc')
-rw-r--r--fs/proc/array.c121
-rw-r--r--fs/proc/proc_tty.c4
2 files changed, 74 insertions, 51 deletions
diff --git a/fs/proc/array.c b/fs/proc/array.c
index 4e22dfa16..88d10d2bc 100644
--- a/fs/proc/array.c
+++ b/fs/proc/array.c
@@ -48,6 +48,7 @@
#include <linux/swap.h>
#include <linux/slab.h>
#include <linux/smp.h>
+#include <linux/signal.h>
#include <asm/uaccess.h>
#include <asm/pgtable.h>
@@ -664,37 +665,60 @@ static inline char * task_mem(struct task_struct *p, char *buffer)
return buffer;
}
-static inline char * task_sig(struct task_struct *p, char *buffer)
+char * render_sigset_t(sigset_t *set, char *buffer)
{
- buffer += sprintf(buffer,
- "SigPnd:\t%08lx\n"
- "SigBlk:\t%08lx\n",
- p->signal, p->blocked);
+ int i = _NSIG, x;
+ do {
+ i -= 4, x = 0;
+ if (sigismember(set, i+1)) x |= 1;
+ if (sigismember(set, i+2)) x |= 2;
+ if (sigismember(set, i+3)) x |= 4;
+ if (sigismember(set, i+4)) x |= 8;
+ *buffer++ = (x < 10 ? '0' : 'a' - 10) + x;
+ } while (i >= 4);
+ *buffer = 0;
+ return buffer;
+}
+
+static void collect_sigign_sigcatch(struct task_struct *p, sigset_t *ign,
+ sigset_t *catch)
+{
+ struct k_sigaction *k;
+ int i;
+
+ sigemptyset(ign);
+ sigemptyset(catch);
+
if (p->sig) {
- struct sigaction * action = p->sig->action;
- unsigned long sig_ign = 0, sig_caught = 0;
- unsigned long bit = 1;
- int i;
-
- for (i = 0; i < 32; i++) {
- switch((unsigned long) action->sa_handler) {
- case 0:
- break;
- case 1:
- sig_ign |= bit;
- break;
- default:
- sig_caught |= bit;
- }
- bit <<= 1;
- action++;
+ k = p->sig->action;
+ for (i = 1; i <= _NSIG; ++i, ++k) {
+ if (k->sa.sa_handler == SIG_IGN)
+ sigaddset(ign, i);
+ else if (k->sa.sa_handler != SIG_DFL)
+ sigaddset(catch, i);
}
-
- buffer += sprintf(buffer,
- "SigIgn:\t%08lx\n"
- "SigCgt:\t%08lx\n",
- sig_ign, sig_caught);
}
+}
+
+static inline char * task_sig(struct task_struct *p, char *buffer)
+{
+ sigset_t ign, catch;
+
+ buffer += sprintf(buffer, "SigPnd:\t");
+ buffer = render_sigset_t(&p->signal, buffer);
+ *buffer++ = '\n';
+ buffer += sprintf(buffer, "SigBlk:\t");
+ buffer = render_sigset_t(&p->blocked, buffer);
+ *buffer++ = '\n';
+
+ collect_sigign_sigcatch(p, &ign, &catch);
+ buffer += sprintf(buffer, "SigIgn:\t");
+ buffer = render_sigset_t(&ign, buffer);
+ *buffer++ = '\n';
+ buffer += sprintf(buffer, "SigCat:\t");
+ buffer = render_sigset_t(&catch, buffer);
+ *buffer++ = '\n';
+
return buffer;
}
@@ -715,10 +739,14 @@ static int get_status(int pid, char * buffer)
static int get_stat(int pid, char * buffer)
{
struct task_struct *tsk = find_task_by_pid(pid);
- unsigned long sigignore=0, sigcatch=0, wchan;
- unsigned long vsize, eip, esp;
+ unsigned long vsize, eip, esp, wchan;
long priority, nice;
- int i,tty_pgrp;
+ 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;
if (!tsk)
@@ -737,22 +765,15 @@ static int get_stat(int pid, char * buffer)
eip = KSTK_EIP(tsk);
esp = KSTK_ESP(tsk);
}
+
wchan = get_wchan(tsk);
- if (tsk->sig) {
- unsigned long bit = 1;
- for(i=0; i<32; ++i) {
- switch((unsigned long) tsk->sig->action[i].sa_handler) {
- case 0:
- break;
- case 1:
- sigignore |= bit;
- break;
- default:
- sigcatch |= bit;
- }
- bit <<= 1;
- }
- }
+
+ 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;
else
@@ -767,7 +788,7 @@ static int get_stat(int pid, char * buffer)
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 %lu %lu %lu %lu %lu %lu %lu\n",
+%lu %s %s %s %s %lu %lu %lu\n",
pid,
tsk->comm,
state,
@@ -798,10 +819,10 @@ static int get_stat(int pid, char * buffer)
tsk->mm ? tsk->mm->start_stack : 0,
esp,
eip,
- tsk->signal,
- tsk->blocked,
- sigignore,
- sigcatch,
+ signal_str,
+ blocked_str,
+ sigign_str,
+ sigcatch_str,
wchan,
tsk->nswap,
tsk->cnswap);
diff --git a/fs/proc/proc_tty.c b/fs/proc/proc_tty.c
index 470b7bffb..9523ff9f0 100644
--- a/fs/proc/proc_tty.c
+++ b/fs/proc/proc_tty.c
@@ -49,8 +49,10 @@ static int tty_drivers_read_proc(char *page, char **start, off_t off,
case TTY_DRIVER_TYPE_SYSTEM:
if (p->subtype == SYSTEM_TYPE_TTY)
type = "system:/dev/tty";
- else if (p->subtype == SYSTEM_TYPE_CONSOLE)
+ else if (p->subtype == SYSTEM_TYPE_SYSCONS)
type = "system:console";
+ else if (p->subtype == SYSTEM_TYPE_CONSOLE)
+ type = "system:vtmaster";
else
type = "system";
break;