Exemplo n.º 1
0
/**
 * Respond to a POOL_USAGE message by sending back string form of memory
 * usage stats.
 **/
static void msg_pool_usage(struct messaging_context *msg_ctx,
			   void *private_data, 
			   uint32_t msg_type, 
			   struct server_id src,
			   DATA_BLOB *data)
{
	struct msg_pool_usage_state state;

	SMB_ASSERT(msg_type == MSG_REQ_POOL_USAGE);
	
	DEBUG(2,("Got POOL_USAGE\n"));

	state.mem_ctx = talloc_init("msg_pool_usage");
	if (!state.mem_ctx) {
		return;
	}
	state.len	= 0;
	state.buflen	= 512;
	state.s		= NULL;

	talloc_report_depth_cb(NULL, 0, -1, msg_pool_usage_helper, &state);

	if (!state.s) {
		talloc_destroy(state.mem_ctx);
		return;
	}
	
	messaging_send_buf(msg_ctx, src, MSG_POOL_USAGE,
			   (uint8 *)state.s, strlen(state.s)+1);

	talloc_destroy(state.mem_ctx);
}
Exemplo n.º 2
0
/**
 * Respond to a POOL_USAGE message by sending back string form of memory
 * usage stats.
 **/
void msg_pool_usage(int msg_type, struct process_id src_pid,
		    void *UNUSED(buf), size_t UNUSED(len),
		    void *private_data)
{
	struct msg_pool_usage_state state;

	SMB_ASSERT(msg_type == MSG_REQ_POOL_USAGE);
	
	DEBUG(2,("Got POOL_USAGE\n"));

	state.mem_ctx = talloc_init("msg_pool_usage");
	if (!state.mem_ctx) {
		return;
	}
	state.len	= 0;
	state.buflen	= 512;
	state.s		= NULL;

	talloc_report_depth_cb(NULL, 0, -1, msg_pool_usage_helper, &state);

	if (!state.s) {
		talloc_destroy(state.mem_ctx);
		return;
	}
	
	message_send_pid(src_pid, MSG_POOL_USAGE,
			 state.s, strlen(state.s)+1, True);

	talloc_destroy(state.mem_ctx);
}
Exemplo n.º 3
0
/** Free a VALUE_PAIR
 *
 * @note Do not call directly, use talloc_free instead.
 *
 * @param vp to free.
 * @return 0
 */
static int _pairfree(VALUE_PAIR *vp) {
#ifndef NDEBUG
	vp->vp_integer = FREE_MAGIC;
#endif

#ifdef TALLOC_DEBUG
	talloc_report_depth_cb(NULL, 0, -1, fr_talloc_verify_cb, NULL);
#endif
	return 0;
}