Included is patch removing strftime and replace it:
- first version with ISO style date format (2009-11-04 10:40:40 ...)
- second version with output similar to what we have now (Dec 04 ...)
Choose what you prefer more.
Regards,
Honza
Steven Dake napsal(a):
With your help about the getenv() api not being thread safe, we were
able to diagnose the problem being with libc's strftime not being thread
safe because it calls getenv(). According to posix, strftime should be
threads safe.
You can follow the bug progress here:
https://bugzilla.redhat.com/show_bug.cgi?id=544022
Regards
-steve
On Wed, 2009-12-02 at 18:27 +0100, Raphael Mazelier wrote:
Le 02/12/2009 18:04, hj lee a écrit :
This issue is reported many times, but no clean solution yet. Turning
off timestmap option is openais.conf (or corosync.conf) was suggested
to prevent this issue by openais developer. Please try it (timestam: off).
Thanks
hj
OK it's fix the problem for me. But I think there is something to
rethink in the init phase.
Thks.
--
Raphael Mazelier
_______________________________________________
Openais mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/openais
_______________________________________________
Openais mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/openais
commit 91680a627bcd2bd6d2fdd05a614fe1f66988575c
Author: Jan Friesse <[email protected]>
Date: Fri Dec 4 10:47:18 2009 +0100
Remove strftime and print in ISO format
Also remove unnecessary check in configure.ac
diff --git a/trunk/configure.ac b/trunk/configure.ac
index eb733eb..808417a 100644
--- a/trunk/configure.ac
+++ b/trunk/configure.ac
@@ -110,7 +110,6 @@ AC_FUNC_MEMCMP
AC_FUNC_REALLOC
AC_FUNC_SELECT_ARGTYPES
AC_TYPE_SIGNAL
-AC_FUNC_STRFTIME
AC_FUNC_VPRINTF
AC_CHECK_FUNCS([alarm alphasort atexit bzero dup2 endgrent endpwent fcntl \
getcwd getpeerucred getpeereid gettimeofday inet_ntoa memmove \
diff --git a/trunk/exec/logsys.c b/trunk/exec/logsys.c
index 1471bcd..a1675e8 100644
--- a/trunk/exec/logsys.c
+++ b/trunk/exec/logsys.c
@@ -441,6 +441,7 @@ static void log_printf_to_logs (
int subsysid;
unsigned int level;
int c;
+ struct tm tm_res;
if (LOGSYS_DECODE_RECID(rec_ident) != LOGSYS_RECID_LOG) {
return;
@@ -490,7 +491,10 @@ static void log_printf_to_logs (
case 't':
gettimeofday (&tv, NULL);
- (void)strftime (char_time, sizeof (char_time), "%b %d %T", localtime ((time_t *)&tv.tv_sec));
+ (void)localtime_r ((time_t *)&tv.tv_sec, &tm_res);
+ snprintf (char_time, sizeof (char_time), "%04d-%02d-%02d %02d:%02d:%02d",
+ tm_res.tm_year + 1900, tm_res.tm_mon, tm_res.tm_mday, tm_res.tm_hour,
+ tm_res.tm_min, tm_res.tm_sec);
normal_p = char_time;
/*
diff --git a/trunk/configure.ac b/trunk/configure.ac
index eb733eb..808417a 100644
--- a/trunk/configure.ac
+++ b/trunk/configure.ac
@@ -110,7 +110,6 @@ AC_FUNC_MEMCMP
AC_FUNC_REALLOC
AC_FUNC_SELECT_ARGTYPES
AC_TYPE_SIGNAL
-AC_FUNC_STRFTIME
AC_FUNC_VPRINTF
AC_CHECK_FUNCS([alarm alphasort atexit bzero dup2 endgrent endpwent fcntl \
getcwd getpeerucred getpeereid gettimeofday inet_ntoa memmove \
diff --git a/trunk/exec/logsys.c b/trunk/exec/logsys.c
index 1471bcd..d43f983 100644
--- a/trunk/exec/logsys.c
+++ b/trunk/exec/logsys.c
@@ -410,6 +410,11 @@ static inline int strcpy_cutoff (char *dest, const char *src, size_t cutoff,
return (cutoff);
}
+static const char log_month_name[][4] = {
+ "Jan", "Feb", "Mar", "Apr", "May", "Jun",
+ "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
+};
+
/*
* %s SUBSYSTEM
* %n FUNCTION NAME
@@ -441,6 +446,7 @@ static void log_printf_to_logs (
int subsysid;
unsigned int level;
int c;
+ struct tm tm_res;
if (LOGSYS_DECODE_RECID(rec_ident) != LOGSYS_RECID_LOG) {
return;
@@ -490,7 +496,10 @@ static void log_printf_to_logs (
case 't':
gettimeofday (&tv, NULL);
- (void)strftime (char_time, sizeof (char_time), "%b %d %T", localtime ((time_t *)&tv.tv_sec));
+ (void)localtime_r ((time_t *)&tv.tv_sec, &tm_res);
+ snprintf (char_time, sizeof (char_time), "%s %02d %02d:%02d:%02d",
+ log_month_name[tm_res.tm_mon], tm_res.tm_mday, tm_res.tm_hour,
+ tm_res.tm_min, tm_res.tm_sec);
normal_p = char_time;
/*
_______________________________________________
Openais mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/openais