From: Ralph Wuerthner Date: Fri, 29 Mar 2019 11:30:45 +0000 (+0100) Subject: s3-messages: modify msg_pool_usage() to allow enhanced memory reports X-Git-Tag: tdb-1.4.1~524 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b4d4778dd2c5831204fb484a6c6872ab3cbebf01;p=thirdparty%2Fsamba.git s3-messages: modify msg_pool_usage() to allow enhanced memory reports Signed-off-by: Ralph Wuerthner Reviewed-by: Jeremy Allison Reviewed-by: Christof Schmitt --- diff --git a/source3/lib/tallocmsg.c b/source3/lib/tallocmsg.c index 18b16edfc8f..b5ab21c5661 100644 --- a/source3/lib/tallocmsg.c +++ b/source3/lib/tallocmsg.c @@ -30,21 +30,32 @@ static void msg_pool_usage(struct messaging_context *msg_ctx, struct server_id src, DATA_BLOB *data) { - char *report; + char *report = NULL; + int iov_size = 0; + struct iovec iov[1]; SMB_ASSERT(msg_type == MSG_REQ_POOL_USAGE); DEBUG(2,("Got POOL_USAGE\n")); report = talloc_report_str(msg_ctx, NULL); - if (report != NULL) { - messaging_send_buf(msg_ctx, src, MSG_POOL_USAGE, - (uint8_t *)report, - talloc_get_size(report)-1); + iov[iov_size].iov_base = report; + iov[iov_size].iov_len = talloc_get_size(report) - 1; + iov_size++; + } + + if (iov_size) { + messaging_send_iov(msg_ctx, + src, + MSG_POOL_USAGE, + iov, + iov_size, + NULL, + 0); } - talloc_free(report); + TALLOC_FREE(report); } /**