summaryrefslogtreecommitdiffstats
path: root/fs/proc
diff options
context:
space:
mode:
Diffstat (limited to 'fs/proc')
-rw-r--r--fs/proc/array.c22
-rw-r--r--fs/proc/base.c1
-rw-r--r--fs/proc/fd.c1
-rw-r--r--fs/proc/generic.c1
-rw-r--r--fs/proc/kmsg.c1
-rw-r--r--fs/proc/link.c1
-rw-r--r--fs/proc/mem.c1
-rw-r--r--fs/proc/net.c1
-rw-r--r--fs/proc/omirr.c1
-rw-r--r--fs/proc/openpromfs.c3
-rw-r--r--fs/proc/root.c14
-rw-r--r--fs/proc/scsi.c1
12 files changed, 32 insertions, 16 deletions
diff --git a/fs/proc/array.c b/fs/proc/array.c
index cde538846..eeb933628 100644
--- a/fs/proc/array.c
+++ b/fs/proc/array.c
@@ -485,16 +485,18 @@ static unsigned long get_wchan(struct task_struct *p)
return 0;
#if defined(__i386__)
{
- unsigned long ebp, eip;
+ unsigned long ebp, esp, eip;
unsigned long stack_page;
int count = 0;
- stack_page = 4096 + (unsigned long)p;
- if (!stack_page)
+ stack_page = (unsigned long)p;
+ esp = p->tss.esp;
+ if (!stack_page || esp < stack_page || esp >= 8188+stack_page)
return 0;
- ebp = p->tss.ebp;
+ /* include/asm-i386/system.h:switch_to() pushes ebp last. */
+ ebp = *(unsigned long *) esp;
do {
- if (ebp < stack_page || ebp >= 4092+stack_page)
+ if (ebp < stack_page || ebp >= 8188+stack_page)
return 0;
eip = *(unsigned long *) (ebp+4);
if (eip < first_sched || eip >= last_sched)
@@ -543,14 +545,12 @@ static unsigned long get_wchan(struct task_struct *p)
unsigned long fp, pc;
unsigned long stack_page;
int count = 0;
- extern int sys_pause (void);
- stack_page = p->kernel_stack_page;
- if (!stack_page)
- return 0;
+ stack_page = (unsigned long)p;
fp = ((struct switch_stack *)p->tss.ksp)->a6;
do {
- if (fp < stack_page || fp >= 4088+stack_page)
+ if (fp < stack_page+sizeof(struct task_struct) ||
+ fp >= 8184+stack_page)
return 0;
pc = ((unsigned long *)fp)[1];
/* FIXME: This depends on the order of these functions. */
@@ -1414,6 +1414,7 @@ static struct file_operations proc_array_operations = {
NULL, /* array_ioctl */
NULL, /* mmap */
NULL, /* no special open code */
+ NULL, /* flush */
NULL, /* no special release code */
NULL /* can't fsync */
};
@@ -1461,6 +1462,7 @@ static struct file_operations proc_arraylong_operations = {
NULL, /* array_ioctl */
NULL, /* mmap */
NULL, /* no special open code */
+ NULL, /* flush */
NULL, /* no special release code */
NULL /* can't fsync */
};
diff --git a/fs/proc/base.c b/fs/proc/base.c
index edfe8b758..c9b2d8649 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -24,6 +24,7 @@ static struct file_operations proc_base_operations = {
NULL, /* ioctl - default */
NULL, /* mmap */
NULL, /* no special open code */
+ NULL, /* flush */
NULL, /* no special release code */
NULL /* can't fsync */
};
diff --git a/fs/proc/fd.c b/fs/proc/fd.c
index 57f99bfd7..5409e2d67 100644
--- a/fs/proc/fd.c
+++ b/fs/proc/fd.c
@@ -30,6 +30,7 @@ static struct file_operations proc_fd_operations = {
NULL, /* ioctl - default */
NULL, /* mmap */
NULL, /* no special open code */
+ NULL, /* flush */
NULL, /* no special release code */
NULL /* can't fsync */
};
diff --git a/fs/proc/generic.c b/fs/proc/generic.c
index a9b00f1f5..54b16f84b 100644
--- a/fs/proc/generic.c
+++ b/fs/proc/generic.c
@@ -42,6 +42,7 @@ static struct file_operations proc_file_operations = {
NULL, /* ioctl */
NULL, /* mmap */
NULL, /* no special open code */
+ NULL, /* flush */
NULL, /* no special release code */
NULL /* can't fsync */
};
diff --git a/fs/proc/kmsg.c b/fs/proc/kmsg.c
index e21c0cd1c..ff8ec4877 100644
--- a/fs/proc/kmsg.c
+++ b/fs/proc/kmsg.c
@@ -54,6 +54,7 @@ static struct file_operations proc_kmsg_operations = {
NULL, /* kmsg_ioctl */
NULL, /* mmap */
kmsg_open,
+ NULL, /* flush */
kmsg_release,
NULL /* can't fsync */
};
diff --git a/fs/proc/link.c b/fs/proc/link.c
index 05ab85030..df5ea85e6 100644
--- a/fs/proc/link.c
+++ b/fs/proc/link.c
@@ -31,6 +31,7 @@ static struct file_operations proc_fd_link_operations = {
NULL, /* ioctl - default */
NULL, /* mmap */
NULL, /* very special open code */
+ NULL, /* flush */
NULL, /* no special release code */
NULL /* can't fsync */
};
diff --git a/fs/proc/mem.c b/fs/proc/mem.c
index 6478dab77..8a8ec9bc0 100644
--- a/fs/proc/mem.c
+++ b/fs/proc/mem.c
@@ -316,6 +316,7 @@ static struct file_operations proc_mem_operations = {
NULL, /* mem_ioctl */
mem_mmap, /* mmap */
NULL, /* no special open code */
+ NULL, /* flush */
NULL, /* no special release code */
NULL /* can't fsync */
};
diff --git a/fs/proc/net.c b/fs/proc/net.c
index 408c8e0d4..a6d8c5616 100644
--- a/fs/proc/net.c
+++ b/fs/proc/net.c
@@ -92,6 +92,7 @@ static struct file_operations proc_net_operations = {
NULL, /* ioctl - default */
NULL, /* mmap */
NULL, /* no special open code */
+ NULL, /* flush */
NULL, /* no special release code */
NULL /* can't fsync */
};
diff --git a/fs/proc/omirr.c b/fs/proc/omirr.c
index 041e493d2..9bde82e82 100644
--- a/fs/proc/omirr.c
+++ b/fs/proc/omirr.c
@@ -268,6 +268,7 @@ static struct file_operations omirr_operations = {
NULL, /* omirr_ioctl */
NULL, /* mmap */
omirr_open,
+ NULL, /* flush */
omirr_release,
NULL, /* fsync */
NULL, /* fasync */
diff --git a/fs/proc/openpromfs.c b/fs/proc/openpromfs.c
index 0380e1899..b3871059e 100644
--- a/fs/proc/openpromfs.c
+++ b/fs/proc/openpromfs.c
@@ -479,6 +479,7 @@ static struct file_operations openpromfs_prop_ops = {
NULL, /* ioctl - default */
NULL, /* mmap */
NULL, /* no special open code */
+ NULL, /* flush */
property_release, /* no special release code */
NULL /* can't fsync */
};
@@ -512,6 +513,7 @@ static struct file_operations openpromfs_nodenum_ops = {
NULL, /* ioctl - default */
NULL, /* mmap */
NULL, /* no special open code */
+ NULL, /* flush */
NULL, /* no special release code */
NULL /* can't fsync */
};
@@ -545,6 +547,7 @@ static struct file_operations openprom_alias_operations = {
NULL, /* ioctl - default */
NULL, /* mmap */
NULL, /* no special open code */
+ NULL, /* flush */
NULL, /* no special release code */
NULL /* can't fsync */
};
diff --git a/fs/proc/root.c b/fs/proc/root.c
index 999783ee5..e2889d123 100644
--- a/fs/proc/root.c
+++ b/fs/proc/root.c
@@ -50,6 +50,7 @@ static struct file_operations proc_dir_operations = {
NULL, /* ioctl - default */
NULL, /* mmap */
NULL, /* no special open code */
+ NULL, /* flush */
NULL, /* no special release code */
NULL /* can't fsync */
};
@@ -117,6 +118,7 @@ static struct file_operations proc_root_operations = {
NULL, /* ioctl - default */
NULL, /* mmap */
NULL, /* no special open code */
+ NULL, /* flush */
NULL, /* no special release code */
NULL /* no fsync */
};
@@ -276,6 +278,7 @@ static struct file_operations proc_openprom_operations = {
NULL, /* ioctl - default */
NULL, /* mmap */
NULL, /* no special open code */
+ NULL, /* flush */
NULL, /* no special release code */
NULL /* can't fsync */
};
@@ -911,20 +914,19 @@ int proc_readdir(struct file * filp,
* tasklist lock while doing this, and we must release it before
* we actually do the filldir itself, so we use a temp buffer..
*/
-static int get_pid_list(unsigned int index, unsigned int *pids)
+static int get_pid_list(int index, unsigned int *pids)
{
struct task_struct *p;
- int nr = FIRST_PROCESS_ENTRY;
int nr_pids = 0;
+ index -= FIRST_PROCESS_ENTRY;
read_lock(&tasklist_lock);
for_each_task(p) {
- int pid;
- if (nr++ < index)
- continue;
- pid = p->pid;
+ int pid = p->pid;
if (!pid)
continue;
+ if (--index >= 0)
+ continue;
pids[nr_pids] = pid;
nr_pids++;
if (nr_pids >= PROC_MAXPIDS)
diff --git a/fs/proc/scsi.c b/fs/proc/scsi.c
index 3bc4b1d59..6f3ad0770 100644
--- a/fs/proc/scsi.c
+++ b/fs/proc/scsi.c
@@ -50,6 +50,7 @@ static struct file_operations proc_scsi_operations = {
NULL, /* ioctl */
NULL, /* mmap */
NULL, /* no special open code */
+ NULL, /* flush */
NULL, /* no special release code */
NULL /* can't fsync */
};