1 /* main.c: Rx RPC interface
3 * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
12 #include <linux/module.h>
13 #include <linux/init.h>
14 #include <linux/sched.h>
15 #include <rxrpc/rxrpc.h>
16 #include <rxrpc/krxiod.h>
17 #include <rxrpc/krxsecd.h>
18 #include <rxrpc/krxtimod.h>
19 #include <rxrpc/transport.h>
20 #include <rxrpc/connection.h>
21 #include <rxrpc/call.h>
22 #include <rxrpc/message.h>
25 static int rxrpc_initialise(void);
26 static void rxrpc_cleanup(void);
28 module_init(rxrpc_initialise
);
29 module_exit(rxrpc_cleanup
);
31 MODULE_DESCRIPTION("Rx RPC implementation");
32 MODULE_AUTHOR("Red Hat, Inc.");
33 MODULE_LICENSE("GPL");
37 /*****************************************************************************/
39 * initialise the Rx module
41 static int rxrpc_initialise(void)
46 rxrpc_epoch
= htonl(xtime
.tv_sec
);
48 /* register the /proc interface */
50 ret
= rxrpc_proc_init();
55 /* register the sysctl files */
57 ret
= rxrpc_sysctl_init();
62 /* start the krxtimod daemon */
63 ret
= rxrpc_krxtimod_start();
67 /* start the krxiod daemon */
68 ret
= rxrpc_krxiod_init();
72 /* start the krxsecd daemon */
73 ret
= rxrpc_krxsecd_init();
84 rxrpc_krxtimod_kill();
87 rxrpc_sysctl_cleanup();
94 } /* end rxrpc_initialise() */
96 /*****************************************************************************/
98 * clean up the Rx module
100 static void __exit
rxrpc_cleanup(void)
104 __RXACCT(printk("Outstanding Messages : %d\n",
105 atomic_read(&rxrpc_message_count
)));
106 __RXACCT(printk("Outstanding Calls : %d\n",
107 atomic_read(&rxrpc_call_count
)));
108 __RXACCT(printk("Outstanding Connections: %d\n",
109 atomic_read(&rxrpc_connection_count
)));
110 __RXACCT(printk("Outstanding Peers : %d\n",
111 atomic_read(&rxrpc_peer_count
)));
112 __RXACCT(printk("Outstanding Transports : %d\n",
113 atomic_read(&rxrpc_transport_count
)));
115 rxrpc_krxsecd_kill();
117 rxrpc_krxtimod_kill();
119 rxrpc_sysctl_cleanup();
121 #ifdef CONFIG_PROC_FS
122 rxrpc_proc_cleanup();
125 __RXACCT(printk("Outstanding Messages : %d\n",
126 atomic_read(&rxrpc_message_count
)));
127 __RXACCT(printk("Outstanding Calls : %d\n",
128 atomic_read(&rxrpc_call_count
)));
129 __RXACCT(printk("Outstanding Connections: %d\n",
130 atomic_read(&rxrpc_connection_count
)));
131 __RXACCT(printk("Outstanding Peers : %d\n",
132 atomic_read(&rxrpc_peer_count
)));
133 __RXACCT(printk("Outstanding Transports : %d\n",
134 atomic_read(&rxrpc_transport_count
)));
137 } /* end rxrpc_cleanup() */
139 /*****************************************************************************/
141 * clear the dead space between task_struct and kernel stack
142 * - called by supplying -finstrument-functions to gcc
145 void __cyg_profile_func_enter (void *this_fn
, void *call_site
)
146 __attribute__((no_instrument_function
));
148 void __cyg_profile_func_enter (void *this_fn
, void *call_site
)
150 asm volatile(" movl %%esp,%%edi \n"
153 " movl %%esp,%%ecx \n"
154 " subl %%edi,%%ecx \n"
156 " movl $0xedededed,%%eax \n"
159 : "i"(~(THREAD_SIZE
-1)), "i"(sizeof(struct thread_info
))
160 : "eax", "ecx", "edi", "memory", "cc"
164 void __cyg_profile_func_exit(void *this_fn
, void *call_site
)
165 __attribute__((no_instrument_function
));
167 void __cyg_profile_func_exit(void *this_fn
, void *call_site
)
169 asm volatile(" movl %%esp,%%edi \n"
172 " movl %%esp,%%ecx \n"
173 " subl %%edi,%%ecx \n"
175 " movl $0xdadadada,%%eax \n"
178 : "i"(~(THREAD_SIZE
-1)), "i"(sizeof(struct thread_info
))
179 : "eax", "ecx", "edi", "memory", "cc"