#ifndef _DB_OS_H_
#define _DB_OS_H_
#if defined(__cplusplus)
extern "C" {
#endif
#define DB_RETRY 100
#ifdef __TANDEM
#define RETRY_CHK(op, ret) do { \
int __retries, __t_ret; \
for ((ret) = 0, __retries = DB_RETRY;;) { \
if ((op) == 0) \
break; \
(ret) = __os_get_syserr(); \
if (((__t_ret = __os_posix_err(ret)) == EAGAIN || \
__t_ret == EBUSY || __t_ret == EINTR || \
__t_ret == EIO || __t_ret == 70) && --__retries > 0)\
continue; \
break; \
} \
} while (0)
#else
#define RETRY_CHK(op, ret) do { \
int __retries, __t_ret; \
for ((ret) = 0, __retries = DB_RETRY;;) { \
if ((op) == 0) \
break; \
(ret) = __os_get_syserr(); \
if (((__t_ret = __os_posix_err(ret)) == EAGAIN || \
__t_ret == EBUSY || __t_ret == EINTR || \
__t_ret == EIO) && --__retries > 0) \
continue; \
break; \
} \
} while (0)
#endif
#define RETRY_CHK_EINTR_ONLY(op, ret) do { \
int __retries; \
for ((ret) = 0, __retries = DB_RETRY;;) { \
if ((op) == 0) \
break; \
(ret) = __os_get_syserr(); \
if (__os_posix_err(ret) == EINTR && --__retries > 0) \
continue; \
break; \
} \
} while (0)
#define DB_OSO_ABSMODE 0x0001
#define DB_OSO_CREATE 0x0002
#define DB_OSO_DIRECT 0x0004
#define DB_OSO_DSYNC 0x0008
#define DB_OSO_EXCL 0x0010
#define DB_OSO_RDONLY 0x0020
#define DB_OSO_REGION 0x0040
#define DB_OSO_SEQ 0x0080
#define DB_OSO_TEMP 0x0100
#define DB_OSO_TRUNC 0x0200
#define DB_MODE_400 (S_IRUSR)
#define DB_MODE_600 (S_IRUSR|S_IWUSR)
#define DB_MODE_660 (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP)
#define DB_MODE_666 (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH)
#define DB_MODE_700 (S_IRUSR|S_IWUSR|S_IXUSR)
#define DB_IO_READ 1
#define DB_IO_WRITE 2
#define LAST_PANIC_CHECK_BEFORE_IO(env) \
PANIC_CHECK(env); \
if (env != NULL && \
F_ISSET((env)->dbenv, DB_ENV_NOFLUSH)) \
return (0) \
\
struct __fh_t {
TAILQ_ENTRY(__fh_t) q;
db_mutex_t mtx_fh;
int ref;
#if defined(DB_WIN32)
HANDLE handle;
HANDLE trunc_handle;
#endif
int fd;
char *name;
db_pgno_t pgno;
u_int32_t pgsize;
off_t offset;
#ifdef HAVE_STATISTICS
u_int32_t seek_count;
u_int32_t read_count;
u_int32_t write_count;
#endif
#define DB_FH_ENVLINK 0x01
#define DB_FH_NOSYNC 0x02
#define DB_FH_OPENED 0x04
#define DB_FH_UNLINK 0x08
#define DB_FH_REGION 0x10
u_int8_t flags;
};
#define CTIME_BUFLEN 26
#ifdef HAVE_VXWORKS
#define CHAR_STAR_CAST (char *)
#define VOID_STAR_CAST (void *)
#else
#define CHAR_STAR_CAST
#define VOID_STAR_CAST
#endif
#if defined(__cplusplus)
}
#endif
#include "dbinc_auto/os_ext.h"
#endif