2005-04-16 15:20:36 -07: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-15 22:18:02 -07:00
|
|
|
#include <net/af_unix.h>
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
static ctl_table unix_table[] = {
|
|
|
|
{
|
|
|
|
.ctl_name = NET_UNIX_MAX_DGRAM_QLEN,
|
|
|
|
.procname = "max_dgram_qlen",
|
2007-12-11 05:19:17 -07:00
|
|
|
.data = &init_net.unx.sysctl_max_dgram_qlen,
|
2005-04-16 15:20:36 -07:00
|
|
|
.maxlen = sizeof(int),
|
|
|
|
.mode = 0644,
|
|
|
|
.proc_handler = &proc_dointvec
|
|
|
|
},
|
|
|
|
{ .ctl_name = 0 }
|
|
|
|
};
|
|
|
|
|
2007-12-01 05:45:41 -07:00
|
|
|
static struct ctl_path unix_path[] = {
|
|
|
|
{ .procname = "net", .ctl_name = CTL_NET, },
|
|
|
|
{ .procname = "unix", .ctl_name = NET_UNIX, },
|
|
|
|
{ },
|
2005-04-16 15:20:36 -07:00
|
|
|
};
|
|
|
|
|
2007-12-01 05:40:40 -07:00
|
|
|
int unix_sysctl_register(struct net *net)
|
2005-04-16 15:20:36 -07:00
|
|
|
{
|
2007-12-01 05:51:01 -07:00
|
|
|
struct ctl_table *table;
|
|
|
|
|
|
|
|
table = kmemdup(unix_table, sizeof(unix_table), GFP_KERNEL);
|
|
|
|
if (table == NULL)
|
|
|
|
goto err_alloc;
|
|
|
|
|
2007-12-11 05:19:17 -07: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 05:51:01 -07:00
|
|
|
goto err_reg;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
err_reg:
|
|
|
|
kfree(table);
|
|
|
|
err_alloc:
|
|
|
|
return -ENOMEM;
|
2005-04-16 15:20:36 -07:00
|
|
|
}
|
|
|
|
|
2007-12-01 05:40:40 -07:00
|
|
|
void unix_sysctl_unregister(struct net *net)
|
2005-04-16 15:20:36 -07:00
|
|
|
{
|
2007-12-01 05:51:01 -07:00
|
|
|
struct ctl_table *table;
|
|
|
|
|
2007-12-11 05:19:17 -07:00
|
|
|
table = net->unx.ctl->ctl_table_arg;
|
|
|
|
unregister_sysctl_table(net->unx.ctl);
|
2007-12-01 05:51:01 -07:00
|
|
|
kfree(table);
|
2005-04-16 15:20:36 -07:00
|
|
|
}
|
|
|
|
|