2 samba -- Unix SMB/CIFS implementation.
3 Copyright (C) 2001, 2002 by Martin Pool
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 3 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
20 #include "source3/include/messages.h"
21 #include "source3/lib/tallocmsg.h"
22 #include "lib/util/talloc_report_printf.h"
23 #include "lib/util/debug.h"
24 #include "lib/util/util_file.h"
26 static bool pool_usage_filter(struct messaging_rec
*rec
, void *private_data
)
30 if (rec
->msg_type
!= MSG_REQ_POOL_USAGE
) {
34 DBG_DEBUG("Got MSG_REQ_POOL_USAGE\n");
36 if (rec
->num_fds
!= 1) {
37 DBG_DEBUG("Got %"PRIu8
" fds, expected one\n", rec
->num_fds
);
41 f
= fdopen_keepfd(rec
->fds
[0], "w");
43 DBG_DEBUG("fdopen failed: %s\n", strerror(errno
));
47 talloc_full_report_printf(NULL
, f
);
51 * Returning false, means messaging_dispatch_waiters()
52 * won't call messaging_filtered_read_done() and
53 * our messaging_filtered_read_send() stays alive
54 * and will get messages.
60 * Register handler for MSG_REQ_POOL_USAGE
62 void register_msg_pool_usage(
63 TALLOC_CTX
*mem_ctx
, struct messaging_context
*msg_ctx
)
65 struct tevent_req
*req
= NULL
;
67 req
= messaging_filtered_read_send(
69 messaging_tevent_context(msg_ctx
),
74 DBG_WARNING("messaging_filtered_read_send failed\n");
77 DBG_INFO("Registered MSG_REQ_POOL_USAGE\n");