diff options
author | Ralf Baechle <ralf@linux-mips.org> | 1997-12-16 05:34:03 +0000 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 1997-12-16 05:34:03 +0000 |
commit | 967c65a99059fd459b956c1588ce0ba227912c4e (patch) | |
tree | 8224d013ff5d255420713d05610c7efebd204d2a /net/unix | |
parent | e20c1cc1656a66a2773bca4591a895cbc12696ff (diff) |
Merge with Linux 2.1.72, part 1.
Diffstat (limited to 'net/unix')
-rw-r--r-- | net/unix/Makefile | 1 | ||||
-rw-r--r-- | net/unix/af_unix.c | 41 | ||||
-rw-r--r-- | net/unix/sysctl_net_unix.c | 29 |
3 files changed, 70 insertions, 1 deletions
diff --git a/net/unix/Makefile b/net/unix/Makefile index afce06790..f0bebfae3 100644 --- a/net/unix/Makefile +++ b/net/unix/Makefile @@ -9,6 +9,7 @@ O_TARGET := unix.o O_OBJS := af_unix.o garbage.o +M_OBJS := $(O_TARGET) ifeq ($(CONFIG_SYSCTL),y) O_OBJS += sysctl_net_unix.o diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index 936d61220..1a9baa549 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c @@ -26,6 +26,7 @@ * Alan Cox : Started POSIXisms * Andreas Schwab : Replace inode by dentry for proper * reference counting + * Kirk Petersen : Made this a module * * Known differences from reference BSD that was tested: * @@ -57,6 +58,7 @@ * with BSD names. */ +#include <linux/module.h> #include <linux/config.h> #include <linux/kernel.h> #include <linux/major.h> @@ -310,6 +312,9 @@ static void unix_destroy_socket(unix_socket *sk) sk->dead=1; unix_delayed_delete(sk); /* Try every so often until buffers are all freed */ } + + /* socket destroyed, decrement count */ + MOD_DEC_USE_COUNT; } static int unix_listen(struct socket *sock, int backlog) @@ -373,6 +378,10 @@ static int unix_create(struct socket *sock, int protocol) sk->mtu=4096; sk->protinfo.af_unix.list=&unix_sockets_unbound; unix_insert_socket(sk); + + /* socket created, increment count */ + MOD_INC_USE_COUNT; + return 0; } @@ -1465,7 +1474,16 @@ struct net_proto_family unix_family_ops = { unix_create }; +#ifdef MODULE +#ifdef CONFIG_SYSCTL +extern void unix_sysctl_register(void); +extern void unix_sysctl_unregister(void); +#endif + +int init_module(void) +#else __initfunc(void unix_proto_init(struct net_proto *pro)) +#endif { struct sk_buff *dummy_skb; struct proc_dir_entry *ent; @@ -1474,14 +1492,37 @@ __initfunc(void unix_proto_init(struct net_proto *pro)) if (sizeof(struct unix_skb_parms) > sizeof(dummy_skb->cb)) { printk(KERN_CRIT "unix_proto_init: panic\n"); +#ifdef MODULE + return -1; +#else return; +#endif } sock_register(&unix_family_ops); #ifdef CONFIG_PROC_FS ent = create_proc_entry("net/unix", 0, 0); ent->read_proc = unix_read_proc; #endif + +#ifdef MODULE +#ifdef CONFIG_SYSCTL + unix_sysctl_register(); +#endif + + return 0; +#endif } + +#ifdef MODULE +void cleanup_module(void) +{ + sock_unregister(AF_UNIX); +#ifdef CONFIG_SYSCTL + unix_sysctl_unregister(); +#endif +} +#endif + /* * Local variables: * compile-command: "gcc -g -D__KERNEL__ -Wall -O6 -I/usr/src/linux/include -c af_unix.c" diff --git a/net/unix/sysctl_net_unix.c b/net/unix/sysctl_net_unix.c index f487ae95a..d492e8e2b 100644 --- a/net/unix/sysctl_net_unix.c +++ b/net/unix/sysctl_net_unix.c @@ -29,4 +29,31 @@ ctl_table unix_table[] = { &proc_dointvec_jiffies}, {0} }; -#endif + +#ifdef MODULE +static struct ctl_table_header * unix_sysctl_header; +static struct ctl_table unix_root_table[]; +static struct ctl_table unix_net_table[]; + +ctl_table unix_root_table[] = { + {CTL_NET, "net", NULL, 0, 0555, unix_net_table}, + {0} +}; + +ctl_table unix_net_table[] = { + {NET_UNIX, "unix", NULL, 0, 0555, unix_table}, + {0} +}; + +void unix_sysctl_register(void) +{ + unix_sysctl_header = register_sysctl_table(unix_root_table, 0); +} + +void unix_sysctl_unregister(void) +{ + unregister_sysctl_table(unix_sysctl_header); +} +#endif /* MODULE */ + +#endif /* CONFIG_SYSCTL */ |