Home | History | Annotate | Download | only in xorg
      1 /*  DO NOT EDIT THIS FILE.
      2 
      3     It has been auto-edited by fixincludes from:
      4 
      5 	"/usr/include/xorg/xf86_OSlib.h"
      6 
      7     This had to be done to correct non-standard usages in the
      8     original, manufacturer supplied header file.  */
      9 
     10 /* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86_OSlib.h,v 3.94 2003/11/03 05:11:51 tsi Exp $ */
     11 /*
     12  * Copyright 1990, 1991 by Thomas Roell, Dinkelscherben, Germany
     13  * Copyright 1992 by David Dawes <dawes (at) XFree86.org>
     14  * Copyright 1992 by Jim Tsillas <jtsilla (at) damon.ccs.northeastern.edu>
     15  * Copyright 1992 by Rich Murphey <Rich (at) Rice.edu>
     16  * Copyright 1992 by Robert Baron <Robert.Baron (at) ernst.mach.cs.cmu.edu>
     17  * Copyright 1992 by Orest Zborowski <obz (at) eskimo.com>
     18  * Copyright 1993 by Vrije Universiteit, The Netherlands
     19  * Copyright 1993 by David Wexelblat <dwex (at) XFree86.org>
     20  * Copyright 1994, 1996 by Holger Veit <Holger.Veit (at) gmd.de>
     21  * Copyright 1997 by Takis Psarogiannakopoulos <takis (at) dpmms.cam.ac.uk>
     22  * Copyright 1994-2003 by The XFree86 Project, Inc
     23  *
     24  * Permission to use, copy, modify, distribute, and sell this software and its
     25  * documentation for any purpose is hereby granted without fee, provided that
     26  * the above copyright notice appear in all copies and that both that
     27  * copyright notice and this permission notice appear in supporting
     28  * documentation, and that the names of the above listed copyright holders
     29  * not be used in advertising or publicity pertaining to distribution of
     30  * the software without specific, written prior permission.  The above listed
     31  * copyright holders make no representations about the suitability of this
     32  * software for any purpose.  It is provided "as is" without express or
     33  * implied warranty.
     34  *
     35  * THE ABOVE LISTED COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD
     36  * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
     37  * AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDERS BE
     38  * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
     39  * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
     40  * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
     41  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
     42  *
     43  */
     44 
     45 /*
     46  * The ARM32 code here carries the following copyright:
     47  *
     48  * Copyright 1997
     49  * Digital Equipment Corporation. All rights reserved.
     50  * This software is furnished under license and may be used and copied only in
     51  * accordance with the following terms and conditions.  Subject to these
     52  * conditions, you may download, copy, install, use, modify and distribute
     53  * this software in source and/or binary form. No title or ownership is
     54  * transferred hereby.
     55  *
     56  * 1) Any source code used, modified or distributed must reproduce and retain
     57  *    this copyright notice and list of conditions as they appear in the
     58  *    source file.
     59  *
     60  * 2) No right is granted to use any trade name, trademark, or logo of Digital
     61  *    Equipment Corporation. Neither the "Digital Equipment Corporation"
     62  *    name nor any trademark or logo of Digital Equipment Corporation may be
     63  *    used to endorse or promote products derived from this software without
     64  *    the prior written permission of Digital Equipment Corporation.
     65  *
     66  * 3) This software is provided "AS-IS" and any express or implied warranties,
     67  *    including but not limited to, any implied warranties of merchantability,
     68  *    fitness for a particular purpose, or non-infringement are disclaimed.
     69  *    In no event shall DIGITAL be liable for any damages whatsoever, and in
     70  *    particular, DIGITAL shall not be liable for special, indirect,
     71  *    consequential, or incidental damages or damages for lost profits, loss
     72  *    of revenue or loss of use, whether such damages arise in contract,
     73  *    negligence, tort, under statute, in equity, at law or otherwise, even
     74  *    if advised of the possibility of such damage.
     75  *
     76  */
     77 
     78 /* $XConsortium: xf86_OSlib.h /main/22 1996/10/27 11:06:31 kaleb $ */
     79 /* $XdotOrg: xserver/xorg/hw/xfree86/os-support/xf86_OSlib.h,v 1.13 2005/11/08 06:33:29 jkj Exp $ */
     80 
     81 /*
     82  * This is private, and should not be included by any drivers.  Drivers
     83  * may include xf86_OSproc.h to get prototypes for public interfaces.
     84  */
     85 
     86 #ifndef _XF86_OSLIB_H
     87 #define _XF86_OSLIB_H
     88 
     89 #include <X11/Xos.h>
     90 #include <X11/Xfuncproto.h>
     91 
     92 /*
     93  * Define some things from the "ANSI" C wrappers that are needed in the
     94  * the core server.
     95  */
     96 #ifndef HAVE_WRAPPER_DECLS
     97 #define HAVE_WRAPPER_DECLS
     98 #undef usleep
     99 #define usleep(a) xf86usleep(a)
    100 extern void xf86usleep(unsigned long);
    101 extern int xf86getpagesize(void);
    102 extern int xf86GetErrno(void);
    103 typedef unsigned long xf86size_t;
    104 typedef signed long xf86ssize_t;
    105 #endif
    106 
    107 #include <stdio.h>
    108 #include <ctype.h>
    109 #include <stddef.h>
    110 
    111 /**************************************************************************/
    112 /* SYSV386 (SVR3, SVR4), including Solaris                                */
    113 /**************************************************************************/
    114 #if (defined(SYSV) || defined(SVR4)) && \
    115     !defined(DGUX) && !defined(sgi) && \
    116     (defined(sun) || defined(__i386__))
    117 # ifdef SCO325
    118 #  ifndef _SVID3
    119 #   define _SVID3
    120 #  endif
    121 #  ifndef _NO_STATIC
    122 #   define _NO_STATIC
    123 #  endif
    124 # endif
    125 # include <sys/ioctl.h>
    126 # include <signal.h>
    127 # include <termio.h>
    128 # include <sys/stat.h>
    129 # include <sys/types.h>
    130 # if defined(__SCO__) || defined(ISC)
    131 # include <sys/param.h>
    132 # endif
    133 
    134 # ifdef ISC
    135 #  define TIOCMSET (TIOC|26)	/* set all modem bits */
    136 #  define TIOCMBIS (TIOC|27)	/* bis modem bits */
    137 #  define TIOCMBIC (TIOC|28)	/* bic modem bits */
    138 #  define TIOCMGET (TIOC|29)	/* get all modem bits */
    139 # endif
    140 
    141 # include <errno.h>
    142 
    143 # if defined(PowerMAX_OS)
    144 #  define HAS_USL_VTS
    145 #  include <sys/immu.h>
    146 #  include <sys/sysmacros.h>
    147 # elif defined(_NEED_SYSI86)
    148 #  include <sys/immu.h>
    149 #  if !(defined (sun) && defined (SVR4))
    150 #    include <sys/region.h>
    151 #  endif
    152 #  include <sys/proc.h>
    153 #  include <sys/tss.h>
    154 #  include <sys/sysi86.h>
    155 #  if defined(SVR4) && !defined(sun)
    156 #   include <sys/seg.h>
    157 #  endif /* SVR4 && !sun */
    158 /* V86SC_IOPL was moved to <sys/sysi86.h> on Solaris 7 and later */
    159 #  if defined(sun) && defined (SVR4)		/* Solaris? */
    160 #   if defined(__i386__) || defined(__x86)		/* on x86 or x64? */
    161 #    if !defined(V86SC_IOPL)			/* Solaris 7 or later? */
    162 #     include <sys/v86.h>			/* Nope */
    163 #    endif
    164 #   endif /* V86SC_IOPL */
    165 #  else
    166 #   include <sys/v86.h>					/* Not solaris */
    167 #  endif /* sun && i386 && SVR4 */
    168 #  if defined(sun) && (defined (__i386__) || defined(__x86))  && defined (SVR4)
    169 #    include <sys/psw.h>
    170 #  endif
    171 # endif /* _NEED_SYSI86 */
    172 
    173 # if defined(HAS_SVR3_MMAPDRV)
    174 #  include <sys/sysmacros.h>
    175 #  if !defined(_NEED_SYSI86)
    176 #   include <sys/immu.h>
    177 #   include <sys/region.h>
    178 #  endif
    179 #  include <sys/mmap.h>		/* MMAP driver header */
    180 # endif
    181 
    182 # if !defined(sun) || (!defined(sparc) && !defined(__SOL8__))
    183 #  define HAS_USL_VTS
    184 # endif
    185 # if !defined(sun)
    186 #  include <sys/emap.h>
    187 # endif
    188 # if defined(SCO325)
    189 #  include <sys/vtkd.h>
    190 #  include <sys/console.h>
    191 #  include <sys/scankbd.h>
    192 #  include <sys/vid.h>
    193 #  define LED_CAP CLKED
    194 #  define LED_NUM NLKED
    195 #  define LED_SCR SLKED
    196 # elif defined(HAS_USL_VTS)
    197 #  include <sys/at_ansi.h>
    198 #  include <sys/kd.h>
    199 #  include <sys/vt.h>
    200 # elif defined(sun)
    201 #  include <sys/fbio.h>
    202 #  include <sys/kbd.h>
    203 #  include <sys/kbio.h>
    204 
    205 /* undefine symbols from <sys/kbd.h> we don't need that conflict with enum
    206    definitions in parser/xf86tokens.h */
    207 #  undef STRING
    208 #  undef LEFTALT
    209 #  undef RIGHTALT
    210 
    211 #  define LED_CAP LED_CAPS_LOCK
    212 #  define LED_NUM LED_NUM_LOCK
    213 #  define LED_SCR LED_SCROLL_LOCK
    214 #  define LED_COMP LED_COMPOSE
    215 # endif /* sun */
    216 
    217 # if !defined(VT_ACKACQ)
    218 #  define VT_ACKACQ 2
    219 # endif /* !VT_ACKACQ */
    220 
    221 # if defined(__SCO__)
    222 #  include <sys/sysmacros.h>
    223 #  define POSIX_TTY
    224 # endif /* __SCO__ */
    225 
    226 # if defined(SVR4) || defined(SCO325)
    227 #  include <sys/mman.h>
    228 #  if !(defined(sun) && defined (SVR4))
    229 #    define DEV_MEM "/dev/pmem"
    230 #  elif defined(PowerMAX_OS)
    231 #    define DEV_MEM "/dev/iomem"
    232 #  endif
    233 #  ifdef SCO325
    234 #   undef DEV_MEM
    235 #   define DEV_MEM "/dev/mem"
    236 #  endif
    237 #  define CLEARDTR_SUPPORT
    238 #  define POSIX_TTY
    239 # endif /* SVR4 */
    240 
    241 # ifdef ISC
    242 #  include <termios.h>
    243 #  define POSIX_TTY
    244 # endif
    245 
    246 # if defined(sun) && defined (__i386__) && defined (SVR4) && !defined(__SOL8__)
    247 #  define USE_VT_SYSREQ
    248 #  define VT_SYSREQ_DEFAULT TRUE
    249 # endif
    250 
    251 # if defined(ATT) && !defined(__i386__)
    252 #  define i386 /* not defined in ANSI C mode */
    253 # endif /* ATT && !i386 */
    254 
    255 # if (defined(ATT) || defined(SVR4)) && !defined(sun)
    256 #  ifndef __UNIXWARE__
    257 #   ifndef XQUEUE
    258 #    define XQUEUE
    259 #   endif
    260 #  endif
    261 #  include <sys/xque.h>
    262 # endif /* ATT || SVR4 */
    263 
    264 # ifdef SYSV
    265 #  if !defined(ISC) || defined(ISC202) || defined(ISC22)
    266 #   define NEED_STRERROR
    267 #  endif
    268 # endif
    269 
    270 #endif /* (SYSV || SVR4) && !DGUX */
    271 
    272 
    273 
    274 /**************************************************************************/
    275 /* DG/ux R4.20MU03 Intel AViion Machines                                  */
    276 /**************************************************************************/
    277 #if defined(DGUX) && defined(SVR4)
    278 #include <sys/ioctl.h>
    279 #include <signal.h>
    280 #include <ctype.h>
    281 #include <termios.h>      /* Use termios for BSD Flavor ttys */
    282 #include <sys/termios.h>
    283 #include <sys/stat.h>
    284 #include <sys/types.h>
    285 #include <sys/param.h>
    286 #include <errno.h>
    287 #include <sys/sysi86.h>
    288 #include <unistd.h>
    289 #include <sys/proc.h>
    290 #include <sys/map.h>
    291 #include <sys/sysmacros.h>
    292 #include <sys/mman.h>       /* Memory handling */
    293 #include <sys/kd.h>       /* definitios for KDENABIO KDDISABIO needed for IOPL s */
    294 #include <sys/kbd.h>
    295 #include <fcntl.h>
    296 #include <time.h>
    297 #include <sys/stream.h>
    298 #include <sys/ptms.h>
    299 
    300 #include <sys/socket.h>
    301 #include <sys/utsname.h>
    302 #include <sys/stropts.h>
    303 #include <sys/sockio.h>
    304 
    305 
    306 #define POSIX_TTY
    307 
    308 #undef HAS_USL_VTS
    309 #undef USE_VT_SYSREQ
    310 #undef VT_ACKACQ
    311 
    312 #define LED_CAP KBD_LED_CAPS_LOCK
    313 #define LED_NUM KBD_LED_NUM_LOCK
    314 #define LED_SCR KBD_LED_SCROLL_LOCK
    315 
    316 #define KDGKBTYPE KBD_GET_LANGUAGE
    317 
    318 
    319 /* General keyboard types */
    320 # define KB_84          2
    321 # define KB_101         1  /* Because ioctl(dgkeybdFd,KBD_GET_LANGUAGE,&type) gives 1=US keyboard */
    322 # define KB_OTHER       3
    323 
    324 #define KDSETLED KBD_SET_LED
    325 #define KDGETLED KBD_GET_STATE
    326 #undef KDMKTONE
    327 #define KDMKTONE KBD_TONE_HIGH
    328 
    329 
    330 #undef DEV_MEM
    331 #define DEV_MEM "/dev/mem"
    332 #define CLEARDTR_SUPPORT
    333 
    334 #undef  VT_SYSREQ_DEFAULT
    335 #define VT_SYSREQ_DEFAULT FALSE        /* Make sure that we dont define any VTs since DG/ux has none */
    336 
    337 #endif /* DGUX && SVR4 */
    338 
    339 /**************************************************************************/
    340 /* Linux or Glibc-based system                                            */
    341 /**************************************************************************/
    342 #if defined(__linux__) || defined(__GLIBC__)
    343 # include <sys/ioctl.h>
    344 # include <signal.h>
    345 # include <stdlib.h>
    346 # include <sys/types.h>
    347 # include <assert.h>
    348 
    349 #ifdef __GNU__ /* GNU/Hurd */
    350 # define USE_OSMOUSE
    351 #endif
    352 
    353 # ifdef __linux__
    354 #  include <termio.h>
    355 # else /* __GLIBC__ */
    356 #  include <termios.h>
    357 # endif
    358 # ifdef __sparc__
    359 #  include <sys/param.h>
    360 # endif
    361 
    362 # include <errno.h>
    363 
    364 # include <sys/stat.h>
    365 
    366 # include <sys/mman.h>
    367 # ifdef __linux__
    368 #  define HAS_USL_VTS
    369 #  include <sys/kd.h>
    370 #  include <sys/vt.h>
    371 #  define LDGMAP GIO_SCRNMAP
    372 #  define LDSMAP PIO_SCRNMAP
    373 #  define LDNMAP LDSMAP
    374 #  define CLEARDTR_SUPPORT
    375 #  define USE_VT_SYSREQ
    376 # endif
    377 
    378 # define POSIX_TTY
    379 
    380 #endif /* __linux__ || __GLIBC__ */
    381 
    382 /**************************************************************************/
    383 /* LynxOS AT                                                              */
    384 /**************************************************************************/
    385 #if defined(Lynx)
    386 
    387 # include <termio.h>
    388 # include <sys/ioctl.h>
    389 # include <param.h>
    390 # include <signal.h>
    391 # include <kd.h>
    392 # include <vt.h>
    393 # include <sys/stat.h>
    394 
    395 # include <errno.h>
    396 extern int errno;
    397 
    398 /* smem_create et.al. to access physical memory */
    399 # include <smem.h>
    400 
    401 /* keyboard types */
    402 # define KB_84		1
    403 # define KB_101 	2
    404 # define KB_OTHER	3
    405 
    406 /* atc drivers ignores argument to VT_RELDISP ioctl */
    407 # define VT_ACKACQ	2
    408 
    409 # include <termios.h>
    410 # define POSIX_TTY
    411 # define CLEARDTR_SUPPORT
    412 
    413 /* LynxOS 2.5.1 has these */
    414 # ifdef LED_NUMLOCK
    415 #  define LED_CAP	LED_CAPSLOCK
    416 #  define LED_NUM	LED_NUMLOCK
    417 #  define LED_SCR	LED_SCROLLOCK
    418 # endif
    419 
    420 #endif /* Lynx */
    421 
    422 /**************************************************************************/
    423 /* 386BSD and derivatives,  BSD/386                                       */
    424 /**************************************************************************/
    425 
    426 #if defined(__386BSD__) && (defined(__FreeBSD__) || defined(__NetBSD__))
    427 # undef __386BSD__
    428 #endif
    429 
    430 #ifdef CSRG_BASED
    431 # include <sys/ioctl.h>
    432 # include <signal.h>
    433 
    434 # include <termios.h>
    435 # define termio termios
    436 # define POSIX_TTY
    437 
    438 # include <errno.h>
    439 
    440 # include <sys/types.h>
    441 # include <sys/mman.h>
    442 # include <sys/stat.h>
    443 
    444 # if defined(__bsdi__)
    445 #  include <sys/param.h>
    446 # if (_BSDI_VERSION < 199510)
    447 #  include <i386/isa/vgaioctl.h>
    448 # endif
    449 # endif /* __bsdi__ */
    450 
    451 #endif /* CSRG_BASED */
    452 
    453 /**************************************************************************/
    454 /* Kernel of *BSD                                                         */
    455 /**************************************************************************/
    456 #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || \
    457  defined(__NetBSD__) || defined(__OpenBSD__) || defined(__bsdi__)
    458 
    459 # include <sys/param.h>
    460 # if defined(__FreeBSD_version) && !defined(__FreeBSD_kernel_version)
    461 #  define __FreeBSD_kernel_version __FreeBSD_version
    462 # endif
    463 
    464 # if !defined(LINKKIT)
    465   /* Don't need this stuff for the Link Kit */
    466 #  if defined(__bsdi__)
    467 #   include <i386/isa/pcconsioctl.h>
    468 #   define CONSOLE_X_MODE_ON PCCONIOCRAW
    469 #   define CONSOLE_X_MODE_OFF PCCONIOCCOOK
    470 #   define CONSOLE_X_BELL PCCONIOCBEEP
    471 #  else /* __bsdi__ */
    472 #   if defined(__OpenBSD__)
    473 #     ifdef PCCONS_SUPPORT
    474 #       include <machine/pccons.h>
    475 #       undef CONSOLE_X_MODE_ON
    476 #       undef CONSOLE_X_MODE_OFF
    477 #       undef CONSOLE_X_BELL
    478 #     endif
    479 #   endif
    480 #   ifdef SYSCONS_SUPPORT
    481 #    define COMPAT_SYSCONS
    482 #    if defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
    483 #     include <machine/console.h>
    484 #    else
    485 #     if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
    486 #        if (__FreeBSD_kernel_version >= 410000)
    487 #          include <sys/consio.h>
    488 #          include <sys/kbio.h>
    489 #        else
    490 #          include <machine/console.h>
    491 #        endif /* FreeBSD 4.1 RELEASE or lator */
    492 #     else
    493 #      include <sys/console.h>
    494 #     endif
    495 #    endif
    496 #   endif /* SYSCONS_SUPPORT */
    497 #   if defined(PCVT_SUPPORT)
    498 #    if !defined(SYSCONS_SUPPORT)
    499       /* no syscons, so include pcvt specific header file */
    500 #     if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
    501 #      include <machine/pcvt_ioctl.h>
    502 #     else
    503 #      if defined(__NetBSD__) || defined(__OpenBSD__)
    504 #       if !defined(WSCONS_SUPPORT)
    505 #        include <machine/pcvt_ioctl.h>
    506 #       endif /* WSCONS_SUPPORT */
    507 #      else
    508 #       include <sys/pcvt_ioctl.h>
    509 #      endif /* __NetBSD__ */
    510 #     endif /* __FreeBSD_kernel__ || __OpenBSD__ */
    511 #    else /* pcvt and syscons: hard-code the ID magic */
    512 #     define VGAPCVTID _IOWR('V',113, struct pcvtid)
    513       struct pcvtid {
    514 	char name[16];
    515 	int rmajor, rminor;
    516       };
    517 #    endif /* PCVT_SUPPORT && SYSCONS_SUPPORT */
    518 #   endif /* PCVT_SUPPORT */
    519 #   ifdef WSCONS_SUPPORT
    520 #    include <dev/wscons/wsconsio.h>
    521 #    include <dev/wscons/wsdisplay_usl_io.h>
    522 #   endif /* WSCONS_SUPPORT */
    523 #   if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
    524 #    if (__FreeBSD_kernel_version >= 500013)
    525 #     include <sys/mouse.h>
    526 #    else
    527 #     undef MOUSE_GETINFO
    528 #     include <machine/mouse.h>
    529 #    endif
    530 #   endif
    531     /* Include these definitions in case ioctl_pc.h didn't get included */
    532 #   ifndef CONSOLE_X_MODE_ON
    533 #    define CONSOLE_X_MODE_ON _IO('t',121)
    534 #   endif
    535 #   ifndef CONSOLE_X_MODE_OFF
    536 #    define CONSOLE_X_MODE_OFF _IO('t',122)
    537 #   endif
    538 #   ifndef CONSOLE_X_BELL
    539 #    define CONSOLE_X_BELL _IOW('t',123,int[2])
    540 #   endif
    541 #   ifndef CONSOLE_X_TV_ON
    542 #    define CONSOLE_X_TV_ON _IOW('t',155,int)
    543 #    define XMODE_RGB   0
    544 #    define XMODE_NTSC  1
    545 #    define XMODE_PAL   2
    546 #    define XMODE_SECAM 3
    547 #   endif
    548 #   ifndef CONSOLE_X_TV_OFF
    549 #    define CONSOLE_X_TV_OFF _IO('t',156)
    550 #   endif
    551 #ifndef CONSOLE_GET_LINEAR_INFO
    552 #    define CONSOLE_GET_LINEAR_INFO         _IOR('t',157,struct map_info)
    553 #endif
    554 #ifndef CONSOLE_GET_IO_INFO
    555 #    define CONSOLE_GET_IO_INFO             _IOR('t',158,struct map_info)
    556 #endif
    557 #ifndef CONSOLE_GET_MEM_INFO
    558 #    define CONSOLE_GET_MEM_INFO            _IOR('t',159,struct map_info)
    559 #endif
    560 #  endif /* __bsdi__ */
    561 # endif /* !LINKKIT */
    562 
    563 #if defined(USE_I386_IOPL) || defined(USE_AMD64_IOPL)
    564 #include <machine/sysarch.h>
    565 #endif
    566 
    567 # define CLEARDTR_SUPPORT
    568 
    569 # if defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT) || defined(WSCONS_SUPPORT)
    570 #  define USE_VT_SYSREQ
    571 # endif
    572 
    573 #endif
    574 /* __FreeBSD_kernel__ || __NetBSD__ || __OpenBSD__ || __bsdi__ */
    575 
    576 /**************************************************************************/
    577 /* OS/2                                                                   */
    578 /**************************************************************************/
    579 /* currently OS/2 with a modified EMX/GCC compiler only */
    580 #if defined(__UNIXOS2__)
    581 # include <signal.h>
    582 # include <errno.h>
    583 # include <sys/stat.h>
    584 
    585 /* I would have liked to have this included here always, but
    586  * it causes clashes for BYTE and BOOL with Xmd.h, which is too dangerous.
    587  * So I'll include it in place where I know it does no harm.
    588  */
    589 #if defined(I_NEED_OS2_H)
    590 # undef BOOL
    591 # undef BYTE
    592 # include <os2.h>
    593 #endif
    594 
    595   /* keyboard types */
    596 # define KB_84                   1
    597 # define KB_101                  2
    598 /* could detect more keyboards */
    599 # define KB_OTHER                3
    600 
    601   /* LEDs */
    602 #  define LED_CAP 0x40
    603 #  define LED_NUM 0x20
    604 #  define LED_SCR 0x10
    605 
    606   /* mouse driver */
    607 # define OSMOUSE_ONLY
    608 # define MOUSE_PROTOCOL_IN_KERNEL
    609 
    610 extern char* __XOS2RedirRoot(char*);
    611 
    612 #endif
    613 
    614 /**************************************************************************/
    615 /* QNX4                                                                   */
    616 /**************************************************************************/
    617 /* This is the QNX code for Watcom 10.6 and QNX 4.x */
    618 #if defined(QNX4)
    619 #include <signal.h>
    620 #include <errno.h>
    621 #include <sys/stat.h>
    622 #include <termios.h>
    623 #include <ioctl.h>
    624 #include <sys/param.h>
    625 
    626 /* Warning: by default, the fd_set size is 32 in QNX!  */
    627 #define FD_SETSIZE 256
    628 #include <sys/select.h>
    629 
    630   /* keyboard types */
    631 # define KB_84                   1
    632 # define KB_101                  2
    633 # define KB_OTHER                3
    634 
    635   /* LEDs */
    636 #  define LED_CAP 0x04
    637 #  define LED_NUM 0x02
    638 #  define LED_SCR 0x01
    639 
    640 # define POSIX_TTY
    641 # define OSMOUSE_ONLY
    642 # define MOUSE_PROTOCOL_IN_KERNEL
    643 
    644 #define TIOCM_DTR       0x0001            /* data terminal ready */
    645 #define TIOCM_RTS       0x0002            /* request to send */
    646 #define TIOCM_CTS       0x1000            /* clear to send */
    647 #define TIOCM_DSR       0x2000            /* data set ready */
    648 #define TIOCM_RI        0x4000            /* ring */
    649 #define TIOCM_RNG       TIOCM_RI
    650 #define TIOCM_CD        0x8000            /* carrier detect */
    651 #define TIOCM_CAR       TIOCM_CD
    652 #define TIOCM_LE        0x0100            /* line enable */
    653 #define TIOCM_ST        0x0200            /* secondary transmit */
    654 #define TIOCM_SR        0x0400            /* secondary receive */
    655 
    656 #endif
    657 
    658 /**************************************************************************/
    659 /* QNX/Neutrino                                                           */
    660 /**************************************************************************/
    661 /* This is the Neutrino code for for NTO2.0 and GCC */
    662 #if defined(__QNXNTO__)
    663 #include <signal.h>
    664 #include <errno.h>
    665 #include <sys/stat.h>
    666 #include <termios.h>
    667 #include <ioctl.h>
    668 #include <sys/param.h>
    669 
    670 /* Warning: by default, the fd_set size is 32 in NTO!  */
    671 #define FD_SETSIZE 256
    672 #include <sys/select.h>
    673 
    674   /* keyboard types */
    675 # define KB_84                   1
    676 # define KB_101                  2
    677 # define KB_OTHER                3
    678 
    679 # define POSIX_TTY
    680 
    681 #endif
    682 
    683 /**************************************************************************/
    684 /* IRIX                                                                   */
    685 /**************************************************************************/
    686 #if defined(sgi)
    687 
    688 #include <errno.h>
    689 #include <sys/types.h>
    690 #include <sys/stat.h>
    691 
    692 #endif
    693 
    694 /**************************************************************************/
    695 /* Generic                                                                */
    696 /**************************************************************************/
    697 
    698 #include <sys/wait.h>	/* May need to adjust this for other OSs */
    699 
    700 /*
    701  * Hack originally for ISC 2.2 POSIX headers, but may apply elsewhere,
    702  * and it's safe, so just do it.
    703  */
    704 #if !defined(O_NDELAY) && defined(O_NONBLOCK)
    705 # define O_NDELAY O_NONBLOCK
    706 #endif /* !O_NDELAY && O_NONBLOCK */
    707 
    708 #if !defined(MAXHOSTNAMELEN)
    709 # define MAXHOSTNAMELEN 32
    710 #endif /* !MAXHOSTNAMELEN */
    711 
    712 #if !defined(X_NOT_POSIX)
    713 # if defined(_POSIX_SOURCE)
    714 #  include <limits.h>
    715 # else
    716 #  define _POSIX_SOURCE
    717 #  include <limits.h>
    718 #  undef _POSIX_SOURCE
    719 # endif /* _POSIX_SOURCE */
    720 #endif /* !X_NOT_POSIX */
    721 #if !defined(PATH_MAX)
    722 # if defined(MAXPATHLEN)
    723 #  define PATH_MAX MAXPATHLEN
    724 # else
    725 #  define PATH_MAX 1024
    726 # endif /* MAXPATHLEN */
    727 #endif /* !PATH_MAX */
    728 
    729 #ifdef NEED_STRERROR
    730 # ifndef strerror
    731 extern char *sys_errlist[];
    732 extern int sys_nerr;
    733 #  define strerror(n) \
    734      ((n) >= 0 && (n) < sys_nerr) ? sys_errlist[n] : "unknown error"
    735 # endif /* !strerror */
    736 #endif /* NEED_STRERROR */
    737 
    738 #if defined(ISC) || defined(Lynx)
    739 #define rint(x) RInt(x)
    740 double RInt(
    741 	double x
    742 );
    743 #endif
    744 
    745 #ifndef DEV_MEM
    746 #define DEV_MEM "/dev/mem"
    747 #endif
    748 
    749 #ifndef VT_SYSREQ_DEFAULT
    750 #define VT_SYSREQ_DEFAULT FALSE
    751 #endif
    752 
    753 #ifdef OSMOUSE_ONLY
    754 # ifndef MOUSE_PROTOCOL_IN_KERNEL
    755 #  define MOUSE_PROTOCOL_IN_KERNEL
    756 # endif
    757 #endif
    758 
    759 #define SYSCALL(call) while(((call) == -1) && (errno == EINTR))
    760 
    761 #define XF86_OS_PRIVS
    762 #include "xf86_OSproc.h"
    763 
    764 #ifndef NO_COMPILER_H
    765 #include "compiler.h"
    766 #endif
    767 
    768 #endif /* _XF86_OSLIB_H */
    769