1 | /*
|
---|
2 | Unix SMB/CIFS implementation.
|
---|
3 | Common server globals
|
---|
4 |
|
---|
5 | Copyright (C) Simo Sorce <idra@samba.org> 2010
|
---|
6 |
|
---|
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.
|
---|
11 |
|
---|
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.
|
---|
16 |
|
---|
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/>.
|
---|
19 | */
|
---|
20 |
|
---|
21 | #include "includes.h"
|
---|
22 | #include "messages.h"
|
---|
23 |
|
---|
24 | struct tevent_context *server_event_ctx = NULL;
|
---|
25 |
|
---|
26 | struct tevent_context *server_event_context(void)
|
---|
27 | {
|
---|
28 | if (!server_event_ctx) {
|
---|
29 | /*
|
---|
30 | * Note we MUST use the NULL context here, not the
|
---|
31 | * autofree context, to avoid side effects in forked
|
---|
32 | * children exiting.
|
---|
33 | */
|
---|
34 | server_event_ctx = s3_tevent_context_init(NULL);
|
---|
35 | }
|
---|
36 | if (!server_event_ctx) {
|
---|
37 | smb_panic("Could not init server's event context");
|
---|
38 | }
|
---|
39 | return server_event_ctx;
|
---|
40 | }
|
---|
41 |
|
---|
42 | void server_event_context_free(void)
|
---|
43 | {
|
---|
44 | TALLOC_FREE(server_event_ctx);
|
---|
45 | }
|
---|
46 |
|
---|
47 | struct messaging_context *server_msg_ctx = NULL;
|
---|
48 |
|
---|
49 | struct messaging_context *server_messaging_context(void)
|
---|
50 | {
|
---|
51 | if (server_msg_ctx == NULL) {
|
---|
52 | /*
|
---|
53 | * Note we MUST use the NULL context here, not the
|
---|
54 | * autofree context, to avoid side effects in forked
|
---|
55 | * children exiting.
|
---|
56 | */
|
---|
57 | server_msg_ctx = messaging_init(NULL,
|
---|
58 | procid_self(),
|
---|
59 | server_event_context());
|
---|
60 | }
|
---|
61 | return server_msg_ctx;
|
---|
62 | }
|
---|
63 |
|
---|
64 | void server_messaging_context_free(void)
|
---|
65 | {
|
---|
66 | TALLOC_FREE(server_msg_ctx);
|
---|
67 | }
|
---|