2005-04-17 06:20:36 +08:00
|
|
|
/*
|
|
|
|
* NET4: Sysctl interface to net af_unix subsystem.
|
|
|
|
*
|
|
|
|
* Authors: Mike Shaver.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version
|
|
|
|
* 2 of the License, or (at your option) any later version.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/mm.h>
|
|
|
|
#include <linux/sysctl.h>
|
|
|
|
|
2005-08-16 13:18:02 +08:00
|
|
|
#include <net/af_unix.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
static ctl_table unix_table[] = {
|
|
|
|
{
|
|
|
|
.procname = "max_dgram_qlen",
|
2007-12-11 20:19:17 +08:00
|
|
|
.data = &init_net.unx.sysctl_max_dgram_qlen,
|
2005-04-17 06:20:36 +08:00
|
|
|
.maxlen = sizeof(int),
|
|
|
|
.mode = 0644,
|
2008-11-04 10:21:05 +08:00
|
|
|
.proc_handler = proc_dointvec
|
2005-04-17 06:20:36 +08:00
|
|
|
},
|
2009-11-06 05:32:03 +08:00
|
|
|
{ }
|
2005-04-17 06:20:36 +08:00
|
|
|
};
|
|
|
|
|
2007-12-01 20:45:41 +08:00
|
|
|
static struct ctl_path unix_path[] = {
|
2009-11-06 05:32:03 +08:00
|
|
|
{ .procname = "net", },
|
|
|
|
{ .procname = "unix", },
|
2007-12-01 20:45:41 +08:00
|
|
|
{ },
|
2005-04-17 06:20:36 +08:00
|
|
|
};
|
|
|
|
|
2007-12-01 20:40:40 +08:00
|
|
|
int unix_sysctl_register(struct net *net)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2007-12-01 20:51:01 +08:00
|
|
|
struct ctl_table *table;
|
|
|
|
|
|
|
|
table = kmemdup(unix_table, sizeof(unix_table), GFP_KERNEL);
|
|
|
|
if (table == NULL)
|
|
|
|
goto err_alloc;
|
|
|
|
|
2007-12-11 20:19:17 +08:00
|
|
|
table[0].data = &net->unx.sysctl_max_dgram_qlen;
|
|
|
|
net->unx.ctl = register_net_sysctl_table(net, unix_path, table);
|
|
|
|
if (net->unx.ctl == NULL)
|
2007-12-01 20:51:01 +08:00
|
|
|
goto err_reg;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
err_reg:
|
|
|
|
kfree(table);
|
|
|
|
err_alloc:
|
|
|
|
return -ENOMEM;
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2007-12-01 20:40:40 +08:00
|
|
|
void unix_sysctl_unregister(struct net *net)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2007-12-01 20:51:01 +08:00
|
|
|
struct ctl_table *table;
|
|
|
|
|
2007-12-11 20:19:17 +08:00
|
|
|
table = net->unx.ctl->ctl_table_arg;
|
|
|
|
unregister_sysctl_table(net->unx.ctl);
|
2007-12-01 20:51:01 +08:00
|
|
|
kfree(table);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|