#ifndef COMPAT_H
#define COMPAT_H
/* well, this is obviously wrong since it assumes it's 64bit, but older
GCCs don't define it and we really want it. */
#ifndef LLONG_MAX
#endif
defined(HAVE_TYPEOF)) && !defined(__cplusplus)
# define HAVE_TYPE_CHECKS
#endif
/* We really want NULL to be a pointer, since we have various type-checks
type checking is used - it's not otherwise needed and causes compiling
problems with e.g. Sun C compiler. */
#ifdef HAVE_TYPE_CHECKS
# define NULL ((void *)0)
#endif
#ifndef __has_extension
#endif
#endif
#ifndef __cplusplus
#ifdef HAVE__BOOL
typedef _Bool bool;
#else
typedef int bool;
#endif
#endif
#if defined (HAVE_UOFF_T)
/* native support */
#elif defined (UOFF_T_INT)
typedef unsigned int uoff_t;
#elif defined (UOFF_T_LONG)
typedef unsigned long uoff_t;
#elif defined (UOFF_T_LONG_LONG)
typedef unsigned long long uoff_t;
#else
#endif
#ifndef HAVE_UINTMAX_T
# if SIZEOF_LONG_LONG > 0
typedef unsigned long long uintmax_t;
# else
typedef unsigned long uintmax_t;
# endif
#endif
#ifndef HAVE_UINT_FAST32_T
# if SIZEOF_INT >= 4
typedef unsigned int uint_fast32_t;
# else
typedef unsigned long uint_fast32_t;
# endif
#endif
#ifndef HAVE_SOCKLEN_T
typedef int socklen_t;
#endif
/* WORDS_BIGENDIAN needs to be undefined if not enabled */
#if defined(WORDS_BIGENDIAN) && WORDS_BIGENDIAN == 0
#endif
#ifdef HAVE_SYS_SYSMACROS_H
# include <sys/sysmacros.h>
# ifdef HAVE_SYS_MKDEV_H
# endif
#elif !defined (DEV_T_STRUCT)
# define CMP_DEV_T(a, b) ((a) == (b))
#else
#endif
#ifdef HAVE_STAT_XTIM
# define HAVE_ST_NSECS
#elif defined (HAVE_STAT_XTIMESPEC)
# define HAVE_ST_NSECS
#else
#endif
#ifdef HAVE_ST_NSECS
/* TRUE if a nanosecond timestamp from struct stat matches another nanosecond.
If nanoseconds aren't supported in struct stat, returns always TRUE (useful
with NFS if some hosts support nanoseconds and others don't). */
#else
#endif
/* strcasecmp(), strncasecmp() */
#ifndef HAVE_STRCASECMP
# ifdef HAVE_STRICMP
# else
# endif
#endif
#ifndef HAVE_INET_ATON
#endif
#ifndef HAVE_VSYSLOG
#endif
#ifndef HAVE_GETPAGESIZE
int i_my_getpagesize(void);
#endif
#ifndef HAVE_FDATASYNC
#endif
struct const_iovec {
const void *iov_base;
};
#ifndef HAVE_STRUCT_IOVEC
struct iovec {
void *iov_base;
};
#endif
/* IOV_MAX should be in limits.h nowadays. Linux still (2005) requires
defining _XOPEN_SOURCE to get that value. UIO_MAXIOV works with it though,
so use it instead. 16 is the lowest acceptable value for all OSes. */
#ifndef IOV_MAX
# ifdef UIO_MAXIOV
# else
# endif
#endif
#ifndef HAVE_WRITEV
struct iovec;
#endif
# ifndef IN_COMPAT_C
# endif
#endif
#ifndef HAVE_SETEUID
#endif
#ifndef HAVE_SETEGID
#endif
#ifndef HAVE_LIBGEN_H
char *i_my_basename(char *path);
#endif
#ifdef HAVE_OLD_VSNPRINTF
# include <stdio.h>
#endif
#ifndef HAVE_CLOCK_GETTIME
# include <time.h>
#endif
/* ctype.h isn't safe with signed chars,
use our own instead if really needed */
#ifndef EOVERFLOW
#endif
#ifdef EDQUOT
#else
/* probably all modern OSes have EDQUOT, but just in case one doesn't assume
that ENOSPC is the same as "over quota". */
#endif
/* EPERM is returned sometimes if device doesn't support such modification */
#ifdef EROFS
#else
#endif
/* Returns TRUE if unlink() failed because it attempted to delete a directory */
/* EBUSY is given by some NFS implementations */
/* fstat() returns ENOENT instead of ESTALE with some Linux versions */
#if !defined(_POSIX_SYNCHRONIZED_IO) && \
defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && \
/* OS X Snow Leopard has fdatasync(), but no prototype for it. */
int fdatasync(int);
#endif
/* Try to keep IO operations at least this size */
#ifndef IO_BLOCK_SIZE
#endif
#if !defined(PIPE_BUF) && defined(_POSIX_PIPE_BUF)
#endif
#endif