1 /*****************************************************************************
2 * RRDtool 1.2rc9 Copyright by Tobi Oetiker, 1997-2005
3 * This file: Copyright 2003 Peter Stamfest <peter@stamfest.at>
4 * & Tobias Oetiker
5 * Distributed under the GPL
6 *****************************************************************************
7 * rrd_not_thread_safe.c Contains routines used when thread safety is not
8 * an issue
9 *****************************************************************************
10 * $Id$
11 *************************************************************************** */
12 #include "rrd.h"
13 #include "rrd_tool.h"
14 #define MAXLEN 4096
15 #define ERRBUFLEN 256
17 static char rrd_error[MAXLEN] = "\0";
18 static char rrd_liberror[ERRBUFLEN] = "\0";
19 /* The global context is very useful in the transition period to even
20 more thread-safe stuff, it can be used whereever we need a context
21 and do not need to worry about concurrency. */
22 static struct rrd_context global_ctx = {
23 sizeof(rrd_error),
24 sizeof(rrd_liberror),
25 rrd_error,
26 rrd_liberror
27 };
28 #include <stdarg.h>
30 struct rrd_context *rrd_get_context() {
31 return &global_ctx;
32 }
34 /* how ugly that is!!! - make sure strerror is what it should be. It
35 might be redefined to help in keeping other modules thread safe by
36 silently turning misplaced strerror into rrd_strerror, but here
37 this turns recursive! */
38 #undef strerror
39 const char *rrd_strerror(int err) {
40 return strerror(err);
41 }