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