s4:rootdse LDB module - remove unused variable
[Samba/gebeck_regimport.git] / source3 / lib / server_contexts.c
blobf8fe9dceacb34b6280458836a56158c861a04c76
1 /*
2 Unix SMB/CIFS implementation.
3 Common server globals
5 Copyright (C) Simo Sorce <idra@samba.org> 2010
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>.
21 #include "includes.h"
23 struct tevent_context *server_event_ctx = NULL;
25 struct tevent_context *server_event_context(void)
27 if (!server_event_ctx) {
29 * Note we MUST use the NULL context here, not the
30 * autofree context, to avoid side effects in forked
31 * children exiting.
33 server_event_ctx = s3_tevent_context_init(NULL);
35 if (!server_event_ctx) {
36 smb_panic("Could not init server's event context");
38 return server_event_ctx;
41 void server_event_context_free(void)
43 TALLOC_FREE(server_event_ctx);
46 struct messaging_context *server_msg_ctx = NULL;
48 struct messaging_context *server_messaging_context(void)
50 if (server_msg_ctx == NULL) {
52 * Note we MUST use the NULL context here, not the
53 * autofree context, to avoid side effects in forked
54 * children exiting.
56 server_msg_ctx = messaging_init(NULL,
57 procid_self(),
58 server_event_context());
60 return server_msg_ctx;
63 void server_messaging_context_free(void)
65 TALLOC_FREE(server_msg_ctx);