mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-22 18:43:02 +01:00
Huge 'gettimeofday' cleanup:
o check for the availability in configure o check for the number of arguments in configure o synchronised config.h.in and MSVC pendant NOTE: If you have problems on your system, don't change the source. Extend the tests in configure.in!!!
This commit is contained in:
parent
9dd2110a68
commit
076de37a9f
@ -2,7 +2,7 @@
|
||||
#
|
||||
# Run this to generate all the initial makefiles, etc.
|
||||
#
|
||||
# $Id: autogen.sh,v 1.2 2002-08-14 05:44:28 eku Exp $
|
||||
# $Id: autogen.sh,v 1.3 2002-08-14 11:13:56 eku Exp $
|
||||
|
||||
PKG_NAME=Firebird2
|
||||
SRCDIR=`dirname $0`
|
||||
@ -40,6 +40,7 @@ autoconf || exit 1
|
||||
if test x$NOCONFIGURE = x
|
||||
then
|
||||
echo Running $SRCDIR/configure $conf_flags "$@" ...
|
||||
rm -f config.cache config.log
|
||||
$SRCDIR/configure $conf_flags "$@" \
|
||||
&& echo Now type \`make\' to compile $PKG_NAME
|
||||
else
|
||||
|
@ -66,6 +66,13 @@ AC_TRY_COMPILE([#include <stdlib.h>
|
||||
[AC_MSG_RESULT(yes)],
|
||||
[AC_DEFINE(socklen_t, int) AC_MSG_RESULT(no)])
|
||||
|
||||
AC_MSG_CHECKING(Checking if gettimeofday accepts second (timezone) argument)
|
||||
AC_TRY_COMPILE([#include <sys/time.h>
|
||||
],
|
||||
[struct timeval tp; gettimeofday(&tp, (struct timezone *)0);],
|
||||
[AC_DEFINE(GETTIMEOFDAY_RETURNS_TIMEZONE) AC_MSG_RESULT(yes)],
|
||||
[AC_MSG_RESULT(no)])
|
||||
|
||||
AC_CHECK_LIB(dl, main)
|
||||
AC_CHECK_LIB(c,main)
|
||||
AC_CHECK_LIB(m, main)
|
||||
@ -80,7 +87,7 @@ AC_CHECK_LIB(curses, main)
|
||||
AC_CHECK_LIB(readline, main,,,$LIBS)
|
||||
AC_CHECK_LIB(stdc++, main,,, $LIBS)
|
||||
|
||||
AC_CHECK_FUNCS(strlcpy strlcat)
|
||||
AC_CHECK_FUNCS(strlcpy strlcat gettimeofday time)
|
||||
|
||||
AC_C_BIGENDIAN
|
||||
AC_C_CONST
|
||||
|
@ -528,8 +528,11 @@ FBUDF_API ISC_TIMESTAMP* getExactTimestamp(ISC_TIMESTAMP* rc)
|
||||
#endif
|
||||
|
||||
timeval tv;
|
||||
gettimeofday(&tv, NULL);
|
||||
|
||||
#ifdef GETTIMEOFDAY_RETURNS_TIMEZONE
|
||||
(void)gettimeofday(&tv, (struct timezone *)0);
|
||||
#else
|
||||
(void)gettimeofday(&tv);
|
||||
#endif
|
||||
|
||||
tm times = *localtime(&tv.tv_sec);
|
||||
|
||||
|
@ -24,30 +24,49 @@
|
||||
|
||||
/* Headers */
|
||||
#define HAVE_ASSERT_H
|
||||
#define HAVE_CTYPE_H
|
||||
#undef HAVE_UNISTD_H
|
||||
#define HAVE_FCNTL_H
|
||||
#undef HAVE_GRP_H
|
||||
#undef HAVE_PWD_H
|
||||
#undef HAVE_LIBIO_H
|
||||
#undef HAVE_LOCALE_H
|
||||
#undef HAVE_MATH_H
|
||||
#undef HAVE_PTHREAD_H
|
||||
#undef HAVE_SYS_TYPES_H
|
||||
#define HAVE_SYS_STAT_H
|
||||
#undef HAVE_SYS_UIO_H
|
||||
#undef HAVE_SYS_WAIT_H
|
||||
#define HAVE_TIME_H
|
||||
#undef HAVE_SYS_TIME_H
|
||||
#define HAVE_SYS_STAT_H
|
||||
#define HAVE_CTYPE_H
|
||||
#undef HAVE_SYS_UIO_H
|
||||
#undef HAVE_LIB_IO_H
|
||||
#undef HAVE_WAIT_H
|
||||
#undef HAVE_SYS_WAIT_H
|
||||
#undef HAVE_SYS_TIMEB_H
|
||||
#undef HAVE_SYS_PARAM_H
|
||||
#undef HAVE_VARARGS_H
|
||||
#undef HAVE_SYS_IOCTL_H
|
||||
#define HAVE_SETJMP_H
|
||||
#define HAVE_STDARG_H
|
||||
#define HAVE_STDLIB_H
|
||||
#define HAVE_STRING_H
|
||||
#define HAVE_SIGNAL_H
|
||||
#undef HAVE_READLINE_READLINE_H
|
||||
#define HAVE_SETJMP_H
|
||||
#undef HAVE_UNISTD_H
|
||||
#undef HAVE_VARARGS_H
|
||||
|
||||
/* types */
|
||||
/* Functions */
|
||||
#undef HAVE_STRLCPY
|
||||
#undef HAVE_STRLCAT
|
||||
#define HAVE_GETTIMEOFDAY
|
||||
#undef HAVE_TIME
|
||||
|
||||
/* Types */
|
||||
#undef socklen_t
|
||||
|
||||
/* functions */
|
||||
/* gettimeofday accepts second (timezone) argument */
|
||||
#undef GETTIMEOFDAY_RETURNS_TIMEZONE
|
||||
|
||||
/* Are we doing 64bit IO on unix */
|
||||
#undef UNIX_64_BIT_IO
|
||||
|
||||
/* Functions */
|
||||
#define snprintf _snprintf
|
||||
|
||||
/* Is the platform big endian? */
|
||||
@ -83,5 +102,6 @@
|
||||
#undef sgi
|
||||
#undef mpexl
|
||||
#undef UNIXWARE
|
||||
#undef SINIXZ
|
||||
|
||||
#endif
|
@ -59,20 +59,6 @@
|
||||
#define TOMORROW "TOMORROW"
|
||||
#define YESTERDAY "YESTERDAY"
|
||||
|
||||
#ifndef WIN_NT
|
||||
#ifdef NETWARE_386
|
||||
#define GETTIMEOFDAY(time,tz) gettimeofday (time)
|
||||
#endif
|
||||
|
||||
#ifndef GETTIMEOFDAY
|
||||
#define GETTIMEOFDAY(time,tz) gettimeofday (time, tz)
|
||||
#define TIMEOFDAY_TZ
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !defined(WIN_NT)
|
||||
extern struct tm *localtime();
|
||||
#endif
|
||||
|
||||
static void now_to_date(struct tm *, SLONG[2]);
|
||||
|
||||
@ -247,12 +233,12 @@ void MISC_get_time( struct timeval *current)
|
||||
* Get the current time of day.
|
||||
*
|
||||
**************************************/
|
||||
#ifdef GETTIMEOFDAY
|
||||
#ifdef TIMEOFDAY_TZ
|
||||
struct timezone tzp;
|
||||
#ifdef HAVE_GETTIMEOFDAY
|
||||
#ifdef GETTIMEOFDAY_RETURNS_TIMEZONE
|
||||
(void)gettimeofday(current, (struct timezone *)0);
|
||||
#else
|
||||
(void)gettimeofday(current);
|
||||
#endif
|
||||
|
||||
GETTIMEOFDAY(current, &tzp);
|
||||
#else
|
||||
struct timeb buffer;
|
||||
|
||||
|
@ -45,6 +45,10 @@
|
||||
#include "../jrd/iberr.h"
|
||||
#include "../jrd/gds_proto.h"
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#ifndef WIN_NT
|
||||
#include <sys/param.h>
|
||||
#endif
|
||||
@ -92,7 +96,6 @@
|
||||
#endif
|
||||
|
||||
#ifdef UNIX
|
||||
#include <unistd.h>
|
||||
#ifdef SUPERSERVER
|
||||
#include <sys/mman.h>
|
||||
#include <sys/resource.h>
|
||||
@ -211,11 +214,6 @@ static CONST SCHAR *FAR_VARIABLE CONST messages[] = {
|
||||
0 /* Null entry to terminate list */
|
||||
};
|
||||
|
||||
#ifndef GETTIMEOFDAY
|
||||
#define GETTIMEOFDAY(time,tz) gettimeofday ((struct timeval*)time, (struct timezone*)tz)
|
||||
#define TIMEOFDAY_TZ
|
||||
#endif
|
||||
|
||||
#ifdef NETWARE_386
|
||||
extern int regular_malloc;
|
||||
struct timezon {
|
||||
@ -1931,26 +1929,26 @@ void API_ROUTINE gds__log(TEXT * text, ...)
|
||||
**************************************/
|
||||
va_list ptr;
|
||||
IB_FILE *file;
|
||||
SLONG t[2];
|
||||
#if !(defined VMS || defined PC_PLATFORM || defined WIN_NT)
|
||||
SLONG z[2];
|
||||
#endif
|
||||
int oldmask;
|
||||
time_t now;
|
||||
#if defined(STACK_EFFICIENT) && !defined(DEV_BUILD) && !defined(DEBUG_GDS_ALLOC)
|
||||
TEXT *name = (TEXT *) gds__alloc((SLONG) (sizeof(TEXT) * MAXPATHLEN));
|
||||
#else /* STACK_EFFICIENT */
|
||||
TEXT name[MAXPATHLEN];
|
||||
#endif /* STACK_EFFICIENT */
|
||||
|
||||
#if !(defined VMS || defined PC_PLATFORM || defined WIN_NT)
|
||||
GETTIMEOFDAY(t, z);
|
||||
#define LOG_TIME_OBTAINED
|
||||
#endif
|
||||
|
||||
#ifdef LOG_TIME_OBTAINED
|
||||
#undef LOG_TIME_OBTAINED
|
||||
#ifdef HAVE_GETTIMEOFDAY
|
||||
{
|
||||
struct timeval tv;
|
||||
#ifdef GETTIMEOFDAY_RETURNS_TIMEZONE
|
||||
(void)gettimeofday(&tv, (struct timezone *)0);
|
||||
#else
|
||||
time(t);
|
||||
(void)gettimeofday(&tv);
|
||||
#endif
|
||||
now = tv.tv_sec;
|
||||
}
|
||||
#else
|
||||
now = time((time_t *)0);
|
||||
#endif
|
||||
|
||||
gds__prefix(name, LOGFILE);
|
||||
@ -1960,7 +1958,7 @@ void API_ROUTINE gds__log(TEXT * text, ...)
|
||||
if ((file = ib_fopen(name, FOPEN_APPEND_TYPE)) != NULL)
|
||||
{
|
||||
ib_fprintf(file, "%s%s\t%.25s\t", ISC_get_host(name, MAXPATHLEN),
|
||||
gdslogid, ctime(t));
|
||||
gdslogid, ctime(now));
|
||||
VA_START(ptr, text);
|
||||
ib_vfprintf(file, text, ptr);
|
||||
ib_fprintf(file, "\n\n");
|
||||
|
@ -28,7 +28,7 @@
|
||||
* 01-Feb-2002 Paul Reeves: Removed hard-coded registry path
|
||||
*/
|
||||
/*
|
||||
$Id: isc.cpp,v 1.12 2002-07-29 15:37:54 skywalker Exp $
|
||||
$Id: isc.cpp,v 1.13 2002-08-14 11:13:58 eku Exp $
|
||||
*/
|
||||
#ifdef DARWIN
|
||||
#define _STLP_CCTYPE
|
||||
@ -151,7 +151,9 @@ static LKSB wake_lock;
|
||||
#include <sys/stat.h>
|
||||
#include <sys/file.h>
|
||||
#include <pwd.h>
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#include <signal.h>
|
||||
#include <ctype.h>
|
||||
|
||||
|
@ -46,7 +46,6 @@
|
||||
#if (defined WIN_NT || defined PC_PLATFORM)
|
||||
#include <sys/timeb.h>
|
||||
#define NO_TIMES
|
||||
#define NO_GETTIMEOFDAY
|
||||
#endif
|
||||
#endif /* NETWARE_386 */
|
||||
|
||||
@ -69,7 +68,6 @@ static SCHAR *report =
|
||||
"elapsed = !e cpu = !u reads = !r writes = !w fetches = !f marks = !m$";
|
||||
|
||||
#ifdef VMS
|
||||
#define NO_GETTIMEOFDAY
|
||||
#define TICK 100
|
||||
extern void ftime();
|
||||
#endif
|
||||
@ -242,11 +240,11 @@ void API_ROUTINE perf_get_info(int **handle, PERF * perf)
|
||||
SCHAR *p, buffer[256];
|
||||
SSHORT l, buffer_length, item_length;
|
||||
STATUS jrd_status[20];
|
||||
#ifdef NO_GETTIMEOFDAY
|
||||
#ifdef HAVE_GETTIMEOFDAY
|
||||
struct timeval tp;
|
||||
#else
|
||||
struct timeb time_buffer;
|
||||
#define LARGE_NUMBER 696600000 /* to avoid overflow, get rid of decades) */
|
||||
#else
|
||||
struct timeval tp;
|
||||
#endif
|
||||
|
||||
/* If there isn't a database, zero everything out */
|
||||
@ -263,21 +261,18 @@ void API_ROUTINE perf_get_info(int **handle, PERF * perf)
|
||||
|
||||
times(&perf->perf_times);
|
||||
|
||||
#ifdef NO_GETTIMEOFDAY
|
||||
#ifdef HAVE_GETTIMEOFDAY
|
||||
#ifdef GETTIMEOFDAY_RETURNS_TIMEZONE
|
||||
(void)gettimeofday(&tp, (struct timezone *)0);
|
||||
#else
|
||||
(void)gettimeofday(&tp);
|
||||
#endif
|
||||
perf->perf_elapsed = tp.tv_sec * 100 + tp.tv_usec / 10000;
|
||||
#else
|
||||
ftime(&time_buffer);
|
||||
perf->perf_elapsed =
|
||||
(time_buffer.time - LARGE_NUMBER) * 100 + (time_buffer.millitm / 10);
|
||||
|
||||
#else
|
||||
#ifdef M88K
|
||||
gettimeofday(&tp);
|
||||
#else
|
||||
gettimeofday(&tp, 0L);
|
||||
#endif /* M88K */
|
||||
|
||||
perf->perf_elapsed = tp.tv_sec * 100 + tp.tv_usec / 10000;
|
||||
|
||||
#endif /* NO_GETTIMEOFDAY */
|
||||
#endif
|
||||
|
||||
if (!*handle)
|
||||
return;
|
||||
|
@ -2982,21 +2982,25 @@ static void service_get(SVC service,
|
||||
ULONG end_time;
|
||||
ULONG elapsed_seconds;
|
||||
ULONG elapsed_tenths;
|
||||
#endif
|
||||
#ifdef WIN_NT
|
||||
time_t start_time, end_time;
|
||||
#else
|
||||
#ifdef HAVE_GETTIMEOFDAY
|
||||
struct timeval start_time, end_time;
|
||||
#else
|
||||
time_t start_time, end_time;
|
||||
#endif
|
||||
#endif /* NETWARE */
|
||||
|
||||
#ifdef NETWARE_386
|
||||
start_time = GetCurrentTicks();
|
||||
#else
|
||||
#ifdef WIN_NT
|
||||
time(&start_time);
|
||||
#ifdef HAVE_GETTIMEOFDAY
|
||||
#ifdef GETTIMEOFDAY_RETURNS_TIMEZONE
|
||||
(void)gettimeofday(&start_time, (struct timezone *)0);
|
||||
#else
|
||||
gettimeofday(&start_time, NULL);
|
||||
(void)gettimeofday(&start_time);
|
||||
#endif
|
||||
#else
|
||||
time(&start_time);
|
||||
#endif /* NETWARE */
|
||||
*return_length = 0;
|
||||
service->svc_flags &= ~SVC_timeout;
|
||||
@ -3009,12 +3013,16 @@ static void service_get(SVC service,
|
||||
elapsed_time = end_time - start_time;
|
||||
TicksToSeconds(elapsed_time, &elapsed_seconds, &elapsed_tenths);
|
||||
#else
|
||||
#ifdef WIN_NT
|
||||
#ifdef HAVE_GETTIMEOFDAY
|
||||
#ifdef GETTIMEOFDAY_RETURNS_TIMEZONE
|
||||
(void)gettimeofday(&end_time, (struct timezone *)0);
|
||||
#else
|
||||
(void)gettimeofday(&end_time);
|
||||
#endif
|
||||
elapsed_time = end_time.tv_sec - start_time.tv_sec;
|
||||
#else
|
||||
time(&end_time);
|
||||
elapsed_time = end_time - start_time;
|
||||
#else
|
||||
gettimeofday(&end_time, NULL);
|
||||
elapsed_time = end_time.tv_sec - start_time.tv_sec;
|
||||
#endif
|
||||
#endif /* NETWARE */
|
||||
|
||||
|
@ -18,36 +18,41 @@
|
||||
#undef HAVE_ERRNO_H
|
||||
#undef HAVE_FCNTL_H
|
||||
#undef HAVE_GRP_H
|
||||
#undef HAVE_PWD_H
|
||||
#undef HAVE_LIBIO_H
|
||||
#undef HAVE_LIB_IO_H
|
||||
#undef HAVE_LOCALE_H
|
||||
#undef HAVE_MATH_H
|
||||
#undef HAVE_PWD_H
|
||||
#undef HAVE_READLINE_READLINE_H
|
||||
#undef HAVE_PTHREAD_H
|
||||
#undef HAVE_SIGNAL_H
|
||||
#undef HAVE_SYS_TYPES_H
|
||||
#undef HAVE_SYS_STAT_H
|
||||
#undef HAVE_SYS_UIO_H
|
||||
#undef HAVE_SYS_WAIT_H
|
||||
#undef HAVE_TIME_H
|
||||
#undef HAVE_SYS_TIME_H
|
||||
#undef HAVE_SYS_TIMEB_H
|
||||
#undef HAVE_SYS_PARAM_H
|
||||
#undef HAVE_SYS_IOCTL_H
|
||||
#undef HAVE_SETJMP_H
|
||||
#undef HAVE_STDARG_H
|
||||
#undef HAVE_STDLIB_H
|
||||
#undef HAVE_STRING_H
|
||||
#undef HAVE_SYS_TYPES_H
|
||||
#undef HAVE_SYS_STAT_H
|
||||
#undef HAVE_SYS_UIO_H
|
||||
#undef HAVE_SYS_IOCTL_H
|
||||
#undef HAVE_SYS_WAIT_H
|
||||
#undef HAVE_SYS_TIME_H
|
||||
#undef HAVE_SYS_TIMEB_H
|
||||
#undef HAVE_SYS_PARAM_H
|
||||
#undef HAVE_TIME_H
|
||||
#undef HAVE_SIGNAL_H
|
||||
#undef HAVE_READLINE_READLINE_H
|
||||
#undef HAVE_UNISTD_H
|
||||
#undef HAVE_VARARGS_H
|
||||
|
||||
/* Functions */
|
||||
#undef HAVE_STRLCPY
|
||||
#undef HAVE_STRLCAT
|
||||
#undef HAVE_GETTIMEOFDAY
|
||||
#undef HAVE_TIME
|
||||
|
||||
/* types */
|
||||
/* Types */
|
||||
#undef socklen_t
|
||||
|
||||
/* gettimeofday accepts second (timezone) argument */
|
||||
#undef GETTIMEOFDAY_RETURNS_TIMEZONE
|
||||
|
||||
/* Are we doing 64bit IO on unix */
|
||||
#undef UNIX_64_BIT_IO
|
||||
|
||||
@ -84,5 +89,6 @@
|
||||
#undef sgi
|
||||
#undef mpexl
|
||||
#undef UNIXWARE
|
||||
#undef SINIXZ
|
||||
|
||||
#endif
|
||||
|
@ -52,10 +52,6 @@
|
||||
#include "../jrd/isc_f_proto.h"
|
||||
#include "../jrd/misc_proto.h"
|
||||
|
||||
#ifndef GETTIMEOFDAY
|
||||
#define GETTIMEOFDAY(tp,tzp) gettimeofday (tp, tzp)
|
||||
#endif
|
||||
|
||||
static void do_mem_benchmark(void);
|
||||
static void do_sem_benchmark(WAL);
|
||||
static SLONG get_tod(void);
|
||||
@ -573,10 +569,14 @@ static SLONG get_tod(void)
|
||||
* Functional description
|
||||
*
|
||||
**************************************/
|
||||
#if !(defined WIN_NT)
|
||||
#ifdef HAVE_GETTIMEOFDAY
|
||||
#ifdef GETTIMEOFDAY_RETURNS_TIMEZONE
|
||||
struct timeval tp1;
|
||||
|
||||
GETTIMEOFDAY(&tp1, NULL);
|
||||
(void)gettimeofday(&tp1, (struct timezone *)0);
|
||||
#else
|
||||
(void)gettimeofday(&tp1);
|
||||
#endif
|
||||
if (!base_seconds)
|
||||
base_seconds = tp1.tv_sec;
|
||||
return (tp1.tv_sec - base_seconds) * 1000000 + tp1.tv_usec;
|
||||
|
Loading…
Reference in New Issue
Block a user