summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: abca4ca)
raw | patch | inline | side by side (parent: abca4ca)
author | Aurelien Reynaud <collectd@wattapower.net> | |
Sat, 19 Jun 2010 18:03:52 +0000 (20:03 +0200) | ||
committer | Florian Forster <octo@huhu.verplant.org> | |
Sat, 11 Sep 2010 09:08:47 +0000 (11:08 +0200) |
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 <collectd@wattapower.net>
Signed-off-by: Florian Forster <octo@huhu.verplant.org>
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 <collectd@wattapower.net>
Signed-off-by: Florian Forster <octo@huhu.verplant.org>
configure.in | patch | blob | history |
diff --git a/configure.in b/configure.in
index 3e31cf2a6de15bb46f65a35fa4ad2d11644d4495..8f6eadeedfc825cc74cf60a20b5d6f4d339712fd 100644 (file)
--- a/configure.in
+++ b/configure.in
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"