summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorMartin Baulig <martin@src.gnome.org>1998-08-12 16:30:06 +0000
committerMartin Baulig <martin@src.gnome.org>1998-08-12 16:30:06 +0000
commit71310d645d67f4ee625d0f2fee31f37883744025 (patch)
tree88d3df3d195a3f0870206baf10e120289e414af3 /kernel
parentb05cfacb3d214d5d9d06df91c48e7cd5dbbaa844 (diff)
downloadlibgtop-71310d645d67f4ee625d0f2fee31f37883744025.tar.gz
Minor changes to make it work with kernel 2.1.115.
Diffstat (limited to 'kernel')
-rw-r--r--kernel/table21/.cvsignore4
-rw-r--r--kernel/table21/Makefile2
-rw-r--r--kernel/table21/module.c36
3 files changed, 30 insertions, 12 deletions
diff --git a/kernel/table21/.cvsignore b/kernel/table21/.cvsignore
new file mode 100644
index 00000000..a7ab2843
--- /dev/null
+++ b/kernel/table21/.cvsignore
@@ -0,0 +1,4 @@
+kernel.patch
+.main.o.flags
+.table.o.flags
+.module.o.flags
diff --git a/kernel/table21/Makefile b/kernel/table21/Makefile
index 7d30495b..2eedd527 100644
--- a/kernel/table21/Makefile
+++ b/kernel/table21/Makefile
@@ -10,7 +10,7 @@
O_TARGET := table.o
OX_OBJS := main.o
-M_TARGET := module.o
+M_TARGET := table_mod.o
MX_OBJS := module.o
include $(TOPDIR)/Rules.make
diff --git a/kernel/table21/module.c b/kernel/table21/module.c
index fb095976..77ff898a 100644
--- a/kernel/table21/module.c
+++ b/kernel/table21/module.c
@@ -305,7 +305,7 @@ table_fkt (int type, union table *buf, const void *param)
struct sysinfo i;
struct task_struct *tsk = NULL;
sigset_t sigign, sigcatch;
- int index, err;
+ int index, tindex, err;
pid_t pid;
if (type == TABLE_VERSION)
@@ -346,13 +346,16 @@ table_fkt (int type, union table *buf, const void *param)
switch (type) {
case TABLE_PROCLIST:
tsk = task [0];
- for (index = 0; index < nr_tasks; index++) {
- tbl.proclist.pids [index] = tsk->pid;
+ read_lock (&tasklist_lock);
+ for (index = tindex = 0; index < nr_tasks; index++) {
+ if (tsk->pid)
+ tbl.proclist.pids [tindex++] = tsk->pid;
tsk = tsk->next_task;
}
tbl.proclist.nr_running = nr_running;
- tbl.proclist.nr_tasks = nr_tasks;
tbl.proclist.last_pid = last_pid;
+ tbl.proclist.nr_tasks = tindex;
+ read_unlock(&tasklist_lock);
break;
case TABLE_CPU:
tbl.cpu.total = jiffies;
@@ -460,7 +463,7 @@ table_fkt (int type, union table *buf, const void *param)
tbl.proc_mem.arg_end = tsk->mm->arg_end;
tbl.proc_mem.env_start = tsk->mm->env_start;
tbl.proc_mem.env_end = tsk->mm->env_end;
- tbl.proc_mem.rss = tsk->mm->rss;
+ tbl.proc_mem.rss = tsk->mm->rss << PAGE_SHIFT;
tbl.proc_mem.total_vm = tsk->mm->total_vm;
tbl.proc_mem.locked_vm = tsk->mm->locked_vm;
}
@@ -480,7 +483,18 @@ table_fkt (int type, union table *buf, const void *param)
vsize += vma->vm_end - vma->vm_start;
statm_pgd_range (pgd, vma->vm_start, vma->vm_end,
+
&pages, &shared, &dirty, &total);
+
+#if 0
+ printk ("vma %p (%d) - %d, %d, %d, %d - "
+ "%lx - %lx, %lx - %lx - %lx\n",
+ vma, pid, pages, shared, dirty, total,
+ PAGE_SIZE, vma->vm_start, vma->vm_end,
+ vma->vm_end - vma->vm_start,
+ (vma->vm_end - vma->vm_start) >> PAGE_SHIFT);
+#endif
+
resident += pages;
share += shared;
dt += dirty;
@@ -497,12 +511,12 @@ table_fkt (int type, union table *buf, const void *param)
}
tbl.proc_segment.vsize = vsize;
- tbl.proc_segment.size = size;
- tbl.proc_segment.resident = resident;
- tbl.proc_segment.shared = share;
- tbl.proc_segment.trs = trs;
- tbl.proc_segment.lrs = lrs;
- tbl.proc_segment.dt = dt;
+ tbl.proc_segment.size = size << PAGE_SHIFT;
+ tbl.proc_segment.resident = resident << PAGE_SHIFT;
+ tbl.proc_segment.shared = share << PAGE_SHIFT;
+ tbl.proc_segment.trs = trs << PAGE_SHIFT;
+ tbl.proc_segment.lrs = lrs << PAGE_SHIFT;
+ tbl.proc_segment.dt = dt << PAGE_SHIFT;
}
break;
case TABLE_PROC_TIME: