From 19f744fa79ff975aac9f1387d64e8f3620d236eb Mon Sep 17 00:00:00 2001 From: "Eric W. Biederman" Date: Mon, 26 Jun 2006 00:25:47 -0700 Subject: [PATCH] --- yaml --- r: 30244 b: refs/heads/master c: 6e66b52bf587f0dd9a8e0a581b9570e5c1969e33 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/fs/proc/base.c | 21 +++++++++++++++++++-- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/[refs] b/[refs] index 39cc242c6357..6b8819d6004f 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 0f2fe20f55c85f26efaf14feeb69c7c2eb3f7a75 +refs/heads/master: 6e66b52bf587f0dd9a8e0a581b9570e5c1969e33 diff --git a/trunk/fs/proc/base.c b/trunk/fs/proc/base.c index a85b073408e0..29539c2268a3 100644 --- a/trunk/fs/proc/base.c +++ b/trunk/fs/proc/base.c @@ -1532,6 +1532,7 @@ static struct dentry *proc_lookupfd(struct inode * dir, struct dentry * dentry, static int proc_task_readdir(struct file * filp, void * dirent, filldir_t filldir); static struct dentry *proc_task_lookup(struct inode *dir, struct dentry * dentry, struct nameidata *nd); +static int proc_task_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat); static struct file_operations proc_fd_operations = { .read = generic_read_dir, @@ -1552,6 +1553,7 @@ static struct inode_operations proc_fd_inode_operations = { static struct inode_operations proc_task_inode_operations = { .lookup = proc_task_lookup, + .getattr = proc_task_getattr, }; #ifdef CONFIG_SECURITY @@ -1658,7 +1660,7 @@ static struct dentry *proc_pident_lookup(struct inode *dir, */ switch(p->type) { case PROC_TGID_TASK: - inode->i_nlink = 2 + get_tid_list(2, NULL, dir); + inode->i_nlink = 2; inode->i_op = &proc_task_inode_operations; inode->i_fop = &proc_task_operations; break; @@ -2261,7 +2263,6 @@ static int proc_task_readdir(struct file * filp, void * dirent, filldir_t filldi } nr_tids = get_tid_list(pos, tid_array, inode); - inode->i_nlink = pos + nr_tids; for (i = 0; i < nr_tids; i++) { unsigned long j = PROC_NUMBUF; @@ -2281,3 +2282,19 @@ static int proc_task_readdir(struct file * filp, void * dirent, filldir_t filldi filp->f_pos = pos; return retval; } + +static int proc_task_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat) +{ + struct inode *inode = dentry->d_inode; + struct task_struct *p = proc_task(inode); + generic_fillattr(inode, stat); + + if (pid_alive(p)) { + task_lock(p); + if (p->signal) + stat->nlink += atomic_read(&p->signal->count); + task_unlock(p); + } + + return 0; +}