mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-08 08:07:10 +02:00
MINOR: trace: add allocation of buffer-sized trace buffers
This will be needed so that we can implement protocol decoders which will have to emit their contents into such a buffer.
This commit is contained in:
parent
4151c753fc
commit
88ebd4050e
@ -32,6 +32,7 @@
|
|||||||
#include <types/trace.h>
|
#include <types/trace.h>
|
||||||
|
|
||||||
extern struct list trace_sources;
|
extern struct list trace_sources;
|
||||||
|
extern THREAD_LOCAL struct buffer trace_buf;
|
||||||
|
|
||||||
/* registers trace source <source>. Modifies the list element!
|
/* registers trace source <source>. Modifies the list element!
|
||||||
* The {start,pause,stop,report} events are not changed so the source may
|
* The {start,pause,stop,report} events are not changed so the source may
|
||||||
|
17
src/trace.c
17
src/trace.c
@ -27,7 +27,24 @@
|
|||||||
#include <proto/trace.h>
|
#include <proto/trace.h>
|
||||||
|
|
||||||
struct list trace_sources = LIST_HEAD_INIT(trace_sources);
|
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:
|
* Local variables:
|
||||||
* c-indent-level: 8
|
* c-indent-level: 8
|
||||||
|
Loading…
Reference in New Issue
Block a user