added localtime_r check.
added SA_SIGINFO check
This commit is contained in:
parent
9e72cb1ca3
commit
7001dfa037
12
configure
vendored
12
configure
vendored
@ -18318,6 +18318,18 @@ _ACEOF
|
||||
fi
|
||||
done
|
||||
|
||||
for ac_func in localtime_r gmtime_r
|
||||
do :
|
||||
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
|
||||
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
|
||||
if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
done
|
||||
|
||||
for ac_func in snprintf _vsnprintf _vsnwprintf
|
||||
do :
|
||||
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
|
||||
|
@ -144,6 +144,7 @@ AC_CHECK_FUNCS([gettimeofday settimeofday clock_gettime clock_settime getitimer
|
||||
AC_CHECK_FUNCS([backtrace backtrace_symbols])
|
||||
AC_CHECK_FUNCS([makecontext swapcontext getcontext setcontext])
|
||||
AC_CHECK_FUNCS([clock_nanosleep nanosleep usleep])
|
||||
AC_CHECK_FUNCS([localtime_r gmtime_r])
|
||||
AC_CHECK_FUNCS([snprintf _vsnprintf _vsnwprintf])
|
||||
AC_CHECK_FUNCS([isatty mmap munmap readv writev])
|
||||
|
||||
|
@ -75,6 +75,9 @@
|
||||
/* Define to 1 if you have the `gettimeofday' function. */
|
||||
#undef HAVE_GETTIMEOFDAY
|
||||
|
||||
/* Define to 1 if you have the `gmtime_r' function. */
|
||||
#undef HAVE_GMTIME_R
|
||||
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
#undef HAVE_INTTYPES_H
|
||||
|
||||
@ -84,6 +87,9 @@
|
||||
/* Define to 1 if you have the <libunwind.h> header file. */
|
||||
#undef HAVE_LIBUNWIND_H
|
||||
|
||||
/* Define to 1 if you have the `localtime_r' function. */
|
||||
#undef HAVE_LOCALTIME_R
|
||||
|
||||
/* Define to 1 if you have the `log10q' function. */
|
||||
#undef HAVE_LOG10Q
|
||||
|
||||
|
15
lib/main-c.c
15
lib/main-c.c
@ -236,12 +236,19 @@ static void log_write (hcl_client_t* client, hcl_bitmask_t mask, const hcl_ooch_
|
||||
|
||||
now = time(NULL);
|
||||
|
||||
tmp = localtime_r (&now, &tm);
|
||||
#if defined(HAVE_STRFTIME_SMALL_Z)
|
||||
#if defined(__OS2__)
|
||||
tmp = _localtime(&now, &tm);
|
||||
#elif defined(HAVE_LOCALTIME_R)
|
||||
tmp = localtime_r(&now, &tm);
|
||||
#else
|
||||
tmp = localtime(&now);
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_STRFTIME_SMALL_Z)
|
||||
tslen = strftime(ts, sizeof(ts), "%Y-%m-%d %H:%M:%S %z ", tmp);
|
||||
#else
|
||||
#else
|
||||
tslen = strftime(ts, sizeof(ts), "%Y-%m-%d %H:%M:%S %Z ", tmp);
|
||||
#endif
|
||||
#endif
|
||||
if (tslen == 0)
|
||||
{
|
||||
strcpy (ts, "0000-00-00 00:00:00 +0000");
|
||||
|
14
lib/main-j.c
14
lib/main-j.c
@ -187,12 +187,18 @@ static void log_write (hcl_json_t* json, hcl_bitmask_t mask, const hcl_ooch_t* m
|
||||
|
||||
now = time(NULL);
|
||||
|
||||
tmp = localtime_r (&now, &tm);
|
||||
#if defined(HAVE_STRFTIME_SMALL_Z)
|
||||
#if defined(__OS2__)
|
||||
tmp = _localtime(&now, &tm);
|
||||
#elif defined(HAVE_LOCALTIME_R)
|
||||
tmp = localtime_r(&now, &tm);
|
||||
#else
|
||||
tmp = localtime(&now);
|
||||
#endif
|
||||
#if defined(HAVE_STRFTIME_SMALL_Z)
|
||||
tslen = strftime(ts, sizeof(ts), "%Y-%m-%d %H:%M:%S %z ", tmp);
|
||||
#else
|
||||
#else
|
||||
tslen = strftime(ts, sizeof(ts), "%Y-%m-%d %H:%M:%S %Z ", tmp);
|
||||
#endif
|
||||
#endif
|
||||
if (tslen == 0)
|
||||
{
|
||||
strcpy (ts, "0000-00-00 00:00:00 +0000");
|
||||
|
14
lib/main-s.c
14
lib/main-s.c
@ -230,12 +230,18 @@ static void log_write (hcl_server_t* server, hcl_oow_t wid, hcl_bitmask_t mask,
|
||||
|
||||
now = time(NULL);
|
||||
|
||||
tmp = localtime_r (&now, &tm);
|
||||
#if defined(HAVE_STRFTIME_SMALL_Z)
|
||||
#if defined(__OS2__)
|
||||
tmp = _localtime(&now, &tm);
|
||||
#elif defined(HAVE_LOCALTIME_R)
|
||||
tmp = localtime_r(&now, &tm);
|
||||
#else
|
||||
tmp = localtime(&now);
|
||||
#endif
|
||||
#if defined(HAVE_STRFTIME_SMALL_Z)
|
||||
tslen = strftime(ts, sizeof(ts), "%Y-%m-%d %H:%M:%S %z ", tmp);
|
||||
#else
|
||||
#else
|
||||
tslen = strftime(ts, sizeof(ts), "%Y-%m-%d %H:%M:%S %Z ", tmp);
|
||||
#endif
|
||||
#endif
|
||||
if (tslen == 0)
|
||||
{
|
||||
strcpy (ts, "0000-00-00 00:00:00 +0000");
|
||||
|
23
lib/main.c
23
lib/main.c
@ -698,7 +698,13 @@ static void log_write (hcl_t* hcl, hcl_bitmask_t mask, const hcl_ooch_t* msg, hc
|
||||
tslen = 20;
|
||||
}
|
||||
#else
|
||||
tmp = localtime_r (&now, &tm);
|
||||
#if defined(__OS2__)
|
||||
tmp = _localtime(&now, &tm);
|
||||
#elif defined(HAVE_LOCALTIME_R)
|
||||
tmp = localtime_r(&now, &tm);
|
||||
#else
|
||||
tmp = localtime(&now);
|
||||
#endif
|
||||
#if defined(HAVE_STRFTIME_SMALL_Z)
|
||||
tslen = strftime(ts, sizeof(ts), "%Y-%m-%d %H:%M:%S %z ", tmp);
|
||||
#else
|
||||
@ -1662,8 +1668,10 @@ static void cancel_tick (void)
|
||||
typedef void(*signal_handler_t)(int);
|
||||
#elif defined(macintosh)
|
||||
typedef void(*signal_handler_t)(int); /* TODO: */
|
||||
#else
|
||||
#elif defined(SA_SIGINFO)
|
||||
typedef void(*signal_handler_t)(int, siginfo_t*, void*);
|
||||
#else
|
||||
typedef void(*signal_handler_t)(int);
|
||||
#endif
|
||||
|
||||
|
||||
@ -1674,11 +1682,16 @@ static void handle_sigint (int sig)
|
||||
}
|
||||
#elif defined(macintosh)
|
||||
/* TODO */
|
||||
#else
|
||||
#elif defined(SA_SIGINFO)
|
||||
static void handle_sigint (int sig, siginfo_t* siginfo, void* ctx)
|
||||
{
|
||||
if (g_hcl) hcl_abort (g_hcl);
|
||||
}
|
||||
#else
|
||||
static void handle_sigint (int sig)
|
||||
{
|
||||
if (g_hcl) hcl_abort (g_hcl);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void set_signal (int sig, signal_handler_t handler)
|
||||
@ -1692,8 +1705,12 @@ static void set_signal (int sig, signal_handler_t handler)
|
||||
|
||||
memset (&sa, 0, sizeof(sa));
|
||||
/*sa.sa_handler = handler;*/
|
||||
#if defined(SA_SIGINFO)
|
||||
sa.sa_flags = SA_SIGINFO;
|
||||
sa.sa_sigaction = handler;
|
||||
#else
|
||||
sa.sa_handler = handler;
|
||||
#endif
|
||||
sigemptyset (&sa.sa_mask);
|
||||
|
||||
sigaction (sig, &sa, NULL);
|
||||
|
Loading…
Reference in New Issue
Block a user