diff options
| author | Jiri Kosina <jkosina@suse.cz> | 2011-11-13 14:55:35 -0500 |
|---|---|---|
| committer | Jiri Kosina <jkosina@suse.cz> | 2011-11-13 14:55:53 -0500 |
| commit | 2290c0d06d82faee87b1ab2d9d4f7bf81ef64379 (patch) | |
| tree | e075e4d5534193f28e6059904f61e5ca03958d3c /kernel/utsname_sysctl.c | |
| parent | 4da669a2e3e5bc70b30a0465f3641528681b5f77 (diff) | |
| parent | 52e4c2a05256cb83cda12f3c2137ab1533344edb (diff) | |
Merge branch 'master' into for-next
Sync with Linus tree to have 157550ff ("mtd: add GPMI-NAND driver
in the config and Makefile") as I have patch depending on that one.
Diffstat (limited to 'kernel/utsname_sysctl.c')
| -rw-r--r-- | kernel/utsname_sysctl.c | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/kernel/utsname_sysctl.c b/kernel/utsname_sysctl.c index a2cd77e70d4d..63da38c2d820 100644 --- a/kernel/utsname_sysctl.c +++ b/kernel/utsname_sysctl.c | |||
| @@ -9,10 +9,11 @@ | |||
| 9 | * License. | 9 | * License. |
| 10 | */ | 10 | */ |
| 11 | 11 | ||
| 12 | #include <linux/module.h> | 12 | #include <linux/export.h> |
| 13 | #include <linux/uts.h> | 13 | #include <linux/uts.h> |
| 14 | #include <linux/utsname.h> | 14 | #include <linux/utsname.h> |
| 15 | #include <linux/sysctl.h> | 15 | #include <linux/sysctl.h> |
| 16 | #include <linux/wait.h> | ||
| 16 | 17 | ||
| 17 | static void *get_uts(ctl_table *table, int write) | 18 | static void *get_uts(ctl_table *table, int write) |
| 18 | { | 19 | { |
| @@ -51,12 +52,19 @@ static int proc_do_uts_string(ctl_table *table, int write, | |||
| 51 | uts_table.data = get_uts(table, write); | 52 | uts_table.data = get_uts(table, write); |
| 52 | r = proc_dostring(&uts_table,write,buffer,lenp, ppos); | 53 | r = proc_dostring(&uts_table,write,buffer,lenp, ppos); |
| 53 | put_uts(table, write, uts_table.data); | 54 | put_uts(table, write, uts_table.data); |
| 55 | |||
| 56 | if (write) | ||
| 57 | proc_sys_poll_notify(table->poll); | ||
| 58 | |||
| 54 | return r; | 59 | return r; |
| 55 | } | 60 | } |
| 56 | #else | 61 | #else |
| 57 | #define proc_do_uts_string NULL | 62 | #define proc_do_uts_string NULL |
| 58 | #endif | 63 | #endif |
| 59 | 64 | ||
| 65 | static DEFINE_CTL_TABLE_POLL(hostname_poll); | ||
| 66 | static DEFINE_CTL_TABLE_POLL(domainname_poll); | ||
| 67 | |||
| 60 | static struct ctl_table uts_kern_table[] = { | 68 | static struct ctl_table uts_kern_table[] = { |
| 61 | { | 69 | { |
| 62 | .procname = "ostype", | 70 | .procname = "ostype", |
| @@ -85,6 +93,7 @@ static struct ctl_table uts_kern_table[] = { | |||
| 85 | .maxlen = sizeof(init_uts_ns.name.nodename), | 93 | .maxlen = sizeof(init_uts_ns.name.nodename), |
| 86 | .mode = 0644, | 94 | .mode = 0644, |
| 87 | .proc_handler = proc_do_uts_string, | 95 | .proc_handler = proc_do_uts_string, |
| 96 | .poll = &hostname_poll, | ||
| 88 | }, | 97 | }, |
| 89 | { | 98 | { |
| 90 | .procname = "domainname", | 99 | .procname = "domainname", |
| @@ -92,6 +101,7 @@ static struct ctl_table uts_kern_table[] = { | |||
| 92 | .maxlen = sizeof(init_uts_ns.name.domainname), | 101 | .maxlen = sizeof(init_uts_ns.name.domainname), |
| 93 | .mode = 0644, | 102 | .mode = 0644, |
| 94 | .proc_handler = proc_do_uts_string, | 103 | .proc_handler = proc_do_uts_string, |
| 104 | .poll = &domainname_poll, | ||
| 95 | }, | 105 | }, |
| 96 | {} | 106 | {} |
| 97 | }; | 107 | }; |
| @@ -105,6 +115,19 @@ static struct ctl_table uts_root_table[] = { | |||
| 105 | {} | 115 | {} |
| 106 | }; | 116 | }; |
| 107 | 117 | ||
| 118 | #ifdef CONFIG_PROC_SYSCTL | ||
| 119 | /* | ||
| 120 | * Notify userspace about a change in a certain entry of uts_kern_table, | ||
| 121 | * identified by the parameter proc. | ||
| 122 | */ | ||
| 123 | void uts_proc_notify(enum uts_proc proc) | ||
| 124 | { | ||
| 125 | struct ctl_table *table = &uts_kern_table[proc]; | ||
| 126 | |||
| 127 | proc_sys_poll_notify(table->poll); | ||
| 128 | } | ||
| 129 | #endif | ||
| 130 | |||
| 108 | static int __init utsname_sysctl_init(void) | 131 | static int __init utsname_sysctl_init(void) |
| 109 | { | 132 | { |
| 110 | register_sysctl_table(uts_root_table); | 133 | register_sysctl_table(uts_root_table); |
