Blame view

net/unix/sysctl_net_unix.c 1.3 KB
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1
2
3
4
5
6
7
8
9
10
11
12
  /*
   * 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>
5a0e3ad6a   Tejun Heo   include cleanup: ...
13
  #include <linux/slab.h>
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
14
  #include <linux/sysctl.h>
20380731b   Arnaldo Carvalho de Melo   [NET]: Fix sparse...
15
  #include <net/af_unix.h>
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
16
17
18
  
  static ctl_table unix_table[] = {
  	{
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
19
  		.procname	= "max_dgram_qlen",
a0a53c8ba   Denis V. Lunev   [NETNS]: struct n...
20
  		.data		= &init_net.unx.sysctl_max_dgram_qlen,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
21
22
  		.maxlen		= sizeof(int),
  		.mode		= 0644,
6d9f239a1   Alexey Dobriyan   net: '&' redux
23
  		.proc_handler	= proc_dointvec
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
24
  	},
f8572d8f2   Eric W. Biederman   sysctl net: Remov...
25
  	{ }
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
26
  };
1d430b913   Pavel Emelyanov   [UNIX]: Use ctl p...
27
  static struct ctl_path unix_path[] = {
f8572d8f2   Eric W. Biederman   sysctl net: Remov...
28
29
  	{ .procname = "net", },
  	{ .procname = "unix", },
1d430b913   Pavel Emelyanov   [UNIX]: Use ctl p...
30
  	{ },
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
31
  };
2c8c1e729   Alexey Dobriyan   net: spread __net...
32
  int __net_init unix_sysctl_register(struct net *net)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
33
  {
1597fbc0f   Pavel Emelyanov   [UNIX]: Make the ...
34
35
36
37
38
  	struct ctl_table *table;
  
  	table = kmemdup(unix_table, sizeof(unix_table), GFP_KERNEL);
  	if (table == NULL)
  		goto err_alloc;
a0a53c8ba   Denis V. Lunev   [NETNS]: struct n...
39
40
41
  	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)
1597fbc0f   Pavel Emelyanov   [UNIX]: Make the ...
42
43
44
45
46
47
48
49
  		goto err_reg;
  
  	return 0;
  
  err_reg:
  	kfree(table);
  err_alloc:
  	return -ENOMEM;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
50
  }
97577e382   Pavel Emelyanov   [UNIX]: Extend un...
51
  void unix_sysctl_unregister(struct net *net)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
52
  {
1597fbc0f   Pavel Emelyanov   [UNIX]: Make the ...
53
  	struct ctl_table *table;
a0a53c8ba   Denis V. Lunev   [NETNS]: struct n...
54
55
  	table = net->unx.ctl->ctl_table_arg;
  	unregister_sysctl_table(net->unx.ctl);
1597fbc0f   Pavel Emelyanov   [UNIX]: Make the ...
56
  	kfree(table);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
57
  }