Chinaunix首页 | 论坛 | 博客
  • 博客访问: 647773
  • 博文数量: 156
  • 博客积分: 4833
  • 博客等级: 上校
  • 技术积分: 1554
  • 用 户 组: 普通用户
  • 注册时间: 2007-05-21 19:36
文章分类

全部博文(156)

文章存档

2016年(2)

2013年(1)

2012年(13)

2011年(30)

2010年(46)

2009年(29)

2008年(23)

2007年(12)

分类: LINUX

2008-09-22 00:00:52

好像是:
proc_root_readdir->proc_pid_readdir->proc_pid_fill_cache
完成的

有一些宏和函数还不是很清楚~~


fs\proc\base.c
fs\proc\array.c

感觉遍历是由:
task = next_tgid(tgid + 1)完成;

FIRST_PROCESS_ENTRY是self的入口项(f_pos的offset);
后面是各个进程号的入口项;
proc_root_readdir->proc_pid_readdir->proc_pid_fill_cache->proc_fill_cache->filldir(fillonedir )


备忘。。。。。

static int do_task_stat(struct seq_file *m, struct pid_namespace *ns,
            struct pid *pid, struct task_struct *task, int whole)
{
   ......
   ........

seq_printf(m, "%d (%s) %c %d %d %d %d %d %u %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 %u %u %llu %lu %ld\n",
        pid_nr_ns(pid, ns),
        tcomm,
        state,
        ppid,
        pgid,
        sid,
        tty_nr,
        tty_pgrp,
        task->flags,
        min_flt,
        cmin_flt,
        maj_flt,
        cmaj_flt,
        cputime_to_clock_t(utime),
        cputime_to_clock_t(stime),
        cputime_to_clock_t(cutime),
        cputime_to_clock_t(cstime),
        priority,
        nice,
        num_threads,
        start_time,
        vsize,
        mm ? get_mm_rss(mm) : 0,
        rsslim,
        mm ? mm->start_code : 0,
        mm ? mm->end_code : 0,
        mm ? mm->start_stack : 0,
        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,
        task->policy,
        (unsigned long long)delayacct_blkio_ticks(task),
        cputime_to_clock_t(gtime),
        cputime_to_clock_t(cgtime));
    if (mm)
        mmput(mm);
    return 0;
}
阅读(2177) | 评论(0) | 转发(0) |
0

上一篇:IPC的持续性

下一篇:GCC Common Predefined Macros

给主人留下些什么吧!~~