|
@@ -13,6 +13,7 @@
|
|
#include <linux/uts.h>
|
|
#include <linux/uts.h>
|
|
#include <linux/utsname.h>
|
|
#include <linux/utsname.h>
|
|
#include <linux/sysctl.h>
|
|
#include <linux/sysctl.h>
|
|
|
|
+#include <linux/wait.h>
|
|
|
|
|
|
static void *get_uts(ctl_table *table, int write)
|
|
static void *get_uts(ctl_table *table, int write)
|
|
{
|
|
{
|
|
@@ -51,12 +52,19 @@ static int proc_do_uts_string(ctl_table *table, int write,
|
|
uts_table.data = get_uts(table, write);
|
|
uts_table.data = get_uts(table, write);
|
|
r = proc_dostring(&uts_table,write,buffer,lenp, ppos);
|
|
r = proc_dostring(&uts_table,write,buffer,lenp, ppos);
|
|
put_uts(table, write, uts_table.data);
|
|
put_uts(table, write, uts_table.data);
|
|
|
|
+
|
|
|
|
+ if (write)
|
|
|
|
+ proc_sys_poll_notify(table->poll);
|
|
|
|
+
|
|
return r;
|
|
return r;
|
|
}
|
|
}
|
|
#else
|
|
#else
|
|
#define proc_do_uts_string NULL
|
|
#define proc_do_uts_string NULL
|
|
#endif
|
|
#endif
|
|
|
|
|
|
|
|
+static DEFINE_CTL_TABLE_POLL(hostname_poll);
|
|
|
|
+static DEFINE_CTL_TABLE_POLL(domainname_poll);
|
|
|
|
+
|
|
static struct ctl_table uts_kern_table[] = {
|
|
static struct ctl_table uts_kern_table[] = {
|
|
{
|
|
{
|
|
.procname = "ostype",
|
|
.procname = "ostype",
|
|
@@ -85,6 +93,7 @@ static struct ctl_table uts_kern_table[] = {
|
|
.maxlen = sizeof(init_uts_ns.name.nodename),
|
|
.maxlen = sizeof(init_uts_ns.name.nodename),
|
|
.mode = 0644,
|
|
.mode = 0644,
|
|
.proc_handler = proc_do_uts_string,
|
|
.proc_handler = proc_do_uts_string,
|
|
|
|
+ .poll = &hostname_poll,
|
|
},
|
|
},
|
|
{
|
|
{
|
|
.procname = "domainname",
|
|
.procname = "domainname",
|
|
@@ -92,6 +101,7 @@ static struct ctl_table uts_kern_table[] = {
|
|
.maxlen = sizeof(init_uts_ns.name.domainname),
|
|
.maxlen = sizeof(init_uts_ns.name.domainname),
|
|
.mode = 0644,
|
|
.mode = 0644,
|
|
.proc_handler = proc_do_uts_string,
|
|
.proc_handler = proc_do_uts_string,
|
|
|
|
+ .poll = &domainname_poll,
|
|
},
|
|
},
|
|
{}
|
|
{}
|
|
};
|
|
};
|
|
@@ -105,6 +115,19 @@ static struct ctl_table uts_root_table[] = {
|
|
{}
|
|
{}
|
|
};
|
|
};
|
|
|
|
|
|
|
|
+#ifdef CONFIG_PROC_SYSCTL
|
|
|
|
+/*
|
|
|
|
+ * Notify userspace about a change in a certain entry of uts_kern_table,
|
|
|
|
+ * identified by the parameter proc.
|
|
|
|
+ */
|
|
|
|
+void uts_proc_notify(enum uts_proc proc)
|
|
|
|
+{
|
|
|
|
+ struct ctl_table *table = &uts_kern_table[proc];
|
|
|
|
+
|
|
|
|
+ proc_sys_poll_notify(table->poll);
|
|
|
|
+}
|
|
|
|
+#endif
|
|
|
|
+
|
|
static int __init utsname_sysctl_init(void)
|
|
static int __init utsname_sysctl_init(void)
|
|
{
|
|
{
|
|
register_sysctl_table(uts_root_table);
|
|
register_sysctl_table(uts_root_table);
|