Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 97826
b: refs/heads/master
c: aed5417
h: refs/heads/master
v: v3
  • Loading branch information
Vegard Nossum authored and Linus Torvalds committed Jun 6, 2008
1 parent b800ca1 commit cf4d5a8
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 9 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: aabe188565124ee2ed060a072764d6ed34dfa4ed
refs/heads/master: aed5417593ad125283f35513573282139a8664b5
33 changes: 25 additions & 8 deletions trunk/fs/proc/base.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,25 @@ struct pid_entry {
NULL, &proc_single_file_operations, \
{ .proc_show = &proc_##OTYPE } )

/*
* Count the number of hardlinks for the pid_entry table, excluding the .
* and .. links.
*/
static unsigned int pid_entry_count_dirs(const struct pid_entry *entries,
unsigned int n)
{
unsigned int i;
unsigned int count;

count = 0;
for (i = 0; i < n; ++i) {
if (S_ISDIR(entries[i].mode))
++count;
}

return count;
}

int maps_protect;
EXPORT_SYMBOL(maps_protect);

Expand Down Expand Up @@ -2585,10 +2604,9 @@ static struct dentry *proc_pid_instantiate(struct inode *dir,
inode->i_op = &proc_tgid_base_inode_operations;
inode->i_fop = &proc_tgid_base_operations;
inode->i_flags|=S_IMMUTABLE;
inode->i_nlink = 5;
#ifdef CONFIG_SECURITY
inode->i_nlink += 1;
#endif

inode->i_nlink = 2 + pid_entry_count_dirs(tgid_base_stuff,
ARRAY_SIZE(tgid_base_stuff));

dentry->d_op = &pid_dentry_operations;

Expand Down Expand Up @@ -2816,10 +2834,9 @@ static struct dentry *proc_task_instantiate(struct inode *dir,
inode->i_op = &proc_tid_base_inode_operations;
inode->i_fop = &proc_tid_base_operations;
inode->i_flags|=S_IMMUTABLE;
inode->i_nlink = 4;
#ifdef CONFIG_SECURITY
inode->i_nlink += 1;
#endif

inode->i_nlink = 2 + pid_entry_count_dirs(tid_base_stuff,
ARRAY_SIZE(tid_base_stuff));

dentry->d_op = &pid_dentry_operations;

Expand Down

0 comments on commit cf4d5a8

Please sign in to comment.