mirror of
https://github.com/haproxy/haproxy.git
synced 2026-04-27 09:06:46 -04:00
This will be needed so that we can implement protocol decoders which will have to emit their contents into such a buffer.
53 lines
1.6 KiB
C
53 lines
1.6 KiB
C
/*
|
|
* Runtime tracing API
|
|
*
|
|
* Copyright (C) 2000-2019 Willy Tarreau - w@1wt.eu
|
|
*
|
|
* This library is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
* License as published by the Free Software Foundation, version 2.1
|
|
* exclusively.
|
|
*
|
|
* This library is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
* Lesser General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
* License along with this library; if not, write to the Free Software
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
*/
|
|
|
|
#include <common/buffer.h>
|
|
#include <common/compat.h>
|
|
#include <common/config.h>
|
|
#include <common/ist.h>
|
|
#include <common/mini-clist.h>
|
|
#include <proto/log.h>
|
|
#include <proto/trace.h>
|
|
|
|
struct list trace_sources = LIST_HEAD_INIT(trace_sources);
|
|
THREAD_LOCAL struct buffer trace_buf = { };
|
|
|
|
/* allocates the trace buffers. Returns 0 in case of failure. It is safe to
|
|
* call to call this function multiple times if the size changes.
|
|
*/
|
|
static int alloc_trace_buffers_per_thread()
|
|
{
|
|
chunk_init(&trace_buf, my_realloc2(trace_buf.area, global.tune.bufsize), global.tune.bufsize);
|
|
return !!trash.area;
|
|
}
|
|
|
|
static void free_trace_buffers_per_thread()
|
|
{
|
|
chunk_destroy(&trace_buf);
|
|
}
|
|
|
|
REGISTER_PER_THREAD_ALLOC(alloc_trace_buffers_per_thread);
|
|
REGISTER_PER_THREAD_FREE(free_trace_buffers_per_thread);
|
|
/*
|
|
* Local variables:
|
|
* c-indent-level: 8
|
|
* c-basic-offset: 8
|
|
* End:
|
|
*/
|