8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-26 08:03:03 +01:00
firebird-mirror/src/jrd/common.h

1278 lines
33 KiB
C
Raw Normal View History

2001-05-23 15:26:42 +02:00
/*
* PROGRAM: JRD access method
* MODULE: common.h
* DESCRIPTION: Common descriptions for all GDS programs
*
* The contents of this file are subject to the Interbase Public
* License Version 1.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy
* of the License at http://www.Inprise.com/IPL.html
*
* Software distributed under the License is distributed on an
* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express
* or implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code was created by Inprise Corporation
* and its predecessors. Portions created by Inprise Corporation are
* Copyright (C) Inprise Corporation.
*
* All Rights Reserved.
* Contributor(s): ______________________________________.
* Added TCP_NO_DELAY option for superserver on Linux
* FSG 16.03.2001
*
* 2001.07.06 Sean Leyne - Code Cleanup, removed "#ifdef READONLY_DATABASE"
* conditionals, as the engine now fully supports
* readonly databases.
*
2002-02-16 06:06:17 +01:00
* 2002.02.15 Sean Leyne - Code Cleanup, removed obsolete ports:
* - MAC ("MAC", "MAC_AUX" and "MAC_CP" defines)
* - EPSON, XENIX, DELTA, IMP, NCR3000, M88K
* - NT Power PC and HP9000 s300
2002-02-16 03:21:35 +01:00
*
2002-06-29 15:03:13 +02:00
* 2001.11.20 Ann Harrison - make 64bitio.h conditional on not windows.
* 2002.04.16 Paul Beach - HP10 and unistd.h
2001-05-23 15:26:42 +02:00
*/
/*
$Id: common.h,v 1.36 2002-10-24 09:01:29 eku Exp $
2001-05-23 15:26:42 +02:00
*/
#ifndef JRD_COMMON_H
#define JRD_COMMON_H
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
2001-07-12 07:46:06 +02:00
2001-05-23 15:26:42 +02:00
#ifndef INCLUDE_FB_MACROS_H
#include "../include/fb_macros.h"
#endif
#ifndef INCLUDE_FB_TYPES_H
#include "../include/fb_types.h"
#endif
/*
2001-05-23 15:26:42 +02:00
do not use links in source code to maintain platform neutraility
*/
#undef LINKS_EXIST
#ifdef PROD_BUILD
#ifdef DEV_BUILD
#undef DEV_BUILD
#endif
#endif
#ifdef SUPERSERVER
#define GOVERNOR 1
#define CANCEL_OPERATION
2002-06-29 15:03:13 +02:00
#define FB_ARCHITECTURE isc_info_db_class_server_access
#else
#define FB_ARCHITECTURE isc_info_db_class_classic_access
2001-05-23 15:26:42 +02:00
#endif
2001-07-12 07:46:06 +02:00
2001-05-23 15:26:42 +02:00
/* Linux for Intel platforms*/
#ifdef LINUX
#define QUADFORMAT "ll"
#define QUADCONST(n) (n##LL)
#define __LINE__IS_INT
2001-05-23 15:26:42 +02:00
#ifdef SUPERSERVER
#define SET_TCP_NO_DELAY
#endif
#define KILLER_SIGNALS
#define VA_START(list,parmN) va_start (list, parmN)
#define UNIX 1
#define IEEE 1
#ifdef i386
#define I386 1
2002-06-29 15:03:13 +02:00
#define IMPLEMENTATION isc_info_db_impl_i386 /* 60 next higher unique number, See you later */
2001-05-23 15:26:42 +02:00
#endif /* i386 */
#define MEMMOVE(from,to,length) memmove ((void *)to, (void *)from, (size_t) length)
#define MOVE_FAST(from,to,length) memcpy (to, from, (int) (length))
#define MOVE_FASTER(from,to,length) memcpy (to, from, (int) (length))
#define MOVE_CLEAR(to,length) memset (to, 0, (int) (length))
typedef RETSIGTYPE (*SIG_FPTR) (int);
2001-05-23 15:26:42 +02:00
#endif /* LINUX */
2002-06-29 15:03:13 +02:00
/* SINIX-Z 5.42 */
#ifdef SINIXZ
#include <sys/types.h>
#include <sys/time.h>
#include <sys/mman.h>
#include <sys/socket.h>
#include <string.h>
#ifdef __cplusplus
extern "C" {
#endif
/* These prototypes are missing in the system header files :-( */
int gettimeofday (struct timeval *tp);
int munmap(void * addr, size_t len);
int gethostname(char *name, size_t len);
int socket(int domain, int type, int protocol);
int connect(int s, struct sockaddr *name, int namelen);
int send(int s, void *msg, int len, int flags);
int recv(int s, void *buf, int len, int flags);
int strcasecmp(const char *s1, const char *s2);
int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *execptfds, struct timeval *timeout);
int getsockopt(int s, int level, int optname, char *optval, int *optlen);
int setsockopt(int s, int level, int optname, char *optval, int optlen);
int bind(int s, struct sockaddr *name, int namelen);
int listen(int s, int backlog);
int accept(int s, struct sockaddr *ddr, int *addrlen);
int getsockname(int s, struct sockaddr *name, int *namelen);
int setsockname(int s, struct sockaddr *name, int *namelen);
int getpeername(int s, struct sockaddr *name, int *namelen);
int shutdown(int s, int how);
#ifdef __cplusplus
}
#endif
#include <dlfcn.h>
#define dlopen(a,b) dlopen((char *)(a),(b))
#define dlsym(a,b) dlsym((a), (char *)(b))
2002-06-29 15:03:13 +02:00
#define QUADFORMAT "ll"
#define QUADCONST(n) (n##LL)
/*#define ALIGNMENT 4*/
/*#define DOUBLE_ALIGN 8*/
#define FB_ALIGN(n,b) ((n + b - 1) & ~(b - 1))
2002-06-29 15:03:13 +02:00
#ifdef SUPERSERVER
#define SET_TCP_NO_DELAY
#endif
#define KILLER_SIGNALS
#define VA_START(list,parmN) va_start (list, parmN)
#define UNIX 1
#define IEEE 1
#ifdef i386
#define I386 1
/* Change version string into SINIXZ */
#define IMPLEMENTATION isc_info_db_impl_sinixz /* 64 */
#endif /* i386 */
#define setreuid(ruid,euid) setuid(euid)
#define setregid(rgid,egid) setgid(egid)
#define NO_PYXIS
#define MEMMOVE(from,to,length) memmove ((void *)to, (void *)from, (size_t) length)
#define MOVE_FAST(from,to,length) memcpy (to, from, (int) (length))
#define MOVE_FASTER(from,to,length) memcpy (to, from, (int) (length))
#define MOVE_CLEAR(to,length) memset (to, 0, (int) (length))
typedef RETSIGTYPE (*SIG_FPTR) ();
2002-06-29 15:03:13 +02:00
#endif /* SINIXZ */
2001-07-12 07:46:06 +02:00
/* Darwin Platforms */
#ifdef DARWIN
/* EKU: obsolete, replaced by _FILE_OFFSET_BITS
2002-06-29 15:03:13 +02:00
#ifndef UNIX_64_BIT_IO
#define UNIX_64_BIT_IO
#endif
*/
2001-12-24 03:51:06 +01:00
#define __LINE__IS_INT
#define SLONGFORMAT "ld"
/*#define ALIGNMENT 4*/
/*#define DOUBLE_ALIGN 4*/
2001-07-12 07:46:06 +02:00
#define FB_ALIGN(n,b) ((n + b - 1) & ~(b - 1))
#define BSD_UNIX 1
#define UNIX 1
#define IMPLEMENTATION 63
#define IEEE
#define QUADCONST(n) (n##LL)
#define QUADFORMAT "q"
#define NON_MNTENT
#define MAP_ANONYMOUS
#define MAP_ANNON
#define LSEEK_OFFSET_CAST (off_t)
#define MEMMOVE(from,to,length) memmove ((void *)to, (void *)from, (size_t)length)
#define MOVE_FAST(from,to,length) memcpy (to, from, (int) (length))
#define MOVE_FASTER(from,to,length) memcpy (to, from, (int) (length))
#define MOVE_CLEAR(to,length) memset (to, 0, (int) (length))
#if 0 /* sys/param included up top, wait till John says if need #define. MOD 16-07-2001 */
#ifdef DARWIN
2001-07-12 07:46:06 +02:00
#define _PPC_PARAM_H_
#endif
2001-07-12 07:46:06 +02:00
#ifndef MAXPATHLEN
#include <sys/param.h>
#endif
#endif
typedef RETSIGTYPE (*SIG_FPTR) (int);
2001-07-12 07:46:06 +02:00
#endif /* Darwin Platforms */
2001-05-23 15:26:42 +02:00
/* FreeBSD for Intel platforms */
#ifdef FREEBSD
/* EKU: obsolete, replaced by _FILE_OFFSET_BITS
#ifndef UNIX_64_BIT_IO
#define UNIX_64_BIT_IO
#endif
*/
2001-05-23 15:26:42 +02:00
#define FB_ALIGN(n,b) ((n + b - 1) & ~(b - 1))
/*#define ALIGNMENT 4*/
/*#define DOUBLE_ALIGN 4*/
2001-05-23 15:26:42 +02:00
#define UNIX 1
#define IEEE 1
#define I386 1
2002-06-29 15:03:13 +02:00
#define IMPLEMENTATION isc_info_db_impl_freebsd /* 61 */
2001-05-23 15:26:42 +02:00
#define QUADFORMAT "ll"
#define QUADCONST(n) (n##LL)
#define KILLER_SIGNALS
#define NO_NFS /* no MTAB_OPEN or MTAB_CLOSE in isc_file.c */
#define MEMMOVE(from,to,length) memmove ((void *)to, (void *)from, (size_t) length)
#define MOVE_FAST(from,to,length) memcpy (to, from, (int) (length))
#define MOVE_FASTER(from,to,length) memcpy (to, from, (int) (length))
#define MOVE_CLEAR(to,length) memset (to, 0, (int) (length))
typedef RETSIGTYPE (*SIG_FPTR) (int);
2001-05-23 15:26:42 +02:00
#endif /* FREEBSD */
/* NetBSD */
#ifdef NETBSD
#if defined(__i386__)
#define FB_ALIGN(n,b) ((n + b - 1) & ~(b - 1))
/*#define ALIGNMENT 4*/
/*#define DOUBLE_ALIGN 4*/
2001-05-23 15:26:42 +02:00
#define IEEE 1
#define I386 1
2002-06-29 15:03:13 +02:00
#define IMPLEMENTATION isc_info_db_impl_netbsd /* 62 */
2001-05-23 15:26:42 +02:00
#define QUADFORMAT "ll"
#define QUADCONST(n) (n##LL)
#else /* !__i386__ */
#error Please add support for other ports
#endif
#define UNIX 1
#define KILLER_SIGNALS
#define NO_NFS /* no MTAB_OPEN or MTAB_CLOSE in isc_file.c */
#define MEMMOVE(from,to,length) memmove ((void *)to, (void *)from, (size_t) length)
#define MOVE_FAST(from,to,length) memcpy (to, from, (int) (length))
#define MOVE_FASTER(from,to,length) memcpy (to, from, (int) (length))
#define MOVE_CLEAR(to,length) memset (to, 0, (int) (length))
typedef RETSIGTYPE (*SIG_FPTR) ();
2001-05-23 15:26:42 +02:00
#endif /* NETBSD */
/* SUN platforms--the 386i is obsolete */
#ifdef sun
/* Defined KILLER_SIGNALS for Sun - as we were getting lots of lockups
* using pipe server.
* 1995-February-24 David Schnepper
2001-05-23 15:26:42 +02:00
*/
#define KILLER_SIGNALS
#ifdef SOLARIS
#ifndef PIPE_IS_SHRLIB
/* This is NOT defined when building the special shared-pipe library
* which customers can use to avoid the problems with signals & threads
* in Solaris
*/
#define SOLARIS_MT 1
#endif
/* Define the following only on platforms whose standard I/O
* implementation is so weak that we wouldn't be able to fopen
* a file whose underlying file descriptor would be > 255.
* Hey, we're not running on PDP-11's any more: would it kill you
* to use a short instead of a char to hold the fileno? :-(
*/
2002-09-25 08:22:43 +02:00
/* Why we (solarises) need to rewrite old BSD stdio
so many times I suggest stdIO from
http://www.research.att.com/sw/tools/sfio/
*/
#ifndef SFIO
2001-05-23 15:26:42 +02:00
#define NEED_IB_STDIO
2002-09-25 08:22:43 +02:00
#endif
2001-05-23 15:26:42 +02:00
/* Define the following macro only on platforms which supply the library
routine xdr_hyper. For other platforms, omit the definition of this
macro, and we will supply that function where we need it. */
#define PLATFORM_SUPPLIES_XDR_HYPER
2002-06-29 15:03:13 +02:00
#ifdef SOLX86
#define LSEEK_OFFSET_CAST (off_t)
#endif
2001-05-23 15:26:42 +02:00
#define MEMMOVE(from,to,length) memmove ((void *)to, (void *)from, (size_t) length)
/********* Reason for introducing MEMMOVE macro.
void *memcpy( void *s1, const void *s2, size_t n);
void *memmove( void *s1, const void *s2, size_t n);
The memcpy() function copies n characters from the string pointed to by the
s2 parameter into the location pointed to by the s1 parameter. When copy-
ing overlapping strings, the behavior of this function is unreliable.
The memmove() function copies n characters from the string at the location
pointed to by the s2 parameter to the string at the location pointed to by
the s1 parameter. Copying takes place as though the n number of characters
from string s2 are first copied into a temporary location having n bytes
that do not overlap either of the strings pointed to by s1 and s2. Then, n
number of characters from the temporary location are copied to the string
pointed to by s1. Consequently, this operation is nondestructive and
proceeds from left to right.
The above text is taken from the Digital UNIX man pages.
For maximum portability, memmove should be used when the memory areas
indicated by s1 and s2 may overlap, and memcpy used for faster copying
between non-overlapping areas.
2001-05-23 15:26:42 +02:00
**********/
2002-06-29 15:03:13 +02:00
#if !(defined(SOLARIS26) || defined(HP10))
//#ifndef SOLARIS26
2001-05-23 15:26:42 +02:00
/* If our build platform is at least Solaris release 2.6, then unistd.h
2002-06-29 15:03:13 +02:00
declares these functions, so we must not define them with macros.
The same applies to HP10 16-Apr-2002 Paul Beach */
2001-05-23 15:26:42 +02:00
#define setreuid(ruid,euid) ((setuid (ruid) == -1 || seteuid (euid) == -1) ? -1 : 0)
#define setregid(rgid,egid) ((setgid (rgid) == -1 || setegid (egid) == -1) ? -1 : 0)
#endif
/* The following define is the prefix to go in front of a "d" or "u"
format item in a ib_printf() format string, to indicate that the argument
is an SINT64 or UINT64. */
#define QUADFORMAT "ll"
/* The following macro creates a quad-sized constant, possibly one
which is too large to fit in a long int. */
#define QUADCONST(n) (n##LL)
#else /* SOLARIS */
#define BSD_UNIX 1
#endif /* SOLARIS */
#define UNIX 1
#define IEEE
#ifdef sparc
#define FB_ALIGN(n,b) ((n + b - 1) & ~(b - 1))
/*#define ALIGNMENT 4*/
/*#define DOUBLE_ALIGN 8*/
2002-06-29 15:03:13 +02:00
#define IMPLEMENTATION isc_info_db_impl_isc_sun4 /* 30 */
2001-05-23 15:26:42 +02:00
#else /* sparc */
#ifdef i386
#define I386 1
2002-06-29 15:03:13 +02:00
#define IMPLEMENTATION isc_info_db_impl_isc_sun_386i /* 32 */
2001-05-23 15:26:42 +02:00
#else /* i386 */
#define FB_ALIGN(n,b) ((n+1) & ~1)
2002-06-29 15:03:13 +02:00
#define IMPLEMENTATION isc_info_db_impl_isc_sun_68k /* 28 */
2001-05-23 15:26:42 +02:00
#endif /* i386 */
#endif /* sparc */
#define MOVE_FAST(from,to,length) memcpy (to, from, (int) (length))
#define MOVE_FASTER(from,to,length) memcpy (to, from, (int) (length))
#define MOVE_CLEAR(to,length) memset (to, 0, (int) (length))
2002-09-27 15:12:46 +02:00
typedef RETSIGTYPE (*SIG_FPTR) (int);
2001-05-23 15:26:42 +02:00
#endif /* sun */
/* HP/UX platforms */
#if (defined(hpux) || defined(HPUX))
#ifndef hpux
#define hpux
#endif
#define KILLER_SIGNALS
#define UNIX 1
#define CURSES_KEYPAD 1
#define FB_ALIGN(n,b) ((n + b - 1) & ~(b - 1))
/*#define ALIGNMENT 8*/
/*#define DOUBLE_ALIGN 8*/
2002-06-29 15:03:13 +02:00
#define IMPLEMENTATION isc_info_db_impl_isc_hp_ux /* 31 */
2001-05-23 15:26:42 +02:00
#define IEEE
#include "../jrd/pragma.h"
2002-06-29 15:03:13 +02:00
// 16-Apr-2002 HP10 in unistd.h Paul Beach
//#define setreuid(ruid,euid) setresuid (ruid, euid, -1)
//#define setregid(rgid,egid) setresgid (rgid, egid, -1)
2001-05-23 15:26:42 +02:00
/* The following define is the prefix to go in front of a "d" or "u"
format item in a ib_printf() format string, to indicate that the argument
is an SINT64 or UINT64. */
#define QUADFORMAT "ll"
/* The following macro creates a quad-sized constant, possibly one
which is too large to fit in a long int. */
#define QUADCONST(n) (n##LL)
#define MEMMOVE(from,to,length) memmove ((void *)to, (void *)from, (size_t) length)
#define MOVE_FAST(from,to,length) memcpy (to, from, (int) (length))
#define MOVE_FASTER(from,to,length) memcpy (to, from, (int) (length))
#define MOVE_CLEAR(to,length) memset (to, 0, (int) (length))
typedef RETSIGTYPE (*SIG_FPTR) ();
2001-05-23 15:26:42 +02:00
#endif /* hpux */
/* DEC Ultrix */
#ifdef ultrix
#define BSD_UNIX 1
#define INTL_BACKEND
#define UNIX 1
#define FB_ALIGN(n,b) ((n + b - 1) & ~(b - 1))
#ifdef mips
2002-06-29 15:03:13 +02:00
#define IMPLEMENTATION isc_info_db_impl_isc_mips_ult /* 36 */
2001-05-23 15:26:42 +02:00
#define IEEE
/*#define ALIGNMENT 4*/
/*#define DOUBLE_ALIGN 8*/
2001-05-23 15:26:42 +02:00
#else
#define CTO32L(p) (*(long*) p)
2002-06-29 15:03:13 +02:00
#define IMPLEMENTATION isc_info_db_impl_isc_vax_ultr /* 26 */
2001-05-23 15:26:42 +02:00
#define SHMEM_PICKY
#endif
typedef RETSIGTYPE (*SIG_FPTR) ();
2001-05-23 15:26:42 +02:00
#endif /* ultrix */
/* PC Platforms are NetWare, Windows 3.1, and Windows and DOS Clients */
#ifdef PC_PLATFORM
#define SYS_ARG isc_arg_dos
#ifndef NETWARE_386
#define VA_START(list,parmN) va_start (list, parmN)
#define NO_PYXIS
#define I386 1
#define NO_NFS
#undef LINKS_EXIST
#define IEEE /* IEEE floating point arith. */
2002-06-29 15:03:13 +02:00
#define LSEEK_OFFSET_CAST /* LSEEK_OFFSET_CAST not needed on Windows */
#define IMPLEMENTATION isc_info_db_impl_isc_dos /* 47 */
2001-05-23 15:26:42 +02:00
#define MEMMOVE(from,to,length) memmove (to, from, (int) (length))
#define MOVE_FAST(from,to,length) memmove (to, from, (int) (length))
#define MOVE_FASTER(from,to,length) memmove (to, from, (int) (length))
#define MOVE_CLEAR(to,length) memset (to, 0, (int) (length))
#define API_ROUTINE __far __cdecl __loadds __export
#define API_ROUTINE_VARARG API_ROUTINE
#define FAR_VARIABLE __far
/* added for routines which are not to used by customers. */
#define INTERNAL_API_ROUTINE API_ROUTINE
#ifndef DLL_EXPORT
#define DLL_EXPORT API_ROUTINE
#endif
typedef RETSIGTYPE (API_ROUTINE * SIG_FPTR) ();
2001-05-23 15:26:42 +02:00
#endif /* ifndef NETWARE_386 */
/* DOS does not compare the high order word of far pointers,
2001-05-23 15:26:42 +02:00
so we must cast them to huge in comparions; also, for routines
which return a double, they must be given a pascal type so that
they will work in a multithreaded environment */
#define HUGE_PTR huge
#define PASCAL_ROUTINE pascal
#endif /* PC_PLATFORM */
/* DEC VAX/VMS and AlphaVMS */
#ifdef VMS
#define VAX_FLOAT 1
#define FB_ALIGN(n,b) (n)
/*#define ALIGNMENT 4*/
2001-05-23 15:26:42 +02:00
#define NO_NFS
#define CTO32L(p) (*(long*)p)
#define NO_CHECKSUM 1
#define ISC_EXT_LIB_PATH_ENV "interbase_ext_lib_path:"
#define SYS_ARG isc_arg_vms
#if __ALPHA
2002-06-29 15:03:13 +02:00
#define IMPLEMENTATION isc_info_db_impl_alpha_vms /* 53 */
2001-05-23 15:26:42 +02:00
#include <ints.h>
#define ATOM_DEFINED
typedef int64 SATOM; /* 64 bit */
typedef unsigned int64 UATOM;
#else
2002-06-29 15:03:13 +02:00
#define IMPLEMENTATION isc_info_db_impl_isc_vms /* 27 */
2001-05-23 15:26:42 +02:00
#endif /* __ALPHA */
#define FINI_OK 1
#define FINI_ERROR 44
#define STARTUP_ERROR 46 /* this is also used in iscguard.h, make sure these match */
typedef RETSIGTYPE (*SIG_FPTR) ();
2001-05-23 15:26:42 +02:00
#endif /* VMS */
/* IBM AIX RS/6000 and IBM AIX PowerPC */
#ifdef _AIX /* IBM AIX */
#ifndef _POWER /* IBM RS/6000 */
#define AIX
#define KILLER_SIGNALS
#define UNIX 1
#define CURSES_KEYPAD 1
#define FB_ALIGN(n,b) ((n + b - 1) & ~(b - 1))
/*#define ALIGNMENT 4*/
2002-06-29 15:03:13 +02:00
#define IMPLEMENTATION isc_info_db_impl_isc_rt_aix /* 35 */
2001-05-23 15:26:42 +02:00
#define IEEE
#define MEMMOVE(from,to,length) memmove ((void *)to, (void *)from, (size_t) length)
#define MOVE_FAST(from,to,length) memcpy (to, from, (int) (length))
#define MOVE_FASTER(from,to,length) memcpy (to, from, (int) (length))
#define MOVE_CLEAR(to,length) memset (to, 0, (int) (length))
#define SYSCALL_INTERRUPTED(err) (((err) == EINTR) || ((err) == ERESTART)) /* pjpg 20001102 */
#else /* AIX PowerPC */
#define AIX_PPC
#define KILLER_SIGNALS
#define UNIX 1
#define CURSES_KEYPAD 1
#define FB_ALIGN(n,b) ((n + b - 1) & ~(b - 1))
/*#define ALIGNMENT 4*/
2002-06-29 15:03:13 +02:00
#define IMPLEMENTATION isc_info_db_impl_isc_rt_aix /* 35 */
2001-05-23 15:26:42 +02:00
#define IEEE
#define MEMMOVE(from,to,length) memmove ((void *)to, (void *)from, (size_t) length)
#define MOVE_FAST(from,to,length) memcpy (to, from, (int) (length))
#define MOVE_FASTER(from,to,length) memcpy (to, from, (int) (length))
#define MOVE_CLEAR(to,length) memset (to, 0, (int) (length))
#define SYSCALL_INTERRUPTED(err) (((err) == EINTR) || ((err) == ERESTART)) /* pjpg 20001102 */
#define VA_START(list,parmN) va_start (list, parmN) /* TMC 081700 */
#define QUADFORMAT "ll" /* TMC 081700 */
#define QUADCONST(n) (n##LL) /* TMC 081700 */
#endif /* IBM PowerPC */
typedef RETSIGTYPE (*SIG_FPTR) ();
2001-05-23 15:26:42 +02:00
#endif /* IBM AIX */
/* Windows NT */
#if (defined(_MSC_VER) && (defined(WIN32) || defined(_WIN32))) || \
(defined(__BORLANDC__) && defined(__WIN32__))
#define WIN_NT
#define NO_PYXIS
#define NO_NFS
#undef LINKS_EXIST
#define MOVE_FAST(from,to,length) memcpy (to, from, (int) (length))
#define MOVE_FASTER(from,to,length) memcpy (to, from, (int) (length))
#define MOVE_CLEAR(to,length) memset (to, 0, (int) (length))
#define MEMMOVE(from,to,length) memmove ((void *)to, (void *)from, (size_t) length)
#define SYS_ARG isc_arg_win32
typedef __int64 SINT64;
typedef unsigned __int64 UINT64;
#define INT64_DEFINED
/* The following define is the prefix to go in front of a "d" or "u"
format item in a ib_printf() format string, to indicate that the argument
is an SINT64 or UINT64. */
#define QUADFORMAT "I64"
/* The following macro creates a quad-sized constant, possibly one
which is too large to fit in a long int. The Microsoft compiler does
not permit the LL suffix which some other platforms require, but it
handles numbers up to the largest 64-bit integer correctly without such
a suffix, so the macro definition is trivial. */
#define QUADCONST(n) (n)
#ifdef _X86_
#define i386
#ifndef I386
#define I386
#endif
2002-06-29 15:03:13 +02:00
#define IMPLEMENTATION isc_info_db_impl_isc_winnt_x86 /* 50 */
2001-05-23 15:26:42 +02:00
#endif
#define IEEE
#define VA_START(list,parmN) va_start (list, parmN)
#define API_ROUTINE __stdcall
#define API_ROUTINE_VARARG __cdecl
#define CLIB_ROUTINE __cdecl
#define THREAD_ROUTINE __stdcall
#define INTERNAL_API_ROUTINE API_ROUTINE
2002-06-29 15:03:13 +02:00
#define SYNC_WRITE_DEFAULT 1
2001-05-23 15:26:42 +02:00
#ifndef DLL_EXPORT
#define DLL_EXPORT
#endif
2001-12-24 03:51:06 +01:00
//#define BOOLEAN_DEFINED
//typedef unsigned char BOOLEAN;
2001-05-23 15:26:42 +02:00
#ifndef MAXPATHLEN
#define MAXPATHLEN 260
#endif
typedef RETSIGTYPE (CLIB_ROUTINE * SIG_FPTR) (int);
2001-05-23 15:26:42 +02:00
#endif /* WIN_NT */
// 23 Sep 2002, skidder, ALLOC_LIB_MEMORY moved here,
// DEBUG_GDS_ALLOC definition removed because allocators
// do not (and can not) include this file,
// but use DEBUG_GDS_ALLOC. Hence DEBUG_GDS_ALLOC should be defined
// globally by now and moved to autoconf-generated header later
#ifdef DEBUG_GDS_ALLOC
#define ALLOC_LIB_MEMORY(size) gds__alloc_debug ((size),(TEXT *)__FILE__,(ULONG)__LINE__)
#endif
2001-05-23 15:26:42 +02:00
/* SCO */
#ifndef SCO_EV
#ifdef M_I386
#define SMALL_FILE_NAMES
#define NOHOSTNAME
#define KILLER_SIGNALS
#define SYSV_SIGNALS
#ifndef MAXPATHLEN
#define MAXPATHLEN 1024
#endif
#define I386 1
#define UNIX 1
#define CURSES_KEYPAD 1
#ifdef M_UNIX
#define SCO_UNIX 1
2002-06-29 15:03:13 +02:00
#define IMPLEMENTATION isc_info_db_impl_isc_sco_unix /* 42 */
2001-05-23 15:26:42 +02:00
#define INTL_BACKEND
#else
#define FB_ALIGN(n,b) ((n+1) & ~1)
2002-06-29 15:03:13 +02:00
#define IMPLEMENTATION isc_info_db_impl_isc_xenix /* 37 */
2001-05-23 15:26:42 +02:00
#endif
#define IEEE
#undef LINKS_EXIST
typedef RETSIGTYPE (*SIG_FPTR) ();
2001-05-23 15:26:42 +02:00
#endif /* M_I386 */
#else /* ifndef SCO_EV */
2002-06-29 15:03:13 +02:00
#define QUADFORMAT "ll"
#define QUADCONST(n) (n##LL)
2001-05-23 15:26:42 +02:00
#define I386 1
#define UNIX 1
#define SCO_UNIX 1
#define IEEE
/*
#define KILLER_SIGNALS
*/
2002-06-29 15:03:13 +02:00
#define IMPLEMENTATION isc_info_db_impl_sco_ev /* 59 */
2001-05-23 15:26:42 +02:00
#define MEMMOVE(from,to,length) memmove ((void *)to, (void *)from, (size_t) length)
#define MOVE_FAST(from,to,length) memcpy (to, from, (unsigned int) (length))
#define MOVE_FASTER(from,to,length) memcpy (to, from, (unsigned int) (length))
#define MOVE_CLEAR(to,length) memset (to, 0, (unsigned int) (length))
#ifndef MAXPATHLEN
#define MAXPATHLEN 1024
#endif
/* These functions are supported so we don't need the defines
#define setreuid(ruid,euid) setuid(euid)
#define setregid(rgid,egid) setgid(egid)
*/
typedef RETSIGTYPE (*SIG_FPTR) ();
2001-05-23 15:26:42 +02:00
#endif /* ifndef SCO_EV */
#ifdef DGUX
#define UNIX 1
#define KILLER_SIGNALS
#define CURSES_KEYPAD 1
#ifndef DG_X86
#define FB_ALIGN(n,b) ((n + b - 1) & ~(b - 1))
/*#define ALIGNMENT 8*/
/*#define DOUBLE_ALIGN 8*/
2002-06-29 15:03:13 +02:00
#define IMPLEMENTATION isc_info_db_impl_isc_dg /* 38 */
2001-05-23 15:26:42 +02:00
#else
2002-06-29 15:03:13 +02:00
#define IMPLEMENTATION isc_info_db_impl_dg_x86 /* 58 */
2001-05-23 15:26:42 +02:00
#define I386 1
#endif /* DG_X86 */
#define IEEE
#define INTL_BACKEND
#ifndef MAXPATHLEN
#define MAXPATHLEN 1024
#endif
typedef RETSIGTYPE (*SIG_FPTR) ();
2001-05-23 15:26:42 +02:00
#endif /* DGUX */
#if (defined(__osf__) && defined(__alpha))
#include <stddef.h>
#define DECOSF
#define NO_PYXIS
#define KILLER_SIGNALS
#define UNIX 1
#define FB_ALIGN(n,b) ((n + b - 1) & ~(b - 1))
/*#define ALIGNMENT 8*/
/*#define DOUBLE_ALIGN 8*/
2002-06-29 15:03:13 +02:00
#define IMPLEMENTATION isc_info_db_impl_alpha_osf /* 52 */
2001-05-23 15:26:42 +02:00
#define IEEE
#ifndef MAXPATHLEN
#define MAXPATHLEN 1024
#endif
#define MEMMOVE(from,to,length) memmove ((void *)to, (void *)from, (size_t) length)
#define MOVE_FAST(from,to,length) memcpy (to, from, (int) (length))
#define MOVE_FASTER(from,to,length) memcpy (to, from, (int) (length))
#define MOVE_CLEAR(to,length) memset (to, 0, (int) (length))
2001-05-23 15:26:42 +02:00
#define ATOM_DEFINED
typedef long SATOM; /* 64 bit */
typedef unsigned long UATOM;
typedef RETSIGTYPE (*SIG_FPTR) ();
2001-05-23 15:26:42 +02:00
#endif /* DECOSF */
#ifdef sgi
#define KILLER_SIGNALS
#define UNIX 1
#define CURSES_KEYPAD 1
#define FB_ALIGN(n,b) ((n + b - 1) & ~(b - 1))
/*#define ALIGNMENT 8*/
/*#define DOUBLE_ALIGN 8*/
2002-06-29 15:03:13 +02:00
#define IMPLEMENTATION isc_info_db_impl_isc_sgi /* 41 */
2001-05-23 15:26:42 +02:00
#define IEEE
#define MEMMOVE(from,to,length) memmove ((void *)to, (void *)from, (size_t) length)
#ifndef MAXPATHLEN
#define MAXPATHLEN 1024
#endif
typedef RETSIGTYPE (*SIG_FPTR) ();
2001-05-23 15:26:42 +02:00
#endif /* sgi */
#ifdef NETWARE_386
/*
* In ..\remote, there will a duplicate definition for DWORD
* ocurring from <nwdstype.h>. Chech for this
* and undefine it before defining DWORD.
*/
#ifdef DWORD
#undef DWORD
#endif
typedef char *caddr_t;
/*
* The DWORD declaration is needed for compiling the JRD lib.
* (First compilation error will start from isc.c)
*/
typedef unsigned long DWORD;
#define SMALL_FILE_NAMES
#define NOHOSTNAME
#define SYS_ARG isc_arg_dos
#ifndef MAXPATHLEN
#define MAXPATHLEN 1024
#endif
#define I386 1
#define IEEE 1
#define FB_ALIGN(n,b) ((n+1) & ~1)
#define OLD_ALIGNMENT
#define NO_NFS
2002-06-29 15:03:13 +02:00
#define IMPLEMENTATION isc_info_db_impl_netware_386, /* 54 */
2001-05-23 15:26:42 +02:00
#undef LINKS_EXIST
#define VA_START(list,parmN) va_start (list, parmN)
#define INTL_BACKEND
#define SYNC_WRITE_DEFAULT 1
/* turn on stack reduction methods for only those routines
which are not commonly used; since this is a server, we
2001-05-23 15:26:42 +02:00
want to allocate buffers on the stack for oft-used routines */
#define STACK_REDUCTION
typedef RETSIGTYPE (CLIB_ROUTINE * SIG_FPTR) ();
2001-05-23 15:26:42 +02:00
#endif /* NETWARE_386 */
#ifdef UNIXWARE
#define KILLER_SIGNALS
#define NO_PYXIS
#define I386 1
#define UNIX 1
#define CURSES_KEYPAD 1
2002-06-29 15:03:13 +02:00
#define IMPLEMENTATION isc_info_db_impl_unixware, /* 49 */
2001-05-23 15:26:42 +02:00
#define IEEE
#ifndef MAXPATHLEN
#define MAXPATHLEN 1024
#endif
#define MOVE_FAST(from,to,length) memcpy (to, from, (int) (length))
#define MOVE_FASTER(from,to,length) memcpy (to, from, (int) (length))
#define MOVE_CLEAR(to,length) memset (to, 0, (int) (length))
#define setreuid(ruid,euid) setuid (euid)
#define setregid(rgid,egid) setgid (egid)
typedef RETSIGTYPE (*SIG_FPTR) ();
2001-05-23 15:26:42 +02:00
#endif /* UNIXWARE */
#ifdef UNIX
#define NO_CHECKSUM 1
#define SYS_ARG isc_arg_unix
#endif /* UNIX */
/* various declaration modifiers */
#ifndef HUGE_PTR
#define HUGE_PTR
#endif
#ifndef FAR_VARIABLE
#define FAR_VARIABLE
#endif
#ifndef PASCAL_ROUTINE
#define PASCAL_ROUTINE
#endif
#ifndef API_ROUTINE
#define API_ROUTINE
#define API_ROUTINE_VARARG
#define INTERNAL_API_ROUTINE API_ROUTINE
#endif
#ifndef CLIB_ROUTINE
#define CLIB_ROUTINE
#endif
#ifndef THREAD_ROUTINE
#define THREAD_ROUTINE
#endif
/* alignment macros */
#ifndef OLD_ALIGNMENT
#ifdef I386
/* Using internal alignment optimal for 386 processor and above
*/
/*#define ALIGNMENT 4*/
/*#define DOUBLE_ALIGN 8*/
2001-05-23 15:26:42 +02:00
#define FB_ALIGN(n,b) ((n + b - 1) & ~(b - 1))
#endif
#endif
#ifndef ALIGNMENT
/*#define ALIGNMENT 2*/
#error must define ALIGNMENT for your system
2001-05-23 15:26:42 +02:00
#endif
#ifndef SHIFTLONG
/* Number of shifts needed to convert between char and LONG */
#define SHIFTLONG 2
#define BITS_PER_LONG 32
#define LOG2_BITS_PER_LONG 5
#endif
#ifndef DOUBLE_ALIGN
/*#define DOUBLE_ALIGN 4*/
#error must define DOUBLE_ALIGN for your system
2001-05-23 15:26:42 +02:00
#endif
/* common return values */
#ifndef FINI_OK
#define FINI_OK 0
#define FINI_ERROR 1
#define STARTUP_ERROR 2 /* this is also used in iscguard.h, make sure these match */
#endif
#ifndef NULL
#define NULL 0L
#endif
#define NULL_PTR ((void*) 0)
2001-07-12 07:46:06 +02:00
#ifndef TRUE
2001-05-23 15:26:42 +02:00
#define TRUE 1
2001-07-12 07:46:06 +02:00
#endif
#ifndef FALSE
2001-05-23 15:26:42 +02:00
#define FALSE 0
2001-07-12 07:46:06 +02:00
#endif
2001-05-23 15:26:42 +02:00
#define SUCCESS 0
#define FAILURE 1
/* data type definitions */
#ifndef INT64_DEFINED /* 64 bit */
typedef long long int SINT64;
typedef unsigned long long int UINT64;
#else
#undef INT64_DEFINED
#endif
#ifndef ATOM_DEFINED /* 32 or 64 bit */
typedef long SATOM;
typedef unsigned long UATOM;
#else
#undef ATOM_DEFINED
#endif
2001-12-24 03:51:06 +01:00
/*
2001-05-23 15:26:42 +02:00
#ifndef BOOLEAN_DEFINED
typedef USHORT BOOLEAN;
#else
#undef BOOLEAN_DEFINED
#endif
2001-12-24 03:51:06 +01:00
*/
2001-05-23 15:26:42 +02:00
#ifndef ISC_TIMESTAMP_DEFINED
typedef SLONG ISC_DATE;
typedef ULONG ISC_TIME;
typedef struct
{
ISC_DATE timestamp_date;
ISC_TIME timestamp_time;
} ISC_TIMESTAMP;
#define ISC_TIMESTAMP_DEFINED
#endif /* ISC_TIMESTAMP_DEFINED */
#define GDS_DATE ISC_DATE
#define GDS_TIME ISC_TIME
#define GDS_TIMESTAMP ISC_TIMESTAMP
#ifndef ENUM
#define ENUM enum
#endif
#ifndef BLOB_PTR
#define BLOB_PTR UCHAR
#endif
2001-12-24 03:51:06 +01:00
#ifndef SLONGFORMAT
#define SLONGFORMAT "d"
#endif
2001-05-23 15:26:42 +02:00
/* variable argument definitions */
#ifdef SCO
#if __STDC__
#define VA_START(list,parmN) va_start (list, parmN)
#endif
#else
#ifdef __STDC__
#define VA_START(list,parmN) va_start (list, parmN)
#endif
#endif /* SCO */
#ifndef VA_START
#define VA_START(list,parmN) va_start (list)
#endif
/* conditional compilation macros */
/* MAX and MIN for datatypes */
#define MAX_UCHAR ((UCHAR)0xFF)
#define MIN_UCHAR 0x00
#define MAX_SCHAR 0x7F
#define MIN_SCHAR (-MAX_SCHAR-1)
#define MAX_USHORT ((USHORT)0xFFFF)
#define MIN_USHORT 0x0000
#define MAX_SSHORT 0x7FFF
#define MIN_SSHORT (-MAX_SSHORT-1)
#define MAX_ULONG ((ULONG)0xFFFFFFFF)
#define MIN_ULONG 0x00000000
#define MAX_SLONG 0x7FFFFFFF
#define MIN_SLONG (-MAX_SLONG-1)
#define MAX_UINT64 ((UINT64) QUADCONST(0xFFFFFFFFFFFFFFFF))
#define MIN_UINT64 QUADCONST(0x0000000000000000)
#define MAX_SINT64 QUADCONST(0x7FFFFFFFFFFFFFFF)
#define MIN_SINT64 (-MAX_SINT64-1)
/* commonly used macros */
#ifndef MAX
#define MAX(a,b) (((a) > (b)) ? (a) : (b))
#endif
#ifndef MIN
#define MIN(a,b) (((a) < (b)) ? (a) : (b))
#endif
#define UPPER(c) (((c) >= 'a' && (c)<= 'z') ? (c) - 'a' + 'A' : (c))
#define LOWWER(c) (((c) >= 'A' && (c)<= 'Z') ? (c) - 'A' + 'a' : (c))
/* UPPER7 & LOWWER7 are to be used when the data is known to
be 7-bit ASCII, eg: internal data, OS data. NOT user data. */
#define UPPER7(c) (((c) >= 'a' && (c)<= 'z') ? (c) - 'a' + 'A' : (c))
#define LOWWER7(c) (((c) >= 'A' && (c)<= 'Z') ? (c) - 'A' + 'a' : (c))
#ifndef ROUNDUP
#define ROUNDUP(n,b) (((n) + (b) - 1) & ~((b) - 1))
#endif
#define ROUNDUP_LONG(len) ROUNDUP (len, sizeof (SLONG))
#define JRD_BUGCHK 15 /* facility code for bugcheck messages */
#ifndef OFFSET
#define OFFSET(struct,fld) ((int) &((struct) 0)->fld)
#define OFFSETA(struct,fld) ((int) ((struct) 0)->fld)
#endif
#ifndef ODS_ALIGNMENT
#define ODS_ALIGNMENT 4
#endif
#ifndef SYSCALL_INTERRUPTED
#define SYSCALL_INTERRUPTED(err) ((err) == EINTR)
#endif
/* data conversion macros */
#ifndef CTO32L
#ifndef WORDS_BIGENDIAN
2001-05-23 15:26:42 +02:00
#define CTO32L(p) ((((SCHAR*)(p))[3] << 24) | (((UCHAR*)(p))[2] << 16) | (((UCHAR*)(p))[1] << 8) | (((UCHAR*)(p)) [0]))
#else
#define CTO32L(p) ((((SCHAR*)(p))[0] << 24) | (((UCHAR*)(p))[1] << 16) | (((UCHAR*)(p))[2] << 8) | (((UCHAR*)(p)) [3]))
#endif
#endif
#ifndef AOF32L
#define AOF32L(l) &l
#endif
/* data movement and allocation macros */
#ifndef MOVE_FAST
#define MOVE_FAST(from,to,length) MOV_fast (from, to, (ULONG) (length))
#endif
#ifndef MOVE_FASTER
#define MOVE_FASTER(from,to,length) MOV_faster (from, to, (ULONG) (length))
#endif
#ifndef MEMMOVE
/* Use character by character copy function */
#define MEMMOVE(from,to,length) MOV_fast (from, to, (ULONG) (length))
#endif
#ifndef MOVE_CLEAR
#define MOVE_CLEAR(to,length) MOV_fill (to, (ULONG) (length))
#endif
#ifndef ALLOC_LIB_MEMORY
#define ALLOC_LIB_MEMORY(size) gds__alloc (size)
#endif
#ifndef FREE_LIB_MEMORY
#define FREE_LIB_MEMORY(block) gds__free (block)
#endif
#ifdef DEV_BUILD
/* Define any debugging symbols and macros here. This
2001-05-23 15:26:42 +02:00
ifdef will be executed during development builds. */
#ifdef NETWARE_386
#define DEV_REPORT(msg) ConsolePrintf (msg)
#define BREAKPOINT(x) Breakpoint(x)
#define TRACE(msg) ConsolePrintf (msg)
#endif
#ifdef WIN_NT
#define TRACE(msg) gds__log (msg)
#define DEV_REPORT(msg) gds__log (msg)
#endif
#ifndef TRACE
#define TRACE(msg) ib_fprintf (ib_stderr, (msg))
#endif
#ifndef DEV_REPORT
#define DEV_REPORT(msg) ib_fprintf (ib_stderr, (msg))
#endif
#ifndef BREAKPOINT
#define BREAKPOINT(x) GDS_breakpoint(x)
// fwd. decl. the function itself
#ifdef __cplusplus
extern "C" {
#endif
void GDS_breakpoint(int);
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif
#endif /* DEV_BUILD */
#ifndef DEV_BUILD
#define DEV_REPORT(msg) gds__log (msg)
#define BREAKPOINT(x) /* nothing */
#define TRACE(msg) /* nothing */
#endif
/* shared library definitions */
#ifdef SHLIB_DEFS
#ifndef LOCAL_SHLIB_DEFS
#include "../jrd/shdef.h"
#endif
#endif
#ifndef DLL_EXPORT
#define DLL_EXPORT
#endif
/* commonly used buffer sizes for dynamic buffer allocation */
#define BUFFER_XLARGE 2048
#define BUFFER_LARGE 1024
#define BUFFER_MEDIUM 512
#define BUFFER_SMALL 256
#define BUFFER_TINY 128
2002-06-29 15:03:13 +02:00
/* The default lseek offset type. Changed from nothing to (off_t) to correctly support 64 bit IO */
2001-07-12 07:46:06 +02:00
#ifndef LSEEK_OFFSET_CAST
2002-06-29 15:03:13 +02:00
#define LSEEK_OFFSET_CAST (off_t)
2001-07-12 07:46:06 +02:00
#endif
2001-05-23 15:26:42 +02:00
#ifndef DOUBLE_MULTIPLY
#define DOUBLE_MULTIPLY(a,b) (((double) (a)) * ((double) (b)))
#endif
#ifndef DOUBLE_DIVIDE
#define DOUBLE_DIVIDE(a,b) (((double) (a)) / ((double) (b)))
#endif
#ifndef ISC_EXT_LIB_PATH_ENV
#define ISC_EXT_LIB_PATH_ENV "INTERBASE_EXT_LIB_PATH"
#endif
#ifndef MAXPATHLEN
#define MAXPATHLEN 1024
#endif
#define ISC_STATUS_LENGTH 20
/* switch name and state table. This structure should be used in all
* command line tools to facilitate parsing options.*/
typedef struct in_sw_tab_t {
int in_sw;
int in_spb_sw;
TEXT *in_sw_name;
ULONG in_sw_value; /* alice specific field */
ULONG in_sw_requires; /* alice specific field */
ULONG in_sw_incompatibilities; /* alice specific field */
USHORT in_sw_state;
USHORT in_sw_msg;
USHORT in_sw_min_length;
TEXT *in_sw_text;
} *IN_SW_TAB;
#ifndef HAVE_WORKING_VFORK
#define vfork fork
#endif
#endif /* JRD_COMMON_H */