Blame view
fs/proc/array.c
13.3 KB
1da177e4c Linux-2.6.12-rc2 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
/* * linux/fs/proc/array.c * * Copyright (C) 1992 by Linus Torvalds * based on ideas by Darren Senn * * Fixes: * Michael. K. Johnson: stat,statm extensions. * <johnsonm@stolaf.edu> * * Pauline Middelink : Made cmdline,envline only break at '\0's, to * make sure SET_PROCTITLE works. Also removed * bad '!' which forced address recalculation for * EVERY character on the current page. * <middelin@polyware.iaf.nl> * * Danny ter Haar : added cpuinfo * <dth@cistron.nl> * * Alessandro Rubini : profile extension. * <rubini@ipvvis.unipv.it> * * Jeff Tranter : added BogoMips field to cpuinfo * <Jeff_Tranter@Mitel.COM> * * Bruno Haible : remove 4K limit for the maps file * <haible@ma2s2.mathematik.uni-karlsruhe.de> * * Yves Arrouye : remove removal of trailing spaces in get_array. * <Yves.Arrouye@marin.fdn.fr> * * Jerome Forissier : added per-CPU time information to /proc/stat * and /proc/<pid>/cpu extension * <forissier@isia.cma.fr> * - Incorporation and non-SMP safe operation * of forissier patch in 2.1.78 by * Hans Marcus <crowbar@concepts.nl> * * aeb@cwi.nl : /proc/partitions * * * Alan Cox : security fixes. |
526719ba5 Switch to a valid... |
43 |
* <alan@lxorguk.ukuu.org.uk> |
1da177e4c Linux-2.6.12-rc2 |
44 45 46 47 48 49 50 51 52 53 |
* * Al Viro : safe handling of mm_struct * * Gerhard Wichert : added BIGMEM support * Siemens AG <Gerhard.Wichert@pdb.siemens.de> * * Al Viro & Jeff Garzik : moved most of the thing into base.c and * : proc_misc.c. The rest may eventually go into * : base.c too. */ |
1da177e4c Linux-2.6.12-rc2 |
54 55 56 57 58 59 60 61 62 63 |
#include <linux/types.h> #include <linux/errno.h> #include <linux/time.h> #include <linux/kernel.h> #include <linux/kernel_stat.h> #include <linux/tty.h> #include <linux/string.h> #include <linux/mman.h> #include <linux/proc_fs.h> #include <linux/ioport.h> |
8ea026066 [PATCH] sched: fi... |
64 65 |
#include <linux/uaccess.h> #include <linux/io.h> |
1da177e4c Linux-2.6.12-rc2 |
66 67 68 69 |
#include <linux/mm.h> #include <linux/hugetlb.h> #include <linux/pagemap.h> #include <linux/swap.h> |
1da177e4c Linux-2.6.12-rc2 |
70 71 72 73 |
#include <linux/smp.h> #include <linux/signal.h> #include <linux/highmem.h> #include <linux/file.h> |
9f3acc314 [PATCH] split lin... |
74 |
#include <linux/fdtable.h> |
1da177e4c Linux-2.6.12-rc2 |
75 76 |
#include <linux/times.h> #include <linux/cpuset.h> |
4fb3a5386 [PATCH] files: fi... |
77 |
#include <linux/rcupdate.h> |
258904546 [PATCH] per-task-... |
78 |
#include <linux/delayacct.h> |
ee992744e proc: rewrite do_... |
79 |
#include <linux/seq_file.h> |
b488893a3 pid namespaces: c... |
80 |
#include <linux/pid_namespace.h> |
f83ce3e6b proc: avoid infor... |
81 |
#include <linux/ptrace.h> |
0d094efeb tracehook: traceh... |
82 |
#include <linux/tracehook.h> |
1da177e4c Linux-2.6.12-rc2 |
83 |
|
1da177e4c Linux-2.6.12-rc2 |
84 |
#include <asm/pgtable.h> |
1da177e4c Linux-2.6.12-rc2 |
85 86 |
#include <asm/processor.h> #include "internal.h" |
df5f8314c proc: seqfile con... |
87 |
static inline void task_name(struct seq_file *m, struct task_struct *p) |
1da177e4c Linux-2.6.12-rc2 |
88 89 |
{ int i; |
df5f8314c proc: seqfile con... |
90 |
char *buf, *end; |
8ea026066 [PATCH] sched: fi... |
91 |
char *name; |
1da177e4c Linux-2.6.12-rc2 |
92 93 94 |
char tcomm[sizeof(p->comm)]; get_task_comm(tcomm, p); |
9d6de12f7 proc: use seq_put... |
95 |
seq_puts(m, "Name:\t"); |
df5f8314c proc: seqfile con... |
96 97 |
end = m->buf + m->size; buf = m->buf + m->count; |
1da177e4c Linux-2.6.12-rc2 |
98 99 |
name = tcomm; i = sizeof(tcomm); |
df5f8314c proc: seqfile con... |
100 |
while (i && (buf < end)) { |
1da177e4c Linux-2.6.12-rc2 |
101 102 103 104 105 106 107 |
unsigned char c = *name; name++; i--; *buf = c; if (!c) break; if (c == '\\') { |
df5f8314c proc: seqfile con... |
108 109 110 |
buf++; if (buf < end) *buf++ = c; |
1da177e4c Linux-2.6.12-rc2 |
111 112 113 114 |
continue; } if (c == ' ') { |
df5f8314c proc: seqfile con... |
115 116 117 |
*buf++ = '\\'; if (buf < end) *buf++ = 'n'; |
1da177e4c Linux-2.6.12-rc2 |
118 119 120 |
continue; } buf++; |
df5f8314c proc: seqfile con... |
121 122 |
} m->count = buf - m->buf; |
9d6de12f7 proc: use seq_put... |
123 124 |
seq_putc(m, ' '); |
1da177e4c Linux-2.6.12-rc2 |
125 126 127 128 129 130 131 132 |
} /* * The task state array is a strange "bitmap" of * reasons to sleep. Thus "running" is zero, and * you can test for combinations of others with * simple bit tests. */ |
e130aa70f proc: constify st... |
133 |
static const char * const task_state_array[] = { |
e1781538c sched: Assert tas... |
134 135 136 137 138 139 140 141 |
"R (running)", /* 0 */ "S (sleeping)", /* 1 */ "D (disk sleep)", /* 2 */ "T (stopped)", /* 4 */ "t (tracing stop)", /* 8 */ "Z (zombie)", /* 16 */ "X (dead)", /* 32 */ "x (dead)", /* 64 */ |
464763cf1 sched: Update tas... |
142 143 |
"K (wakekill)", /* 128 */ "W (waking)", /* 256 */ |
1da177e4c Linux-2.6.12-rc2 |
144 |
}; |
8ea026066 [PATCH] sched: fi... |
145 |
static inline const char *get_task_state(struct task_struct *tsk) |
1da177e4c Linux-2.6.12-rc2 |
146 |
{ |
1587e2b18 proc/array.c: Use... |
147 |
unsigned int state = (tsk->state & TASK_REPORT) | tsk->exit_state; |
e130aa70f proc: constify st... |
148 |
const char * const *p = &task_state_array[0]; |
1da177e4c Linux-2.6.12-rc2 |
149 |
|
e1781538c sched: Assert tas... |
150 |
BUILD_BUG_ON(1 + ilog2(TASK_STATE_MAX) != ARRAY_SIZE(task_state_array)); |
1da177e4c Linux-2.6.12-rc2 |
151 152 153 154 155 156 |
while (state) { p++; state >>= 1; } return *p; } |
df5f8314c proc: seqfile con... |
157 158 |
static inline void task_state(struct seq_file *m, struct pid_namespace *ns, struct pid *pid, struct task_struct *p) |
1da177e4c Linux-2.6.12-rc2 |
159 160 161 |
{ struct group_info *group_info; int g; |
badf16621 [PATCH] files: br... |
162 |
struct fdtable *fdt = NULL; |
c69e8d9c0 CRED: Use RCU to ... |
163 |
const struct cred *cred; |
b488893a3 pid namespaces: c... |
164 |
pid_t ppid, tpid; |
1da177e4c Linux-2.6.12-rc2 |
165 |
|
b0fa9db6a [PATCH] proc: dro... |
166 |
rcu_read_lock(); |
b488893a3 pid namespaces: c... |
167 168 |
ppid = pid_alive(p) ? task_tgid_nr_ns(rcu_dereference(p->real_parent), ns) : 0; |
0d094efeb tracehook: traceh... |
169 170 |
tpid = 0; if (pid_alive(p)) { |
06d984737 ptrace: s/traceho... |
171 |
struct task_struct *tracer = ptrace_parent(p); |
0d094efeb tracehook: traceh... |
172 173 174 |
if (tracer) tpid = task_pid_nr_ns(tracer, ns); } |
de09a9771 CRED: Fix get_tas... |
175 |
cred = get_task_cred(p); |
df5f8314c proc: seqfile con... |
176 |
seq_printf(m, |
1da177e4c Linux-2.6.12-rc2 |
177 178 |
"State:\t%s " |
1da177e4c Linux-2.6.12-rc2 |
179 180 181 182 183 184 185 186 187 188 189 190 191 |
"Tgid:\t%d " "Pid:\t%d " "PPid:\t%d " "TracerPid:\t%d " "Uid:\t%d\t%d\t%d\t%d " "Gid:\t%d\t%d\t%d\t%d ", get_task_state(p), |
b488893a3 pid namespaces: c... |
192 |
task_tgid_nr_ns(p, ns), |
df5f8314c proc: seqfile con... |
193 |
pid_nr_ns(pid, ns), |
b488893a3 pid namespaces: c... |
194 |
ppid, tpid, |
c69e8d9c0 CRED: Use RCU to ... |
195 196 |
cred->uid, cred->euid, cred->suid, cred->fsuid, cred->gid, cred->egid, cred->sgid, cred->fsgid); |
b0fa9db6a [PATCH] proc: dro... |
197 |
|
1da177e4c Linux-2.6.12-rc2 |
198 |
task_lock(p); |
badf16621 [PATCH] files: br... |
199 200 |
if (p->files) fdt = files_fdtable(p->files); |
df5f8314c proc: seqfile con... |
201 |
seq_printf(m, |
1da177e4c Linux-2.6.12-rc2 |
202 203 204 |
"FDSize:\t%d " "Groups:\t", |
badf16621 [PATCH] files: br... |
205 |
fdt ? fdt->max_fds : 0); |
4fb3a5386 [PATCH] files: fi... |
206 |
rcu_read_unlock(); |
1da177e4c Linux-2.6.12-rc2 |
207 |
|
c69e8d9c0 CRED: Use RCU to ... |
208 |
group_info = cred->group_info; |
1da177e4c Linux-2.6.12-rc2 |
209 |
task_unlock(p); |
8ea026066 [PATCH] sched: fi... |
210 |
for (g = 0; g < min(group_info->ngroups, NGROUPS_SMALL); g++) |
df5f8314c proc: seqfile con... |
211 |
seq_printf(m, "%d ", GROUP_AT(group_info, g)); |
c69e8d9c0 CRED: Use RCU to ... |
212 |
put_cred(cred); |
1da177e4c Linux-2.6.12-rc2 |
213 |
|
9d6de12f7 proc: use seq_put... |
214 215 |
seq_putc(m, ' '); |
1da177e4c Linux-2.6.12-rc2 |
216 |
} |
df5f8314c proc: seqfile con... |
217 218 |
static void render_sigset_t(struct seq_file *m, const char *header, sigset_t *set) |
1da177e4c Linux-2.6.12-rc2 |
219 |
{ |
df5f8314c proc: seqfile con... |
220 |
int i; |
1da177e4c Linux-2.6.12-rc2 |
221 |
|
9d6de12f7 proc: use seq_put... |
222 |
seq_puts(m, header); |
1da177e4c Linux-2.6.12-rc2 |
223 224 225 226 227 228 229 230 231 232 |
i = _NSIG; do { int x = 0; i -= 4; 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; |
df5f8314c proc: seqfile con... |
233 |
seq_printf(m, "%x", x); |
1da177e4c Linux-2.6.12-rc2 |
234 |
} while (i >= 4); |
9d6de12f7 proc: use seq_put... |
235 236 |
seq_putc(m, ' '); |
1da177e4c Linux-2.6.12-rc2 |
237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 |
} static void collect_sigign_sigcatch(struct task_struct *p, sigset_t *ign, sigset_t *catch) { struct k_sigaction *k; int i; k = p->sighand->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); } } |
df5f8314c proc: seqfile con... |
253 |
static inline void task_sig(struct seq_file *m, struct task_struct *p) |
1da177e4c Linux-2.6.12-rc2 |
254 |
{ |
5e6b3f42e [PATCH] proc: con... |
255 |
unsigned long flags; |
1da177e4c Linux-2.6.12-rc2 |
256 257 258 259 260 261 262 263 264 265 |
sigset_t pending, shpending, blocked, ignored, caught; int num_threads = 0; unsigned long qsize = 0; unsigned long qlim = 0; sigemptyset(&pending); sigemptyset(&shpending); sigemptyset(&blocked); sigemptyset(&ignored); sigemptyset(&caught); |
5e6b3f42e [PATCH] proc: con... |
266 |
if (lock_task_sighand(p, &flags)) { |
1da177e4c Linux-2.6.12-rc2 |
267 268 269 270 |
pending = p->pending.signal; shpending = p->signal->shared_pending.signal; blocked = p->blocked; collect_sigign_sigcatch(p, &ignored, &caught); |
7e49827cc proc: get_nr_thre... |
271 |
num_threads = get_nr_threads(p); |
7dc521579 vfs: Apply lockde... |
272 |
rcu_read_lock(); /* FIXME: is this correct? */ |
c69e8d9c0 CRED: Use RCU to ... |
273 |
qsize = atomic_read(&__task_cred(p)->user->sigpending); |
7dc521579 vfs: Apply lockde... |
274 |
rcu_read_unlock(); |
d554ed895 fs: use rlimit he... |
275 |
qlim = task_rlimit(p, RLIMIT_SIGPENDING); |
5e6b3f42e [PATCH] proc: con... |
276 |
unlock_task_sighand(p, &flags); |
1da177e4c Linux-2.6.12-rc2 |
277 |
} |
1da177e4c Linux-2.6.12-rc2 |
278 |
|
df5f8314c proc: seqfile con... |
279 280 281 282 |
seq_printf(m, "Threads:\t%d ", num_threads); seq_printf(m, "SigQ:\t%lu/%lu ", qsize, qlim); |
1da177e4c Linux-2.6.12-rc2 |
283 284 |
/* render them all */ |
df5f8314c proc: seqfile con... |
285 286 287 288 289 |
render_sigset_t(m, "SigPnd:\t", &pending); render_sigset_t(m, "ShdPnd:\t", &shpending); render_sigset_t(m, "SigBlk:\t", &blocked); render_sigset_t(m, "SigIgn:\t", &ignored); render_sigset_t(m, "SigCgt:\t", &caught); |
1da177e4c Linux-2.6.12-rc2 |
290 |
} |
df5f8314c proc: seqfile con... |
291 292 |
static void render_cap_t(struct seq_file *m, const char *header, kernel_cap_t *a) |
e338d263a Add 64-bit capabi... |
293 294 |
{ unsigned __capi; |
9d6de12f7 proc: use seq_put... |
295 |
seq_puts(m, header); |
e338d263a Add 64-bit capabi... |
296 |
CAP_FOR_EACH_U32(__capi) { |
df5f8314c proc: seqfile con... |
297 |
seq_printf(m, "%08x", |
ca05a99a5 capabilities: rem... |
298 |
a->cap[(_KERNEL_CAPABILITY_U32S-1) - __capi]); |
e338d263a Add 64-bit capabi... |
299 |
} |
9d6de12f7 proc: use seq_put... |
300 301 |
seq_putc(m, ' '); |
e338d263a Add 64-bit capabi... |
302 |
} |
df5f8314c proc: seqfile con... |
303 |
static inline void task_cap(struct seq_file *m, struct task_struct *p) |
1da177e4c Linux-2.6.12-rc2 |
304 |
{ |
c69e8d9c0 CRED: Use RCU to ... |
305 306 |
const struct cred *cred; kernel_cap_t cap_inheritable, cap_permitted, cap_effective, cap_bset; |
b6dff3ec5 CRED: Separate ta... |
307 |
|
c69e8d9c0 CRED: Use RCU to ... |
308 309 310 311 312 313 314 315 316 317 318 319 |
rcu_read_lock(); cred = __task_cred(p); cap_inheritable = cred->cap_inheritable; cap_permitted = cred->cap_permitted; cap_effective = cred->cap_effective; cap_bset = cred->cap_bset; rcu_read_unlock(); render_cap_t(m, "CapInh:\t", &cap_inheritable); render_cap_t(m, "CapPrm:\t", &cap_permitted); render_cap_t(m, "CapEff:\t", &cap_effective); render_cap_t(m, "CapBnd:\t", &cap_bset); |
1da177e4c Linux-2.6.12-rc2 |
320 |
} |
df5f8314c proc: seqfile con... |
321 322 |
static inline void task_context_switch_counts(struct seq_file *m, struct task_struct *p) |
b663a79c1 taskstats: add co... |
323 |
{ |
df5f8314c proc: seqfile con... |
324 325 326 327 328 329 |
seq_printf(m, "voluntary_ctxt_switches:\t%lu " "nonvoluntary_ctxt_switches:\t%lu ", p->nvcsw, p->nivcsw); |
b663a79c1 taskstats: add co... |
330 |
} |
d01d48278 sched: Always sho... |
331 332 |
static void task_cpus_allowed(struct seq_file *m, struct task_struct *task) { |
9d6de12f7 proc: use seq_put... |
333 |
seq_puts(m, "Cpus_allowed:\t"); |
d01d48278 sched: Always sho... |
334 |
seq_cpumask(m, &task->cpus_allowed); |
9d6de12f7 proc: use seq_put... |
335 336 337 |
seq_putc(m, ' '); seq_puts(m, "Cpus_allowed_list:\t"); |
d01d48278 sched: Always sho... |
338 |
seq_cpumask_list(m, &task->cpus_allowed); |
9d6de12f7 proc: use seq_put... |
339 340 |
seq_putc(m, ' '); |
d01d48278 sched: Always sho... |
341 |
} |
df5f8314c proc: seqfile con... |
342 343 |
int proc_pid_status(struct seq_file *m, struct pid_namespace *ns, struct pid *pid, struct task_struct *task) |
1da177e4c Linux-2.6.12-rc2 |
344 |
{ |
1da177e4c Linux-2.6.12-rc2 |
345 |
struct mm_struct *mm = get_task_mm(task); |
df5f8314c proc: seqfile con... |
346 347 |
task_name(m, task); task_state(m, ns, pid, task); |
8ea026066 [PATCH] sched: fi... |
348 |
|
1da177e4c Linux-2.6.12-rc2 |
349 |
if (mm) { |
df5f8314c proc: seqfile con... |
350 |
task_mem(m, mm); |
1da177e4c Linux-2.6.12-rc2 |
351 352 |
mmput(mm); } |
df5f8314c proc: seqfile con... |
353 354 |
task_sig(m, task); task_cap(m, task); |
d01d48278 sched: Always sho... |
355 |
task_cpus_allowed(m, task); |
df5f8314c proc: seqfile con... |
356 |
cpuset_task_status_allowed(m, task); |
df5f8314c proc: seqfile con... |
357 358 |
task_context_switch_counts(m, task); return 0; |
1da177e4c Linux-2.6.12-rc2 |
359 |
} |
ee992744e proc: rewrite do_... |
360 361 |
static int do_task_stat(struct seq_file *m, struct pid_namespace *ns, struct pid *pid, struct task_struct *task, int whole) |
1da177e4c Linux-2.6.12-rc2 |
362 363 364 365 366 367 |
{ unsigned long vsize, eip, esp, wchan = ~0UL; long priority, nice; int tty_pgrp = -1, tty_nr = 0; sigset_t sigign, sigcatch; char state; |
8ea026066 [PATCH] sched: fi... |
368 |
pid_t ppid = 0, pgid = -1, sid = -1; |
1da177e4c Linux-2.6.12-rc2 |
369 |
int num_threads = 0; |
f83ce3e6b proc: avoid infor... |
370 |
int permitted; |
1da177e4c Linux-2.6.12-rc2 |
371 372 373 374 |
struct mm_struct *mm; unsigned long long start_time; unsigned long cmin_flt = 0, cmaj_flt = 0; unsigned long min_flt = 0, maj_flt = 0; |
efe567fc8 sched: accounting... |
375 |
cputime_t cutime, cstime, utime, stime; |
9ac52315d sched: guest CPU ... |
376 |
cputime_t cgtime, gtime; |
1da177e4c Linux-2.6.12-rc2 |
377 |
unsigned long rsslim = 0; |
1da177e4c Linux-2.6.12-rc2 |
378 |
char tcomm[sizeof(task->comm)]; |
a593d6ede [PATCH] proc: con... |
379 |
unsigned long flags; |
1da177e4c Linux-2.6.12-rc2 |
380 381 382 |
state = *get_task_state(task); vsize = eip = esp = 0; |
69f594a38 ptrace: do not au... |
383 |
permitted = ptrace_may_access(task, PTRACE_MODE_READ | PTRACE_MODE_NOAUDIT); |
1da177e4c Linux-2.6.12-rc2 |
384 385 386 |
mm = get_task_mm(task); if (mm) { vsize = task_vsize(mm); |
f83ce3e6b proc: avoid infor... |
387 388 389 390 |
if (permitted) { eip = KSTK_EIP(task); esp = KSTK_ESP(task); } |
1da177e4c Linux-2.6.12-rc2 |
391 392 393 394 395 396 |
} get_task_comm(tcomm, task); sigemptyset(&sigign); sigemptyset(&sigcatch); |
648616343 [S390] cputime: a... |
397 398 |
cutime = cstime = utime = stime = 0; cgtime = gtime = 0; |
3cfd0885f [PATCH] tty: stop... |
399 |
|
a593d6ede [PATCH] proc: con... |
400 401 |
if (lock_task_sighand(task, &flags)) { struct signal_struct *sig = task->signal; |
915935041 [PATCH] do_task_s... |
402 403 |
if (sig->tty) { |
5d0fdf1e0 tty_io: fix remai... |
404 405 406 |
struct pid *pgrp = tty_get_pgrp(sig->tty); tty_pgrp = pid_nr_ns(pgrp, ns); put_pid(pgrp); |
915935041 [PATCH] do_task_s... |
407 |
tty_nr = new_encode_dev(tty_devnum(sig->tty)); |
a593d6ede [PATCH] proc: con... |
408 |
} |
7e49827cc proc: get_nr_thre... |
409 |
num_threads = get_nr_threads(task); |
1da177e4c Linux-2.6.12-rc2 |
410 |
collect_sigign_sigcatch(task, &sigign, &sigcatch); |
a593d6ede [PATCH] proc: con... |
411 412 413 414 |
cmin_flt = sig->cmin_flt; cmaj_flt = sig->cmaj_flt; cutime = sig->cutime; cstime = sig->cstime; |
9ac52315d sched: guest CPU ... |
415 |
cgtime = sig->cgtime; |
d554ed895 fs: use rlimit he... |
416 |
rsslim = ACCESS_ONCE(sig->rlim[RLIMIT_RSS].rlim_cur); |
a593d6ede [PATCH] proc: con... |
417 |
|
1da177e4c Linux-2.6.12-rc2 |
418 419 |
/* add up live thread stats at the group level */ if (whole) { |
a593d6ede [PATCH] proc: con... |
420 |
struct task_struct *t = task; |
1da177e4c Linux-2.6.12-rc2 |
421 422 423 |
do { min_flt += t->min_flt; maj_flt += t->maj_flt; |
648616343 [S390] cputime: a... |
424 |
gtime += t->gtime; |
1da177e4c Linux-2.6.12-rc2 |
425 426 |
t = next_thread(t); } while (t != task); |
1da177e4c Linux-2.6.12-rc2 |
427 |
|
a593d6ede [PATCH] proc: con... |
428 429 |
min_flt += sig->min_flt; maj_flt += sig->maj_flt; |
0cf55e1ec sched, cputime: I... |
430 |
thread_group_times(task, &utime, &stime); |
648616343 [S390] cputime: a... |
431 |
gtime += sig->gtime; |
1da177e4c Linux-2.6.12-rc2 |
432 |
} |
a593d6ede [PATCH] proc: con... |
433 |
|
b488893a3 pid namespaces: c... |
434 |
sid = task_session_nr_ns(task, ns); |
a98fdcef9 fix the "remove t... |
435 |
ppid = task_tgid_nr_ns(task->real_parent, ns); |
b488893a3 pid namespaces: c... |
436 |
pgid = task_pgrp_nr_ns(task, ns); |
a593d6ede [PATCH] proc: con... |
437 438 |
unlock_task_sighand(task, &flags); |
1da177e4c Linux-2.6.12-rc2 |
439 |
} |
1da177e4c Linux-2.6.12-rc2 |
440 |
|
f83ce3e6b proc: avoid infor... |
441 |
if (permitted && (!whole || num_threads < 2)) |
1da177e4c Linux-2.6.12-rc2 |
442 443 444 445 |
wchan = get_wchan(task); if (!whole) { min_flt = task->min_flt; maj_flt = task->maj_flt; |
d180c5bcc sched: Introduce ... |
446 |
task_times(task, &utime, &stime); |
d5b7c78e9 sched: Remove tas... |
447 |
gtime = task->gtime; |
1da177e4c Linux-2.6.12-rc2 |
448 449 450 451 452 453 454 455 456 |
} /* 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); /* Temporary variable needed for gcc-2.96 */ /* convert timespec -> nsec*/ |
924b42d5a Use boot based ti... |
457 458 459 |
start_time = (unsigned long long)task->real_start_time.tv_sec * NSEC_PER_SEC + task->real_start_time.tv_nsec; |
1da177e4c Linux-2.6.12-rc2 |
460 461 |
/* convert nsec -> ticks */ start_time = nsec_to_clock_t(start_time); |
ee992744e proc: rewrite do_... |
462 |
seq_printf(m, "%d (%s) %c %d %d %d %d %d %u %lu \ |
4dee26b7e [PATCH] hrtimers:... |
463 |
%lu %lu %lu %lu %lu %ld %ld %ld %ld %d 0 %llu %lu %ld %lu %lu %lu %lu %lu \ |
b3f7f573a c/r: procfs: add ... |
464 465 |
%lu %lu %lu %lu %lu %lu %lu %lu %d %d %u %u %llu %lu %ld %lu %lu %lu ", |
ee992744e proc: rewrite do_... |
466 |
pid_nr_ns(pid, ns), |
1da177e4c Linux-2.6.12-rc2 |
467 468 469 470 471 472 473 474 475 476 477 478 |
tcomm, state, ppid, pgid, sid, tty_nr, tty_pgrp, task->flags, min_flt, cmin_flt, maj_flt, cmaj_flt, |
efe567fc8 sched: accounting... |
479 480 |
cputime_to_clock_t(utime), cputime_to_clock_t(stime), |
1da177e4c Linux-2.6.12-rc2 |
481 482 483 484 485 |
cputime_to_clock_t(cutime), cputime_to_clock_t(cstime), priority, nice, num_threads, |
1da177e4c Linux-2.6.12-rc2 |
486 487 |
start_time, vsize, |
4294621f4 [PATCH] mm: rss =... |
488 |
mm ? get_mm_rss(mm) : 0, |
8ea026066 [PATCH] sched: fi... |
489 |
rsslim, |
5883f57ca proc: protect mm ... |
490 491 |
mm ? (permitted ? mm->start_code : 1) : 0, mm ? (permitted ? mm->end_code : 1) : 0, |
34441427a revert "procfs: p... |
492 |
(permitted && mm) ? mm->start_stack : 0, |
1da177e4c Linux-2.6.12-rc2 |
493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 |
esp, eip, /* The signal information here is obsolete. * It must be decimal for Linux 2.0 compatibility. * Use /proc/#/status for real-time signals. */ task->pending.signal.sig[0] & 0x7fffffffUL, task->blocked.sig[0] & 0x7fffffffUL, sigign .sig[0] & 0x7fffffffUL, sigcatch .sig[0] & 0x7fffffffUL, wchan, 0UL, 0UL, task->exit_signal, task_cpu(task), task->rt_priority, |
258904546 [PATCH] per-task-... |
509 |
task->policy, |
9ac52315d sched: guest CPU ... |
510 511 |
(unsigned long long)delayacct_blkio_ticks(task), cputime_to_clock_t(gtime), |
b3f7f573a c/r: procfs: add ... |
512 513 514 515 |
cputime_to_clock_t(cgtime), (mm && permitted) ? mm->start_data : 0, (mm && permitted) ? mm->end_data : 0, (mm && permitted) ? mm->start_brk : 0); |
8ea026066 [PATCH] sched: fi... |
516 |
if (mm) |
1da177e4c Linux-2.6.12-rc2 |
517 |
mmput(mm); |
ee992744e proc: rewrite do_... |
518 |
return 0; |
1da177e4c Linux-2.6.12-rc2 |
519 |
} |
ee992744e proc: rewrite do_... |
520 521 |
int proc_tid_stat(struct seq_file *m, struct pid_namespace *ns, struct pid *pid, struct task_struct *task) |
1da177e4c Linux-2.6.12-rc2 |
522 |
{ |
ee992744e proc: rewrite do_... |
523 |
return do_task_stat(m, ns, pid, task, 0); |
1da177e4c Linux-2.6.12-rc2 |
524 |
} |
ee992744e proc: rewrite do_... |
525 526 |
int proc_tgid_stat(struct seq_file *m, struct pid_namespace *ns, struct pid *pid, struct task_struct *task) |
1da177e4c Linux-2.6.12-rc2 |
527 |
{ |
ee992744e proc: rewrite do_... |
528 |
return do_task_stat(m, ns, pid, task, 1); |
1da177e4c Linux-2.6.12-rc2 |
529 |
} |
a56d3fc74 seqfile convert p... |
530 531 |
int proc_pid_statm(struct seq_file *m, struct pid_namespace *ns, struct pid *pid, struct task_struct *task) |
1da177e4c Linux-2.6.12-rc2 |
532 |
{ |
a2ade7b6c proc: use unsigne... |
533 |
unsigned long size = 0, resident = 0, shared = 0, text = 0, data = 0; |
1da177e4c Linux-2.6.12-rc2 |
534 |
struct mm_struct *mm = get_task_mm(task); |
8ea026066 [PATCH] sched: fi... |
535 |
|
1da177e4c Linux-2.6.12-rc2 |
536 537 538 539 |
if (mm) { size = task_statm(mm, &shared, &text, &data, &resident); mmput(mm); } |
a2ade7b6c proc: use unsigne... |
540 541 542 |
seq_printf(m, "%lu %lu %lu %lu 0 %lu 0 ", size, resident, shared, text, data); |
1da177e4c Linux-2.6.12-rc2 |
543 |
|
a56d3fc74 seqfile convert p... |
544 |
return 0; |
1da177e4c Linux-2.6.12-rc2 |
545 |
} |