#ifndef _XF86_OSLIB_H
#define _XF86_OSLIB_H
#include <X11/Xos.h>
#include <X11/Xfuncproto.h>
#ifndef HAVE_WRAPPER_DECLS
#define HAVE_WRAPPER_DECLS
#undef usleep
#define usleep(a) xf86usleep(a)
extern void xf86usleep(unsigned long);
extern int xf86getpagesize(void);
extern int xf86GetErrno(void);
typedef unsigned long xf86size_t;
typedef signed long xf86ssize_t;
#endif
#include <stdio.h>
#include <ctype.h>
#include <stddef.h>
#if (defined(SYSV) || defined(SVR4)) && \
!defined(DGUX) && !defined(sgi) && \
(defined(sun) || defined(i386))
# ifdef SCO325
# ifndef _SVID3
# define _SVID3
# endif
# ifndef _NO_STATIC
# define _NO_STATIC
# endif
# endif
# include <sys/ioctl.h>
# include <signal.h>
# include <termio.h>
# include <sys/stat.h>
# include <sys/types.h>
# if defined(__SCO__) || defined(ISC)
# include <sys/param.h>
# endif
# ifdef ISC
# define TIOCMSET (TIOC|26)
# define TIOCMBIS (TIOC|27)
# define TIOCMBIC (TIOC|28)
# define TIOCMGET (TIOC|29)
# endif
# include <errno.h>
# if defined(_NEED_SYSI86)
# if !(defined (sun) && defined (SVR4))
# include <sys/immu.h>
# include <sys/region.h>
# endif
# include <sys/proc.h>
# include <sys/tss.h>
# include <sys/sysi86.h>
# if defined(SVR4) && !defined(sun)
# include <sys/seg.h>
# endif
# if defined(sun) && defined (SVR4)
# if defined(i386) || defined(__x86)
# if !defined(V86SC_IOPL)
# include <sys/v86.h>
# endif
# endif
# else
# include <sys/v86.h>
# endif
# if defined(sun) && (defined (i386) || defined(__x86)) && defined (SVR4)
# include <sys/psw.h>
# endif
# endif
# if defined(HAS_SVR3_MMAPDRV)
# include <sys/sysmacros.h>
# if !defined(_NEED_SYSI86)
# include <sys/immu.h>
# include <sys/region.h>
# endif
# include <sys/mmap.h>
# endif
# if !defined(sun) || (!defined(sparc) && !defined(__SOL8__))
# define HAS_USL_VTS
# endif
# if !defined(sun)
# include <sys/emap.h>
# endif
# if defined(SCO325)
# include <sys/vtkd.h>
# include <sys/console.h>
# include <sys/scankbd.h>
# include <sys/vid.h>
# define LED_CAP CLKED
# define LED_NUM NLKED
# define LED_SCR SLKED
# elif defined(HAS_USL_VTS)
# include <sys/at_ansi.h>
# include <sys/kd.h>
# include <sys/vt.h>
# elif defined(sun)
# include <sys/fbio.h>
# include <sys/kbd.h>
# include <sys/kbio.h>
# undef STRING
# undef LEFTALT
# undef RIGHTALT
# define LED_CAP LED_CAPS_LOCK
# define LED_NUM LED_NUM_LOCK
# define LED_SCR LED_SCROLL_LOCK
# define LED_COMP LED_COMPOSE
# endif
# if !defined(VT_ACKACQ)
# define VT_ACKACQ 2
# endif
# if defined(__SCO__)
# include <sys/sysmacros.h>
# define POSIX_TTY
# endif
# if defined(SVR4) || defined(SCO325)
# include <sys/mman.h>
# if !(defined(sun) && defined (SVR4))
# define DEV_MEM "/dev/pmem"
# endif
# ifdef SCO325
# undef DEV_MEM
# define DEV_MEM "/dev/mem"
# endif
# define CLEARDTR_SUPPORT
# define POSIX_TTY
# endif
# ifdef ISC
# include <termios.h>
# define POSIX_TTY
# endif
# if defined(sun) && defined (i386) && defined (SVR4) && !defined(__SOL8__)
# define USE_VT_SYSREQ
# define VT_SYSREQ_DEFAULT TRUE
# endif
# if defined(ATT) && !defined(i386)
# define i386
# endif
# if (defined(ATT) || defined(SVR4)) && !defined(sun)
# ifndef __UNIXWARE__
# ifndef XQUEUE
# define XQUEUE
# endif
# endif
# include <sys/xque.h>
# endif
# ifdef SYSV
# if !defined(ISC) || defined(ISC202) || defined(ISC22)
# define NEED_STRERROR
# endif
# endif
#endif
#if defined(DGUX) && defined(SVR4)
#include <sys/ioctl.h>
#include <signal.h>
#include <ctype.h>
#include <termios.h>
#include <sys/termios.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/param.h>
#include <errno.h>
#include <sys/sysi86.h>
#include <unistd.h>
#include <sys/proc.h>
#include <sys/map.h>
#include <sys/sysmacros.h>
#include <sys/mman.h>
#include <sys/kd.h>
#include <sys/kbd.h>
#include <fcntl.h>
#include <time.h>
#include <sys/stream.h>
#include <sys/ptms.h>
#include <sys/socket.h>
#include <sys/utsname.h>
#include <sys/stropts.h>
#include <sys/sockio.h>
#define POSIX_TTY
#undef HAS_USL_VTS
#undef USE_VT_SYSREQ
#undef VT_ACKACQ
#define LED_CAP KBD_LED_CAPS_LOCK
#define LED_NUM KBD_LED_NUM_LOCK
#define LED_SCR KBD_LED_SCROLL_LOCK
#define KDGKBTYPE KBD_GET_LANGUAGE
# define KB_84 2
# define KB_101 1
# define KB_OTHER 3
#define KDSETLED KBD_SET_LED
#define KDGETLED KBD_GET_STATE
#undef KDMKTONE
#define KDMKTONE KBD_TONE_HIGH
#undef DEV_MEM
#define DEV_MEM "/dev/mem"
#define CLEARDTR_SUPPORT
#undef VT_SYSREQ_DEFAULT
#define VT_SYSREQ_DEFAULT FALSE
#endif
#if defined(__linux__) || defined(__GLIBC__)
# include <sys/ioctl.h>
# include <signal.h>
# include <stdlib.h>
# include <sys/types.h>
# include <assert.h>
#ifdef __GNU__
# define USE_OSMOUSE
#endif
# ifdef __linux__
# include <termio.h>
# else
# include <termios.h>
# endif
# ifdef __sparc__
# include <sys/param.h>
# endif
# include <errno.h>
# include <sys/stat.h>
# include <sys/mman.h>
# ifdef __linux__
# define HAS_USL_VTS
# include <sys/kd.h>
# include <sys/vt.h>
# define LDGMAP GIO_SCRNMAP
# define LDSMAP PIO_SCRNMAP
# define LDNMAP LDSMAP
# define CLEARDTR_SUPPORT
# define USE_VT_SYSREQ
# endif
# define POSIX_TTY
#endif
#if defined(Lynx)
# include <termio.h>
# include <sys/ioctl.h>
# include <param.h>
# include <signal.h>
# include <kd.h>
# include <vt.h>
# include <sys/stat.h>
# include <errno.h>
extern int errno;
# include <smem.h>
# define KB_84 1
# define KB_101 2
# define KB_OTHER 3
# define VT_ACKACQ 2
# include <termios.h>
# define POSIX_TTY
# define CLEARDTR_SUPPORT
# ifdef LED_NUMLOCK
# define LED_CAP LED_CAPSLOCK
# define LED_NUM LED_NUMLOCK
# define LED_SCR LED_SCROLLOCK
# endif
#endif
#if defined(__386BSD__) && (defined(__FreeBSD__) || defined(__NetBSD__))
# undef __386BSD__
#endif
#ifdef CSRG_BASED
# include <sys/ioctl.h>
# include <signal.h>
# include <termios.h>
# define termio termios
# define POSIX_TTY
# include <errno.h>
# include <sys/types.h>
# include <sys/mman.h>
# include <sys/stat.h>
# if defined(__bsdi__)
# include <sys/param.h>
# if (_BSDI_VERSION < 199510)
# include <i386/isa/vgaioctl.h>
# endif
# endif
#endif
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || \
defined(__NetBSD__) || defined(__OpenBSD__) || defined(__bsdi__) || defined(__DragonFly__)
# include <sys/param.h>
# if defined(__FreeBSD_version) && !defined(__FreeBSD_kernel_version)
# define __FreeBSD_kernel_version __FreeBSD_version
# endif
# if !defined(LINKKIT)
# if defined(__bsdi__)
# include <i386/isa/pcconsioctl.h>
# define CONSOLE_X_MODE_ON PCCONIOCRAW
# define CONSOLE_X_MODE_OFF PCCONIOCCOOK
# define CONSOLE_X_BELL PCCONIOCBEEP
# else
# if defined(__OpenBSD__)
# ifdef PCCONS_SUPPORT
# include <machine/pccons.h>
# undef CONSOLE_X_MODE_ON
# undef CONSOLE_X_MODE_OFF
# undef CONSOLE_X_BELL
# endif
# endif
# ifdef SYSCONS_SUPPORT
# define COMPAT_SYSCONS
# if defined(__NetBSD__) || defined(__OpenBSD__)
# include <machine/console.h>
# else
# if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
# if defined(__DragonFly__) || (__FreeBSD_kernel_version >= 410000)
# include <sys/consio.h>
# include <sys/kbio.h>
# else
# include <machine/console.h>
# endif
# else
# include <sys/console.h>
# endif
# endif
# endif
# if defined(PCVT_SUPPORT)
# if !defined(SYSCONS_SUPPORT)
# if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
# include <machine/pcvt_ioctl.h>
# else
# if defined(__NetBSD__) || defined(__OpenBSD__)
# if !defined(WSCONS_SUPPORT)
# include <machine/pcvt_ioctl.h>
# endif
# else
# include <sys/pcvt_ioctl.h>
# endif
# endif
# else
# define VGAPCVTID _IOWR('V',113, struct pcvtid)
struct pcvtid {
char name[16];
int rmajor, rminor;
};
# endif
# endif
# ifdef WSCONS_SUPPORT
# include <dev/wscons/wsconsio.h>
# include <dev/wscons/wsdisplay_usl_io.h>
# endif
# if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
# if defined(__FreeBSD_kernel_version) && (__FreeBSD_kernel_version >= 500013)
# include <sys/mouse.h>
# else
# undef MOUSE_GETINFO
# include <machine/mouse.h>
# endif
# endif
# ifndef CONSOLE_X_MODE_ON
# define CONSOLE_X_MODE_ON _IO('t',121)
# endif
# ifndef CONSOLE_X_MODE_OFF
# define CONSOLE_X_MODE_OFF _IO('t',122)
# endif
# ifndef CONSOLE_X_BELL
# define CONSOLE_X_BELL _IOW('t',123,int[2])
# endif
# ifndef CONSOLE_X_TV_ON
# define CONSOLE_X_TV_ON _IOW('t',155,int)
# define XMODE_RGB 0
# define XMODE_NTSC 1
# define XMODE_PAL 2
# define XMODE_SECAM 3
# endif
# ifndef CONSOLE_X_TV_OFF
# define CONSOLE_X_TV_OFF _IO('t',156)
# endif
#ifndef CONSOLE_GET_LINEAR_INFO
# define CONSOLE_GET_LINEAR_INFO _IOR('t',157,struct map_info)
#endif
#ifndef CONSOLE_GET_IO_INFO
# define CONSOLE_GET_IO_INFO _IOR('t',158,struct map_info)
#endif
#ifndef CONSOLE_GET_MEM_INFO
# define CONSOLE_GET_MEM_INFO _IOR('t',159,struct map_info)
#endif
# endif
# endif
#if defined(USE_I386_IOPL) || defined(USE_AMD64_IOPL)
#include <machine/sysarch.h>
#endif
# define CLEARDTR_SUPPORT
# if defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT) || defined(WSCONS_SUPPORT)
# define USE_VT_SYSREQ
# endif
#endif
#if defined(__UNIXOS2__)
# include <signal.h>
# include <errno.h>
# include <sys/stat.h>
#if defined(I_NEED_OS2_H)
# undef BOOL
# undef BYTE
# include <os2.h>
#endif
# define KB_84 1
# define KB_101 2
# define KB_OTHER 3
# define LED_CAP 0x40
# define LED_NUM 0x20
# define LED_SCR 0x10
# define OSMOUSE_ONLY
# define MOUSE_PROTOCOL_IN_KERNEL
extern char* __XOS2RedirRoot(char*);
#endif
#if defined(QNX4)
#include <signal.h>
#include <errno.h>
#include <sys/stat.h>
#include <termios.h>
#include <ioctl.h>
#include <sys/param.h>
#define FD_SETSIZE 256
#include <sys/select.h>
# define KB_84 1
# define KB_101 2
# define KB_OTHER 3
# define LED_CAP 0x04
# define LED_NUM 0x02
# define LED_SCR 0x01
# define POSIX_TTY
# define OSMOUSE_ONLY
# define MOUSE_PROTOCOL_IN_KERNEL
#define TIOCM_DTR 0x0001
#define TIOCM_RTS 0x0002
#define TIOCM_CTS 0x1000
#define TIOCM_DSR 0x2000
#define TIOCM_RI 0x4000
#define TIOCM_RNG TIOCM_RI
#define TIOCM_CD 0x8000
#define TIOCM_CAR TIOCM_CD
#define TIOCM_LE 0x0100
#define TIOCM_ST 0x0200
#define TIOCM_SR 0x0400
#endif
#if defined(__QNXNTO__)
#include <signal.h>
#include <errno.h>
#include <sys/stat.h>
#include <termios.h>
#include <ioctl.h>
#include <sys/param.h>
#define FD_SETSIZE 256
#include <sys/select.h>
# define KB_84 1
# define KB_101 2
# define KB_OTHER 3
# define POSIX_TTY
#endif
#if defined(sgi)
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
#endif
#include <sys/wait.h>
#if !defined(O_NDELAY) && defined(O_NONBLOCK)
# define O_NDELAY O_NONBLOCK
#endif
#if !defined(MAXHOSTNAMELEN)
# define MAXHOSTNAMELEN 32
#endif
#if !defined(X_NOT_POSIX)
# if defined(_POSIX_SOURCE)
# include <limits.h>
# else
# define _POSIX_SOURCE
# include <limits.h>
# undef _POSIX_SOURCE
# endif
#endif
#if !defined(PATH_MAX)
# if defined(MAXPATHLEN)
# define PATH_MAX MAXPATHLEN
# else
# define PATH_MAX 1024
# endif
#endif
#ifdef NEED_STRERROR
# ifndef strerror
extern char *sys_errlist[];
extern int sys_nerr;
# define strerror(n) \
((n) >= 0 && (n) < sys_nerr) ? sys_errlist[n] : "unknown error"
# endif
#endif
#if defined(ISC) || defined(Lynx)
#define rint(x) RInt(x)
double RInt(
double x
);
#endif
#ifndef DEV_MEM
#define DEV_MEM "/dev/mem"
#endif
#ifndef VT_SYSREQ_DEFAULT
#define VT_SYSREQ_DEFAULT FALSE
#endif
#ifdef OSMOUSE_ONLY
# ifndef MOUSE_PROTOCOL_IN_KERNEL
# define MOUSE_PROTOCOL_IN_KERNEL
# endif
#endif
#define SYSCALL(call) while(((call) == -1) && (errno == EINTR))
#define XF86_OS_PRIVS
#include "xf86_OSproc.h"
#ifndef NO_COMPILER_H
#include "compiler.h"
#endif
#endif