Unlike Linux or Solaris, errno under AIX is not thread-safe by default. This patch sets _THREAD_SAFE_ERRNO when AIX is detected in order to force the thread-safe implementation of errno. Without this, calls like stat() in the rrdtool plugin fail with errno incorrectly set, leading to the inability to create previously absent rrd files.
Maybe _THREAD_SAFE should be set instead, to prevent other possible threads-related problems, but this is enough to scratch my current itch... Here is the relevant part of /usr/include/errno.h on AIX: #if defined(_THREAD_SAFE) || defined(_THREAD_SAFE_ERRNO) /* * Per thread errno is provided by the threads provider. Both the extern * int * and the per thread value must be maintained by the threads library. */ extern int *_Errno( void ); #define errno (*_Errno()) #else extern int errno; #endif /* _THREAD_SAFE || _THREAD_SAFE_ERRNO */ Signed-off-by: Aurelien Reynaud <[email protected]> --- configure.in | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/configure.in b/configure.in index 13a1f9d..6622faa 100644 --- a/configure.in +++ b/configure.in @@ -91,6 +91,10 @@ if test "x$ac_system" = "xSolaris" then AC_DEFINE(_POSIX_PTHREAD_SEMANTICS, 1, [Define to enforce POSIX thread semantics under Solaris.]) fi +if test "x$ac_system" = "xAIX" +then + AC_DEFINE(_THREAD_SAFE_ERRNO, 1, [Define to use the thread-safe version of errno under AIX.]) +fi # Where to install .pc files. pkgconfigdir="${libdir}/pkgconfig" -- 1.7.1 _______________________________________________ collectd mailing list [email protected] http://mailman.verplant.org/listinfo/collectd
