git://git.onelab.eu
/
linux-2.6.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fedora kernel-2.6.17-1.2142_FC4 patched with stable patch-2.6.17.4-vs2.0.2-rc26.diff
[linux-2.6.git]
/
fs
/
proc
/
array.c
diff --git
a/fs/proc/array.c
b/fs/proc/array.c
index
41990f0
..
dc4d1d0
100644
(file)
--- a/
fs/proc/array.c
+++ b/
fs/proc/array.c
@@
-73,7
+73,8
@@
#include <linux/highmem.h>
#include <linux/file.h>
#include <linux/times.h>
#include <linux/highmem.h>
#include <linux/file.h>
#include <linux/times.h>
-#include <linux/vs_base.h>
+#include <linux/cpuset.h>
+#include <linux/rcupdate.h>
#include <linux/vs_context.h>
#include <linux/vs_network.h>
#include <linux/vs_cvirt.h>
#include <linux/vs_context.h>
#include <linux/vs_network.h>
#include <linux/vs_cvirt.h>
@@
-82,6
+83,7
@@
#include <asm/pgtable.h>
#include <asm/io.h>
#include <asm/processor.h>
#include <asm/pgtable.h>
#include <asm/io.h>
#include <asm/processor.h>
+#include "internal.h"
/* Gcc optimizes away "strlen(x)" for constant x */
#define ADDBUF(buffer, string) \
/* Gcc optimizes away "strlen(x)" for constant x */
#define ADDBUF(buffer, string) \
@@
-137,19
+139,20
@@
static const char *task_state_array[] = {
"T (tracing stop)", /* 8 */
"Z (zombie)", /* 16 */
"X (dead)", /* 32 */
"T (tracing stop)", /* 8 */
"Z (zombie)", /* 16 */
"X (dead)", /* 32 */
- "H (on hold)" /* 64 */
+ "N (noninteractive)", /* 64 */
+ "H (on hold)" /* 128 */
};
static inline const char * get_task_state(struct task_struct *tsk)
{
};
static inline const char * get_task_state(struct task_struct *tsk)
{
- unsigned int state = tsk->state & (TASK_RUNNING |
- TASK_INTERRUPTIBLE |
- TASK_UNINTERRUPTIBLE |
- TASK_ZOMBIE |
- TASK_DEAD |
- TASK_STOPPED |
+ unsigned int state = (tsk->state & (TASK_RUNNING |
+ TASK_INTERRUPTIBLE |
+ TASK_UNINTERRUPTIBLE |
+ TASK_STOPPED |
TASK_TRACED |
TASK_TRACED |
- TASK_ONHOLD);
+ TASK_ONHOLD)) |
+ (tsk->exit_state & (EXIT_ZOMBIE |
+ EXIT_DEAD));
const char **p = &task_state_array[0];
while (state) {
const char **p = &task_state_array[0];
while (state) {
@@
-163,12
+166,13
@@
static inline char * task_state(struct task_struct *p, char *buffer)
{
struct group_info *group_info;
int g;
{
struct group_info *group_info;
int g;
- pid_t pid, ppid, tppid, tgid;
+ struct fdtable *fdt = NULL;
+ pid_t pid, ptgid, tppid, tgid;
read_lock(&tasklist_lock);
tgid = vx_map_tgid(p->tgid);
pid = vx_map_pid(p->pid);
read_lock(&tasklist_lock);
tgid = vx_map_tgid(p->tgid);
pid = vx_map_pid(p->pid);
- p
pid = vx_map_pid(p->real_parent->p
id);
+ p
tgid = vx_map_pid(p->group_leader->real_parent->tg
id);
tppid = vx_map_pid(p->parent->pid);
buffer += sprintf(buffer,
"State:\t%s\n"
tppid = vx_map_pid(p->parent->pid);
buffer += sprintf(buffer,
"State:\t%s\n"
@@
-181,16
+185,20
@@
static inline char * task_state(struct task_struct *p, char *buffer)
"Gid:\t%d\t%d\t%d\t%d\n",
get_task_state(p),
(p->sleep_avg/1024)*100/(1020000000/1024),
"Gid:\t%d\t%d\t%d\t%d\n",
get_task_state(p),
(p->sleep_avg/1024)*100/(1020000000/1024),
- tgid, pid, (pid > 1) ? p
p
id : 0,
- p
->pid
&& p->ptrace ? tppid : 0,
+ tgid, pid, (pid > 1) ? p
tg
id : 0,
+ p
id_alive(p)
&& p->ptrace ? tppid : 0,
p->uid, p->euid, p->suid, p->fsuid,
p->gid, p->egid, p->sgid, p->fsgid);
read_unlock(&tasklist_lock);
task_lock(p);
p->uid, p->euid, p->suid, p->fsuid,
p->gid, p->egid, p->sgid, p->fsgid);
read_unlock(&tasklist_lock);
task_lock(p);
+ rcu_read_lock();
+ if (p->files)
+ fdt = files_fdtable(p->files);
buffer += sprintf(buffer,
"FDSize:\t%d\n"
"Groups:\t",
buffer += sprintf(buffer,
"FDSize:\t%d\n"
"Groups:\t",
- p->files ? p->files->max_fds : 0);
+ fdt ? fdt->max_fds : 0);
+ rcu_read_unlock();
group_info = p->group_info;
get_group_info(group_info);
group_info = p->group_info;
get_group_info(group_info);
@@
-248,6
+256,8
@@
static inline char * task_sig(struct task_struct *p, char *buffer)
{
sigset_t pending, shpending, blocked, ignored, caught;
int num_threads = 0;
{
sigset_t pending, shpending, blocked, ignored, caught;
int num_threads = 0;
+ unsigned long qsize = 0;
+ unsigned long qlim = 0;
sigemptyset(&pending);
sigemptyset(&shpending);
sigemptyset(&pending);
sigemptyset(&shpending);
@@
-264,11
+274,14
@@
static inline char * task_sig(struct task_struct *p, char *buffer)
blocked = p->blocked;
collect_sigign_sigcatch(p, &ignored, &caught);
num_threads = atomic_read(&p->signal->count);
blocked = p->blocked;
collect_sigign_sigcatch(p, &ignored, &caught);
num_threads = atomic_read(&p->signal->count);
+ qsize = atomic_read(&p->user->sigpending);
+ qlim = p->signal->rlim[RLIMIT_SIGPENDING].rlim_cur;
spin_unlock_irq(&p->sighand->siglock);
}
read_unlock(&tasklist_lock);
buffer += sprintf(buffer, "Threads:\t%d\n", num_threads);
spin_unlock_irq(&p->sighand->siglock);
}
read_unlock(&tasklist_lock);
buffer += sprintf(buffer, "Threads:\t%d\n", num_threads);
+ buffer += sprintf(buffer, "SigQ:\t%lu/%lu\n", qsize, qlim);
/* render them all */
buffer = render_sigset_t("SigPnd:\t", &pending, buffer);
/* render them all */
buffer = render_sigset_t("SigPnd:\t", &pending, buffer);
@@
-295,6
+308,8
@@
int proc_pid_status(struct task_struct *task, char * buffer)
char * orig = buffer;
#ifdef CONFIG_VSERVER_LEGACY
struct vx_info *vxi;
char * orig = buffer;
#ifdef CONFIG_VSERVER_LEGACY
struct vx_info *vxi;
+#endif
+#ifdef CONFIG_VSERVER_LEGACYNET
struct nx_info *nxi;
#endif
struct mm_struct *mm = get_task_mm(task);
struct nx_info *nxi;
#endif
struct mm_struct *mm = get_task_mm(task);
@@
-308,7
+323,10
@@
int proc_pid_status(struct task_struct *task, char * buffer)
}
buffer = task_sig(task, buffer);
buffer = task_cap(task, buffer);
}
buffer = task_sig(task, buffer);
buffer = task_cap(task, buffer);
+ buffer = cpuset_task_status_allowed(task, buffer);
+ if (task_vx_flags(task, VXF_INFO_HIDE, 0))
+ goto skip;
#ifdef CONFIG_VSERVER_LEGACY
buffer += sprintf (buffer,"s_context: %d\n", vx_task_xid(task));
vxi = task_get_vx_info(task);
#ifdef CONFIG_VSERVER_LEGACY
buffer += sprintf (buffer,"s_context: %d\n", vx_task_xid(task));
vxi = task_get_vx_info(task);
@@
-322,6
+340,10
@@
int proc_pid_status(struct task_struct *task, char * buffer)
buffer += sprintf (buffer,"initpid: none\n");
}
put_vx_info(vxi);
buffer += sprintf (buffer,"initpid: none\n");
}
put_vx_info(vxi);
+#else
+ buffer += sprintf (buffer,"VxID: %d\n", vx_task_xid(task));
+#endif
+#ifdef CONFIG_VSERVER_LEGACYNET
nxi = task_get_nx_info(task);
if (nxi) {
int i;
nxi = task_get_nx_info(task);
if (nxi) {
int i;
@@
-341,17
+363,17
@@
int proc_pid_status(struct task_struct *task, char * buffer)
}
put_nx_info(nxi);
#endif
}
put_nx_info(nxi);
#endif
-#if defined(CONFIG_ARCH_S390)
+skip:
+#if defined(CONFIG_S390)
buffer = task_show_regs(task, buffer);
#endif
return buffer - orig;
}
buffer = task_show_regs(task, buffer);
#endif
return buffer - orig;
}
-
int proc_pid_stat(struct task_struct *task, char * buffer
)
+
static int do_task_stat(struct task_struct *task, char * buffer, int whole
)
{
{
- unsigned long vsize, eip, esp, wchan;
+ unsigned long vsize, eip, esp, wchan
= ~0UL
;
long priority, nice;
long priority, nice;
- unsigned long long bias_uptime = 0;
int tty_pgrp = -1, tty_nr = 0;
sigset_t sigign, sigcatch;
char state;
int tty_pgrp = -1, tty_nr = 0;
sigset_t sigign, sigcatch;
char state;
@@
-360,7
+382,11
@@
int proc_pid_stat(struct task_struct *task, char * buffer)
int num_threads = 0;
struct mm_struct *mm;
unsigned long long start_time;
int num_threads = 0;
struct mm_struct *mm;
unsigned long long start_time;
- unsigned long cmin_flt = 0, cmaj_flt = 0, cutime = 0, cstime = 0;
+ unsigned long cmin_flt = 0, cmaj_flt = 0;
+ unsigned long min_flt = 0, maj_flt = 0;
+ cputime_t cutime, cstime, utime, stime;
+ unsigned long rsslim = 0;
+ struct task_struct *t;
char tcomm[sizeof(task->comm)];
state = *get_task_state(task);
char tcomm[sizeof(task->comm)];
state = *get_task_state(task);
@@
-373,15
+399,28
@@
int proc_pid_stat(struct task_struct *task, char * buffer)
}
get_task_comm(tcomm, task);
}
get_task_comm(tcomm, task);
- wchan = get_wchan(task);
sigemptyset(&sigign);
sigemptyset(&sigcatch);
sigemptyset(&sigign);
sigemptyset(&sigcatch);
+ cutime = cstime = utime = stime = cputime_zero;
read_lock(&tasklist_lock);
if (task->sighand) {
spin_lock_irq(&task->sighand->siglock);
num_threads = atomic_read(&task->signal->count);
collect_sigign_sigcatch(task, &sigign, &sigcatch);
read_lock(&tasklist_lock);
if (task->sighand) {
spin_lock_irq(&task->sighand->siglock);
num_threads = atomic_read(&task->signal->count);
collect_sigign_sigcatch(task, &sigign, &sigcatch);
+
+ /* add up live thread stats at the group level */
+ if (whole) {
+ t = task;
+ do {
+ min_flt += t->min_flt;
+ maj_flt += t->maj_flt;
+ utime = cputime_add(utime, t->utime);
+ stime = cputime_add(stime, t->stime);
+ t = next_thread(t);
+ } while (t != task);
+ }
+
spin_unlock_irq(&task->sighand->siglock);
}
if (task->signal) {
spin_unlock_irq(&task->sighand->siglock);
}
if (task->signal) {
@@
-395,34
+434,59
@@
int proc_pid_stat(struct task_struct *task, char * buffer)
cmaj_flt = task->signal->cmaj_flt;
cutime = task->signal->cutime;
cstime = task->signal->cstime;
cmaj_flt = task->signal->cmaj_flt;
cutime = task->signal->cutime;
cstime = task->signal->cstime;
+ rsslim = task->signal->rlim[RLIMIT_RSS].rlim_cur;
+ if (whole) {
+ min_flt += task->signal->min_flt;
+ maj_flt += task->signal->maj_flt;
+ utime = cputime_add(utime, task->signal->utime);
+ stime = cputime_add(stime, task->signal->stime);
+ }
}
}
- if (task_vx_flags(task, VXF_VIRT_UPTIME, 0)) {
- bias_uptime = task->vx_info->cvirt.bias_uptime.tv_sec * NSEC_PER_SEC
- + task->vx_info->cvirt.bias_uptime.tv_nsec;
- }
+ pid = vx_info_map_pid(task->vx_info, pid_alive(task) ? task->pid : 0);
+ ppid = (!(pid > 1)) ? 0 : vx_info_map_tgid(task->vx_info,
+ task->group_leader->real_parent->tgid);
+ pgid = vx_info_map_pid(task->vx_info, pgid);
+
read_unlock(&tasklist_lock);
read_unlock(&tasklist_lock);
+ if (!whole || num_threads<2) {
+ wchan = 0;
+ if (current->uid == task->uid || current->euid == task->uid ||
+ capable(CAP_SYS_NICE))
+ wchan = get_wchan(task);
+ }
+ if (!whole) {
+ min_flt = task->min_flt;
+ maj_flt = task->maj_flt;
+ utime = task->utime;
+ stime = task->stime;
+ }
+
/* scale priority and nice values from timeslices to -20..20 */
/* to make it look like a "normal" Unix priority/nice value */
priority = task_prio(task);
nice = task_nice(task);
/* scale priority and nice values from timeslices to -20..20 */
/* to make it look like a "normal" Unix priority/nice value */
priority = task_prio(task);
nice = task_nice(task);
- read_lock(&tasklist_lock);
- pid = vx_info_map_pid(task->vx_info, task->pid);
- ppid = (!(pid > 1)) ? 0 :
- vx_info_map_pid(task->vx_info, task->real_parent->pid);
- pgid = vx_info_map_pid(task->vx_info, pgid);
- read_unlock(&tasklist_lock);
-
/* Temporary variable needed for gcc-2.96 */
/* convert timespec -> nsec*/
start_time = (unsigned long long)task->start_time.tv_sec * NSEC_PER_SEC
+ task->start_time.tv_nsec;
/* convert nsec -> ticks */
/* Temporary variable needed for gcc-2.96 */
/* convert timespec -> nsec*/
start_time = (unsigned long long)task->start_time.tv_sec * NSEC_PER_SEC
+ task->start_time.tv_nsec;
/* convert nsec -> ticks */
- start_time = nsec_to_clock_t(start_time - bias_uptime);
+ start_time = nsec_to_clock_t(start_time);
+
+ /* fixup start time for virt uptime */
+ if (vx_flags(VXF_VIRT_UPTIME, 0)) {
+ unsigned long long bias =
+ current->vx_info->cvirt.bias_clock;
+
+ if (start_time > bias)
+ start_time -= bias;
+ else
+ start_time = 0;
+ }
res = sprintf(buffer,"%d (%s) %c %d %d %d %d %d %lu %lu \
res = sprintf(buffer,"%d (%s) %c %d %d %d %d %d %lu %lu \
-%lu %lu %lu %lu %lu %ld %ld %ld %ld %d
%ld
%llu %lu %ld %lu %lu %lu %lu %lu \
+%lu %lu %lu %lu %lu %ld %ld %ld %ld %d
0
%llu %lu %ld %lu %lu %lu %lu %lu \
%lu %lu %lu %lu %lu %lu %lu %lu %d %d %lu %lu\n",
pid,
tcomm,
%lu %lu %lu %lu %lu %lu %lu %lu %d %d %lu %lu\n",
pid,
tcomm,
@@
-433,22
+497,21
@@
int proc_pid_stat(struct task_struct *task, char * buffer)
tty_nr,
tty_pgrp,
task->flags,
tty_nr,
tty_pgrp,
task->flags,
-
task->
min_flt,
+ min_flt,
cmin_flt,
cmin_flt,
-
task->
maj_flt,
+ maj_flt,
cmaj_flt,
cmaj_flt,
-
jiffies_to_clock_t(task->
utime),
-
jiffies_to_clock_t(task->
stime),
-
jiffies
_to_clock_t(cutime),
-
jiffies
_to_clock_t(cstime),
+
cputime_to_clock_t(
utime),
+
cputime_to_clock_t(
stime),
+
cputime
_to_clock_t(cutime),
+
cputime
_to_clock_t(cstime),
priority,
nice,
num_threads,
priority,
nice,
num_threads,
- jiffies_to_clock_t(task->it_real_value),
start_time,
vsize,
start_time,
vsize,
- mm ?
mm->rss : 0, /* you might want to shift this left 3 */
-
task->rlim[RLIMIT_RSS].rlim_cur
,
+ mm ?
get_mm_rss(mm) : 0,
+
rsslim
,
mm ? mm->start_code : 0,
mm ? mm->end_code : 0,
mm ? mm->start_stack : 0,
mm ? mm->start_code : 0,
mm ? mm->end_code : 0,
mm ? mm->start_stack : 0,
@@
-474,6
+537,16
@@
int proc_pid_stat(struct task_struct *task, char * buffer)
return res;
}
return res;
}
+int proc_tid_stat(struct task_struct *task, char * buffer)
+{
+ return do_task_stat(task, buffer, 0);
+}
+
+int proc_tgid_stat(struct task_struct *task, char * buffer)
+{
+ return do_task_stat(task, buffer, 1);
+}
+
int proc_pid_statm(struct task_struct *task, char *buffer)
{
int size = 0, resident = 0, shared = 0, text = 0, lib = 0, data = 0;
int proc_pid_statm(struct task_struct *task, char *buffer)
{
int size = 0, resident = 0, shared = 0, text = 0, lib = 0, data = 0;