#ifndef _DARWIN_SHIM_H
#define _DARWIN_SHIM_H
#include <stdint.h>
#include <sys/types.h>
#include <sys/time.h>
#undef NULL
#define NULL (0)
typedef uint8_t uchar_t;
typedef uint16_t ushort_t;
typedef uint32_t uint_t;
typedef uint32_t ulong_t;
typedef uint64_t u_longlong_t;
typedef int64_t longlong_t;
typedef int64_t off64_t;
typedef struct timespec timestruc_t;
typedef int32_t time32_t;
typedef struct timespec32 {
time32_t tv_sec;
int32_t tv_nsec;
} timespec32_t;
typedef struct timespec32 timestruc32_t;
typedef int64_t hrtime_t;
hrtime_t gethrtime(void);
typedef uint32_t projid_t;
typedef uint32_t taskid_t;
typedef uint32_t zoneid_t;
typedef int processorid_t;
typedef ulong_t Lmid_t;
typedef int lwpstatus_t;
#define fork1 fork
#define fseeko64 fseeko
#define ftello64 ftello
#define ftruncate64 ftruncate
#define lseek64 lseek
#define open64 open
#define fstat64 fstat
#define mmap64 mmap
#define open64 open
#define pread64 pread
#define stat64 stat
#define pthread_cond_reltimedwait_np pthread_cond_timedwait_relative_np
#define S_ROUND(x, a) ((x) + (((a) ? (a) : 1) - 1) & ~(((a) ? (a) : 1) - 1))
#define P2ROUNDUP(x, align) (-(-(x) & -(align)))
#define SEC 1
#define MILLISEC 1000
#define MICROSEC 1000000
#define NANOSEC 1000000000
#define P_ONLINE 0x0002
#define P_STATUS 0x0003
#define _SC_CPUID_MAX -1
#define _SC_NPROCESSORS_MAX -2
#define SI_ISALIST 1
#define SI_SYSNAME 2
#define SI_RELEASE 3
#define GLOBAL_ZONEID 0 // Darwin has no notion of zones(5). Always return 0.
extern projid_t getprojid(void); extern taskid_t gettaskid(void); extern zoneid_t getzoneid(void);
extern int gmatch(const char *, const char *);
extern int p_online(processorid_t, int);
extern long sysinfo(int, char *, long);
#define R_AMD64_64 1
struct _rwlock;
struct _lwp_mutex;
extern int _rw_read_held(struct _rwlock *);
extern int _rw_write_held(struct _rwlock *);
extern int _mutex_held(struct _lwp_mutex *);
#endif