Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 295475
b: refs/heads/master
c: 4e474a0
h: refs/heads/master
i:
  295473: 64df37a
  295471: 8c8cca9
v: v3
  • Loading branch information
Lucas De Marchi authored and Eric W. Biederman committed Mar 22, 2012
1 parent 76c8a47 commit 59e6fd6
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 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: 4e75732035d7e97e001bdf6e3149d3967c0221de
refs/heads/master: 4e474a00d7ff746ed177ddae14fa8b2d4bad7a00
17 changes: 16 additions & 1 deletion trunk/fs/proc/proc_sysctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -525,27 +525,40 @@ static ssize_t proc_sys_write(struct file *filp, const char __user *buf,

static int proc_sys_open(struct inode *inode, struct file *filp)
{
struct ctl_table_header *head = grab_header(inode);
struct ctl_table *table = PROC_I(inode)->sysctl_entry;

/* sysctl was unregistered */
if (IS_ERR(head))
return PTR_ERR(head);

if (table->poll)
filp->private_data = proc_sys_poll_event(table->poll);

sysctl_head_finish(head);

return 0;
}

static unsigned int proc_sys_poll(struct file *filp, poll_table *wait)
{
struct inode *inode = filp->f_path.dentry->d_inode;
struct ctl_table_header *head = grab_header(inode);
struct ctl_table *table = PROC_I(inode)->sysctl_entry;
unsigned long event = (unsigned long)filp->private_data;
unsigned int ret = DEFAULT_POLLMASK;
unsigned long event;

/* sysctl was unregistered */
if (IS_ERR(head))
return POLLERR | POLLHUP;

if (!table->proc_handler)
goto out;

if (!table->poll)
goto out;

event = (unsigned long)filp->private_data;
poll_wait(filp, &table->poll->wait, wait);

if (event != atomic_read(&table->poll->event)) {
Expand All @@ -554,6 +567,8 @@ static unsigned int proc_sys_poll(struct file *filp, poll_table *wait)
}

out:
sysctl_head_finish(head);

return ret;
}

Expand Down

0 comments on commit 59e6fd6

Please sign in to comment.