45e9809aff7304721fddb95654901b32195c9c7avboxsync/*
45e9809aff7304721fddb95654901b32195c9c7avboxsync * Copyright 1990, 1991 by Thomas Roell, Dinkelscherben, Germany
45e9809aff7304721fddb95654901b32195c9c7avboxsync * Copyright 1992 by David Dawes <dawes@XFree86.org>
45e9809aff7304721fddb95654901b32195c9c7avboxsync * Copyright 1992 by Jim Tsillas <jtsilla@damon.ccs.northeastern.edu>
45e9809aff7304721fddb95654901b32195c9c7avboxsync * Copyright 1992 by Rich Murphey <Rich@Rice.edu>
45e9809aff7304721fddb95654901b32195c9c7avboxsync * Copyright 1992 by Robert Baron <Robert.Baron@ernst.mach.cs.cmu.edu>
45e9809aff7304721fddb95654901b32195c9c7avboxsync * Copyright 1992 by Orest Zborowski <obz@eskimo.com>
45e9809aff7304721fddb95654901b32195c9c7avboxsync * Copyright 1993 by Vrije Universiteit, The Netherlands
45e9809aff7304721fddb95654901b32195c9c7avboxsync * Copyright 1993 by David Wexelblat <dwex@XFree86.org>
45e9809aff7304721fddb95654901b32195c9c7avboxsync * Copyright 1994, 1996 by Holger Veit <Holger.Veit@gmd.de>
45e9809aff7304721fddb95654901b32195c9c7avboxsync * Copyright 1997 by Takis Psarogiannakopoulos <takis@dpmms.cam.ac.uk>
45e9809aff7304721fddb95654901b32195c9c7avboxsync * Copyright 1994-2003 by The XFree86 Project, Inc
45e9809aff7304721fddb95654901b32195c9c7avboxsync *
45e9809aff7304721fddb95654901b32195c9c7avboxsync * Permission to use, copy, modify, distribute, and sell this software and its
45e9809aff7304721fddb95654901b32195c9c7avboxsync * documentation for any purpose is hereby granted without fee, provided that
45e9809aff7304721fddb95654901b32195c9c7avboxsync * the above copyright notice appear in all copies and that both that
45e9809aff7304721fddb95654901b32195c9c7avboxsync * copyright notice and this permission notice appear in supporting
45e9809aff7304721fddb95654901b32195c9c7avboxsync * documentation, and that the names of the above listed copyright holders
45e9809aff7304721fddb95654901b32195c9c7avboxsync * not be used in advertising or publicity pertaining to distribution of
45e9809aff7304721fddb95654901b32195c9c7avboxsync * the software without specific, written prior permission. The above listed
45e9809aff7304721fddb95654901b32195c9c7avboxsync * copyright holders make no representations about the suitability of this
45e9809aff7304721fddb95654901b32195c9c7avboxsync * software for any purpose. It is provided "as is" without express or
45e9809aff7304721fddb95654901b32195c9c7avboxsync * implied warranty.
45e9809aff7304721fddb95654901b32195c9c7avboxsync *
45e9809aff7304721fddb95654901b32195c9c7avboxsync * THE ABOVE LISTED COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD
45e9809aff7304721fddb95654901b32195c9c7avboxsync * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
45e9809aff7304721fddb95654901b32195c9c7avboxsync * AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDERS BE
45e9809aff7304721fddb95654901b32195c9c7avboxsync * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
45e9809aff7304721fddb95654901b32195c9c7avboxsync * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
45e9809aff7304721fddb95654901b32195c9c7avboxsync * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
45e9809aff7304721fddb95654901b32195c9c7avboxsync * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
45e9809aff7304721fddb95654901b32195c9c7avboxsync *
45e9809aff7304721fddb95654901b32195c9c7avboxsync */
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync/*
45e9809aff7304721fddb95654901b32195c9c7avboxsync * The ARM32 code here carries the following copyright:
45e9809aff7304721fddb95654901b32195c9c7avboxsync *
45e9809aff7304721fddb95654901b32195c9c7avboxsync * Copyright 1997
45e9809aff7304721fddb95654901b32195c9c7avboxsync * Digital Equipment Corporation. All rights reserved.
45e9809aff7304721fddb95654901b32195c9c7avboxsync * This software is furnished under license and may be used and copied only in
45e9809aff7304721fddb95654901b32195c9c7avboxsync * accordance with the following terms and conditions. Subject to these
45e9809aff7304721fddb95654901b32195c9c7avboxsync * conditions, you may download, copy, install, use, modify and distribute
45e9809aff7304721fddb95654901b32195c9c7avboxsync * this software in source and/or binary form. No title or ownership is
45e9809aff7304721fddb95654901b32195c9c7avboxsync * transferred hereby.
45e9809aff7304721fddb95654901b32195c9c7avboxsync *
45e9809aff7304721fddb95654901b32195c9c7avboxsync * 1) Any source code used, modified or distributed must reproduce and retain
45e9809aff7304721fddb95654901b32195c9c7avboxsync * this copyright notice and list of conditions as they appear in the
45e9809aff7304721fddb95654901b32195c9c7avboxsync * source file.
45e9809aff7304721fddb95654901b32195c9c7avboxsync *
45e9809aff7304721fddb95654901b32195c9c7avboxsync * 2) No right is granted to use any trade name, trademark, or logo of Digital
45e9809aff7304721fddb95654901b32195c9c7avboxsync * Equipment Corporation. Neither the "Digital Equipment Corporation"
45e9809aff7304721fddb95654901b32195c9c7avboxsync * name nor any trademark or logo of Digital Equipment Corporation may be
45e9809aff7304721fddb95654901b32195c9c7avboxsync * used to endorse or promote products derived from this software without
45e9809aff7304721fddb95654901b32195c9c7avboxsync * the prior written permission of Digital Equipment Corporation.
45e9809aff7304721fddb95654901b32195c9c7avboxsync *
45e9809aff7304721fddb95654901b32195c9c7avboxsync * 3) This software is provided "AS-IS" and any express or implied warranties,
45e9809aff7304721fddb95654901b32195c9c7avboxsync * including but not limited to, any implied warranties of merchantability,
45e9809aff7304721fddb95654901b32195c9c7avboxsync * fitness for a particular purpose, or non-infringement are disclaimed.
45e9809aff7304721fddb95654901b32195c9c7avboxsync * In no event shall DIGITAL be liable for any damages whatsoever, and in
45e9809aff7304721fddb95654901b32195c9c7avboxsync * particular, DIGITAL shall not be liable for special, indirect,
45e9809aff7304721fddb95654901b32195c9c7avboxsync * consequential, or incidental damages or damages for lost profits, loss
45e9809aff7304721fddb95654901b32195c9c7avboxsync * of revenue or loss of use, whether such damages arise in contract,
45e9809aff7304721fddb95654901b32195c9c7avboxsync * negligence, tort, under statute, in equity, at law or otherwise, even
45e9809aff7304721fddb95654901b32195c9c7avboxsync * if advised of the possibility of such damage.
45e9809aff7304721fddb95654901b32195c9c7avboxsync *
45e9809aff7304721fddb95654901b32195c9c7avboxsync */
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync/*
45e9809aff7304721fddb95654901b32195c9c7avboxsync * This is private, and should not be included by any drivers. Drivers
45e9809aff7304721fddb95654901b32195c9c7avboxsync * may include xf86_OSproc.h to get prototypes for public interfaces.
45e9809aff7304721fddb95654901b32195c9c7avboxsync */
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync#ifndef _XF86_OSLIB_H
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define _XF86_OSLIB_H
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync#include <X11/Xos.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync#include <X11/Xfuncproto.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync#include <stdio.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync#include <ctype.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync#include <stddef.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync/**************************************************************************/
45e9809aff7304721fddb95654901b32195c9c7avboxsync/* SYSV386 (SVR3, SVR4), including Solaris */
45e9809aff7304721fddb95654901b32195c9c7avboxsync/**************************************************************************/
45e9809aff7304721fddb95654901b32195c9c7avboxsync#if (defined(SYSV) || defined(SVR4)) && \
45e9809aff7304721fddb95654901b32195c9c7avboxsync (defined(sun) || defined(__i386__))
45e9809aff7304721fddb95654901b32195c9c7avboxsync# ifdef SCO325
45e9809aff7304721fddb95654901b32195c9c7avboxsync# ifndef _SVID3
45e9809aff7304721fddb95654901b32195c9c7avboxsync# define _SVID3
45e9809aff7304721fddb95654901b32195c9c7avboxsync# endif
45e9809aff7304721fddb95654901b32195c9c7avboxsync# ifndef _NO_STATIC
45e9809aff7304721fddb95654901b32195c9c7avboxsync# define _NO_STATIC
45e9809aff7304721fddb95654901b32195c9c7avboxsync# endif
45e9809aff7304721fddb95654901b32195c9c7avboxsync# endif
45e9809aff7304721fddb95654901b32195c9c7avboxsync# include <sys/ioctl.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync# include <signal.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync# include <termio.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync# include <sys/stat.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync# include <sys/types.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync# if defined(__SCO__)
45e9809aff7304721fddb95654901b32195c9c7avboxsync# include <sys/param.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync# endif
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync# include <errno.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync# if defined(_NEED_SYSI86)
45e9809aff7304721fddb95654901b32195c9c7avboxsync# if !(defined (sun) && defined (SVR4))
45e9809aff7304721fddb95654901b32195c9c7avboxsync# include <sys/immu.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync# include <sys/region.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync# endif
45e9809aff7304721fddb95654901b32195c9c7avboxsync# include <sys/proc.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync# include <sys/tss.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync# include <sys/sysi86.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync# if defined(SVR4) && !defined(sun)
45e9809aff7304721fddb95654901b32195c9c7avboxsync# include <sys/seg.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync# endif /* SVR4 && !sun */
45e9809aff7304721fddb95654901b32195c9c7avboxsync/* V86SC_IOPL was moved to <sys/sysi86.h> on Solaris 7 and later */
45e9809aff7304721fddb95654901b32195c9c7avboxsync# if !defined(V86SC_IOPL) /* Solaris 7 or later? */
45e9809aff7304721fddb95654901b32195c9c7avboxsync# include <sys/v86.h> /* Nope */
45e9809aff7304721fddb95654901b32195c9c7avboxsync# endif
45e9809aff7304721fddb95654901b32195c9c7avboxsync# if defined(sun) && (defined (__i386__) || defined(__i386) || defined(__x86)) && defined (SVR4)
45e9809aff7304721fddb95654901b32195c9c7avboxsync# include <sys/psw.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync# endif
45e9809aff7304721fddb95654901b32195c9c7avboxsync# endif /* _NEED_SYSI86 */
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync# if defined(HAS_SVR3_MMAPDRV)
45e9809aff7304721fddb95654901b32195c9c7avboxsync# include <sys/sysmacros.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync# if !defined(_NEED_SYSI86)
45e9809aff7304721fddb95654901b32195c9c7avboxsync# include <sys/immu.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync# include <sys/region.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync# endif
45e9809aff7304721fddb95654901b32195c9c7avboxsync# include <sys/mmap.h> /* MMAP driver header */
45e9809aff7304721fddb95654901b32195c9c7avboxsync# endif
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync# if !defined(sun) || defined(HAVE_SYS_VT_H)
45e9809aff7304721fddb95654901b32195c9c7avboxsync# define HAS_USL_VTS
45e9809aff7304721fddb95654901b32195c9c7avboxsync# endif
45e9809aff7304721fddb95654901b32195c9c7avboxsync# if !defined(sun)
45e9809aff7304721fddb95654901b32195c9c7avboxsync# include <sys/emap.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync# endif
45e9809aff7304721fddb95654901b32195c9c7avboxsync# if defined(SCO325)
45e9809aff7304721fddb95654901b32195c9c7avboxsync# include <sys/vtkd.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync# include <sys/console.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync# include <sys/scankbd.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync# include <sys/vid.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync# define LED_CAP CLKED
45e9809aff7304721fddb95654901b32195c9c7avboxsync# define LED_NUM NLKED
45e9809aff7304721fddb95654901b32195c9c7avboxsync# define LED_SCR SLKED
45e9809aff7304721fddb95654901b32195c9c7avboxsync# elif defined(HAS_USL_VTS)
45e9809aff7304721fddb95654901b32195c9c7avboxsync# if !defined(sun)
45e9809aff7304721fddb95654901b32195c9c7avboxsync# include <sys/at_ansi.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync# endif
45e9809aff7304721fddb95654901b32195c9c7avboxsync# include <sys/kd.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync# include <sys/vt.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync# endif
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync# if defined(sun)
45e9809aff7304721fddb95654901b32195c9c7avboxsync# include <sys/fbio.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync# include <sys/kbd.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync# include <sys/kbio.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync/* undefine symbols from <sys/kbd.h> we don't need that conflict with enum
45e9809aff7304721fddb95654901b32195c9c7avboxsync definitions in parser/xf86tokens.h */
45e9809aff7304721fddb95654901b32195c9c7avboxsync# undef STRING
45e9809aff7304721fddb95654901b32195c9c7avboxsync# undef LEFTALT
45e9809aff7304721fddb95654901b32195c9c7avboxsync# undef RIGHTALT
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync# define LED_CAP LED_CAPS_LOCK
45e9809aff7304721fddb95654901b32195c9c7avboxsync# define LED_NUM LED_NUM_LOCK
45e9809aff7304721fddb95654901b32195c9c7avboxsync# define LED_SCR LED_SCROLL_LOCK
45e9809aff7304721fddb95654901b32195c9c7avboxsync# define LED_COMP LED_COMPOSE
45e9809aff7304721fddb95654901b32195c9c7avboxsync# endif /* sun */
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync# if !defined(VT_ACKACQ)
45e9809aff7304721fddb95654901b32195c9c7avboxsync# define VT_ACKACQ 2
45e9809aff7304721fddb95654901b32195c9c7avboxsync# endif /* !VT_ACKACQ */
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync# if defined(__SCO__)
45e9809aff7304721fddb95654901b32195c9c7avboxsync# include <sys/sysmacros.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync# define POSIX_TTY
45e9809aff7304721fddb95654901b32195c9c7avboxsync# endif /* __SCO__ */
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync# if defined(SVR4) || defined(SCO325)
45e9809aff7304721fddb95654901b32195c9c7avboxsync# include <sys/mman.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync# if !(defined(sun) && defined (SVR4))
45e9809aff7304721fddb95654901b32195c9c7avboxsync# define DEV_MEM "/dev/pmem"
45e9809aff7304721fddb95654901b32195c9c7avboxsync# endif
45e9809aff7304721fddb95654901b32195c9c7avboxsync# ifdef SCO325
45e9809aff7304721fddb95654901b32195c9c7avboxsync# undef DEV_MEM
45e9809aff7304721fddb95654901b32195c9c7avboxsync# define DEV_MEM "/dev/mem"
45e9809aff7304721fddb95654901b32195c9c7avboxsync# endif
45e9809aff7304721fddb95654901b32195c9c7avboxsync# define CLEARDTR_SUPPORT
45e9809aff7304721fddb95654901b32195c9c7avboxsync# define POSIX_TTY
45e9809aff7304721fddb95654901b32195c9c7avboxsync# endif /* SVR4 */
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync# if defined(sun) && defined(HAS_USL_VTS)
45e9809aff7304721fddb95654901b32195c9c7avboxsync# define USE_VT_SYSREQ
45e9809aff7304721fddb95654901b32195c9c7avboxsync# endif
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync#endif /* (SYSV || SVR4) */
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync/**************************************************************************/
45e9809aff7304721fddb95654901b32195c9c7avboxsync/* Linux or Glibc-based system */
45e9809aff7304721fddb95654901b32195c9c7avboxsync/**************************************************************************/
45e9809aff7304721fddb95654901b32195c9c7avboxsync#if defined(__linux__) || defined(__GLIBC__)
45e9809aff7304721fddb95654901b32195c9c7avboxsync# include <sys/ioctl.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync# include <signal.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync# include <stdlib.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync# include <sys/types.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync# include <assert.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync# ifdef __linux__
45e9809aff7304721fddb95654901b32195c9c7avboxsync# include <termio.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync# else /* __GLIBC__ */
45e9809aff7304721fddb95654901b32195c9c7avboxsync# include <termios.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync# endif
45e9809aff7304721fddb95654901b32195c9c7avboxsync# ifdef __sparc__
45e9809aff7304721fddb95654901b32195c9c7avboxsync# include <sys/param.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync# endif
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync# include <errno.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync# include <sys/stat.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync# include <sys/mman.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync# ifdef __linux__
45e9809aff7304721fddb95654901b32195c9c7avboxsync# define HAS_USL_VTS
45e9809aff7304721fddb95654901b32195c9c7avboxsync# include <sys/kd.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync# include <sys/vt.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync# define LDGMAP GIO_SCRNMAP
45e9809aff7304721fddb95654901b32195c9c7avboxsync# define LDSMAP PIO_SCRNMAP
45e9809aff7304721fddb95654901b32195c9c7avboxsync# define LDNMAP LDSMAP
45e9809aff7304721fddb95654901b32195c9c7avboxsync# define CLEARDTR_SUPPORT
45e9809aff7304721fddb95654901b32195c9c7avboxsync# define USE_VT_SYSREQ
45e9809aff7304721fddb95654901b32195c9c7avboxsync# endif
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync# define POSIX_TTY
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync#endif /* __linux__ || __GLIBC__ */
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync/**************************************************************************/
45e9809aff7304721fddb95654901b32195c9c7avboxsync/* 386BSD and derivatives, BSD/386 */
45e9809aff7304721fddb95654901b32195c9c7avboxsync/**************************************************************************/
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync#if defined(__386BSD__) && (defined(__FreeBSD__) || defined(__NetBSD__))
45e9809aff7304721fddb95654901b32195c9c7avboxsync# undef __386BSD__
45e9809aff7304721fddb95654901b32195c9c7avboxsync#endif
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync#ifdef CSRG_BASED
45e9809aff7304721fddb95654901b32195c9c7avboxsync# include <sys/ioctl.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync# include <signal.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync# include <termios.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync# define termio termios
45e9809aff7304721fddb95654901b32195c9c7avboxsync# define POSIX_TTY
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync# include <errno.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync# include <sys/types.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync# include <sys/mman.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync# include <sys/stat.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync# if defined(__bsdi__)
45e9809aff7304721fddb95654901b32195c9c7avboxsync# include <sys/param.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync# if (_BSDI_VERSION < 199510)
45e9809aff7304721fddb95654901b32195c9c7avboxsync# include <i386/isa/vgaioctl.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync# endif
45e9809aff7304721fddb95654901b32195c9c7avboxsync# endif /* __bsdi__ */
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync#endif /* CSRG_BASED */
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync/**************************************************************************/
45e9809aff7304721fddb95654901b32195c9c7avboxsync/* Kernel of *BSD */
45e9809aff7304721fddb95654901b32195c9c7avboxsync/**************************************************************************/
45e9809aff7304721fddb95654901b32195c9c7avboxsync#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || \
45e9809aff7304721fddb95654901b32195c9c7avboxsync defined(__NetBSD__) || defined(__OpenBSD__) || defined(__bsdi__) || defined(__DragonFly__)
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync# include <sys/param.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync# if defined(__FreeBSD_version) && !defined(__FreeBSD_kernel_version)
45e9809aff7304721fddb95654901b32195c9c7avboxsync# define __FreeBSD_kernel_version __FreeBSD_version
45e9809aff7304721fddb95654901b32195c9c7avboxsync# endif
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync# if !defined(LINKKIT)
45e9809aff7304721fddb95654901b32195c9c7avboxsync /* Don't need this stuff for the Link Kit */
45e9809aff7304721fddb95654901b32195c9c7avboxsync# if defined(__bsdi__)
45e9809aff7304721fddb95654901b32195c9c7avboxsync# include <i386/isa/pcconsioctl.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync# define CONSOLE_X_MODE_ON PCCONIOCRAW
45e9809aff7304721fddb95654901b32195c9c7avboxsync# define CONSOLE_X_MODE_OFF PCCONIOCCOOK
45e9809aff7304721fddb95654901b32195c9c7avboxsync# define CONSOLE_X_BELL PCCONIOCBEEP
45e9809aff7304721fddb95654901b32195c9c7avboxsync# else /* __bsdi__ */
45e9809aff7304721fddb95654901b32195c9c7avboxsync# if defined(__OpenBSD__)
45e9809aff7304721fddb95654901b32195c9c7avboxsync# ifdef PCCONS_SUPPORT
45e9809aff7304721fddb95654901b32195c9c7avboxsync# include <machine/pccons.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync# undef CONSOLE_X_MODE_ON
45e9809aff7304721fddb95654901b32195c9c7avboxsync# undef CONSOLE_X_MODE_OFF
45e9809aff7304721fddb95654901b32195c9c7avboxsync# undef CONSOLE_X_BELL
45e9809aff7304721fddb95654901b32195c9c7avboxsync# endif
45e9809aff7304721fddb95654901b32195c9c7avboxsync# endif
45e9809aff7304721fddb95654901b32195c9c7avboxsync# ifdef SYSCONS_SUPPORT
45e9809aff7304721fddb95654901b32195c9c7avboxsync# define COMPAT_SYSCONS
45e9809aff7304721fddb95654901b32195c9c7avboxsync# if defined(__NetBSD__) || defined(__OpenBSD__)
45e9809aff7304721fddb95654901b32195c9c7avboxsync# include <machine/console.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync# else
45e9809aff7304721fddb95654901b32195c9c7avboxsync# if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
45e9809aff7304721fddb95654901b32195c9c7avboxsync# if defined(__DragonFly__) || (__FreeBSD_kernel_version >= 410000)
45e9809aff7304721fddb95654901b32195c9c7avboxsync# include <sys/consio.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync# include <sys/kbio.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync# else
45e9809aff7304721fddb95654901b32195c9c7avboxsync# include <machine/console.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync# endif /* FreeBSD 4.1 RELEASE or lator */
45e9809aff7304721fddb95654901b32195c9c7avboxsync# else
45e9809aff7304721fddb95654901b32195c9c7avboxsync# include <sys/console.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync# endif
45e9809aff7304721fddb95654901b32195c9c7avboxsync# endif
45e9809aff7304721fddb95654901b32195c9c7avboxsync# endif /* SYSCONS_SUPPORT */
45e9809aff7304721fddb95654901b32195c9c7avboxsync# if defined(PCVT_SUPPORT)
45e9809aff7304721fddb95654901b32195c9c7avboxsync# if !defined(SYSCONS_SUPPORT)
45e9809aff7304721fddb95654901b32195c9c7avboxsync /* no syscons, so include pcvt specific header file */
45e9809aff7304721fddb95654901b32195c9c7avboxsync# if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
45e9809aff7304721fddb95654901b32195c9c7avboxsync# include <machine/pcvt_ioctl.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync# else
45e9809aff7304721fddb95654901b32195c9c7avboxsync# if defined(__NetBSD__) || defined(__OpenBSD__)
45e9809aff7304721fddb95654901b32195c9c7avboxsync# if !defined(WSCONS_SUPPORT)
45e9809aff7304721fddb95654901b32195c9c7avboxsync# include <machine/pcvt_ioctl.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync# endif /* WSCONS_SUPPORT */
45e9809aff7304721fddb95654901b32195c9c7avboxsync# else
45e9809aff7304721fddb95654901b32195c9c7avboxsync# include <sys/pcvt_ioctl.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync# endif /* __NetBSD__ */
45e9809aff7304721fddb95654901b32195c9c7avboxsync# endif /* __FreeBSD_kernel__ || __OpenBSD__ */
45e9809aff7304721fddb95654901b32195c9c7avboxsync# else /* pcvt and syscons: hard-code the ID magic */
45e9809aff7304721fddb95654901b32195c9c7avboxsync# define VGAPCVTID _IOWR('V',113, struct pcvtid)
45e9809aff7304721fddb95654901b32195c9c7avboxsync struct pcvtid {
45e9809aff7304721fddb95654901b32195c9c7avboxsync char name[16];
45e9809aff7304721fddb95654901b32195c9c7avboxsync int rmajor, rminor;
45e9809aff7304721fddb95654901b32195c9c7avboxsync };
45e9809aff7304721fddb95654901b32195c9c7avboxsync# endif /* PCVT_SUPPORT && SYSCONS_SUPPORT */
45e9809aff7304721fddb95654901b32195c9c7avboxsync# endif /* PCVT_SUPPORT */
45e9809aff7304721fddb95654901b32195c9c7avboxsync# ifdef WSCONS_SUPPORT
45e9809aff7304721fddb95654901b32195c9c7avboxsync# include <dev/wscons/wsconsio.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync# include <dev/wscons/wsdisplay_usl_io.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync# endif /* WSCONS_SUPPORT */
45e9809aff7304721fddb95654901b32195c9c7avboxsync# if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
45e9809aff7304721fddb95654901b32195c9c7avboxsync# if defined(__FreeBSD_kernel_version) && (__FreeBSD_kernel_version >= 500013)
45e9809aff7304721fddb95654901b32195c9c7avboxsync# include <sys/mouse.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync# else
45e9809aff7304721fddb95654901b32195c9c7avboxsync# undef MOUSE_GETINFO
45e9809aff7304721fddb95654901b32195c9c7avboxsync# include <machine/mouse.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync# endif
45e9809aff7304721fddb95654901b32195c9c7avboxsync# endif
45e9809aff7304721fddb95654901b32195c9c7avboxsync /* Include these definitions in case ioctl_pc.h didn't get included */
45e9809aff7304721fddb95654901b32195c9c7avboxsync# ifndef CONSOLE_X_MODE_ON
45e9809aff7304721fddb95654901b32195c9c7avboxsync# define CONSOLE_X_MODE_ON _IO('t',121)
45e9809aff7304721fddb95654901b32195c9c7avboxsync# endif
45e9809aff7304721fddb95654901b32195c9c7avboxsync# ifndef CONSOLE_X_MODE_OFF
45e9809aff7304721fddb95654901b32195c9c7avboxsync# define CONSOLE_X_MODE_OFF _IO('t',122)
45e9809aff7304721fddb95654901b32195c9c7avboxsync# endif
45e9809aff7304721fddb95654901b32195c9c7avboxsync# ifndef CONSOLE_X_BELL
45e9809aff7304721fddb95654901b32195c9c7avboxsync# define CONSOLE_X_BELL _IOW('t',123,int[2])
45e9809aff7304721fddb95654901b32195c9c7avboxsync# endif
45e9809aff7304721fddb95654901b32195c9c7avboxsync# ifndef CONSOLE_X_TV_ON
45e9809aff7304721fddb95654901b32195c9c7avboxsync# define CONSOLE_X_TV_ON _IOW('t',155,int)
45e9809aff7304721fddb95654901b32195c9c7avboxsync# define XMODE_RGB 0
45e9809aff7304721fddb95654901b32195c9c7avboxsync# define XMODE_NTSC 1
45e9809aff7304721fddb95654901b32195c9c7avboxsync# define XMODE_PAL 2
45e9809aff7304721fddb95654901b32195c9c7avboxsync# define XMODE_SECAM 3
45e9809aff7304721fddb95654901b32195c9c7avboxsync# endif
45e9809aff7304721fddb95654901b32195c9c7avboxsync# ifndef CONSOLE_X_TV_OFF
45e9809aff7304721fddb95654901b32195c9c7avboxsync# define CONSOLE_X_TV_OFF _IO('t',156)
45e9809aff7304721fddb95654901b32195c9c7avboxsync# endif
45e9809aff7304721fddb95654901b32195c9c7avboxsync#ifndef CONSOLE_GET_LINEAR_INFO
45e9809aff7304721fddb95654901b32195c9c7avboxsync# define CONSOLE_GET_LINEAR_INFO _IOR('t',157,struct map_info)
45e9809aff7304721fddb95654901b32195c9c7avboxsync#endif
45e9809aff7304721fddb95654901b32195c9c7avboxsync#ifndef CONSOLE_GET_IO_INFO
45e9809aff7304721fddb95654901b32195c9c7avboxsync# define CONSOLE_GET_IO_INFO _IOR('t',158,struct map_info)
45e9809aff7304721fddb95654901b32195c9c7avboxsync#endif
45e9809aff7304721fddb95654901b32195c9c7avboxsync#ifndef CONSOLE_GET_MEM_INFO
45e9809aff7304721fddb95654901b32195c9c7avboxsync# define CONSOLE_GET_MEM_INFO _IOR('t',159,struct map_info)
45e9809aff7304721fddb95654901b32195c9c7avboxsync#endif
45e9809aff7304721fddb95654901b32195c9c7avboxsync# endif /* __bsdi__ */
45e9809aff7304721fddb95654901b32195c9c7avboxsync# endif /* !LINKKIT */
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync#if defined(USE_I386_IOPL) || defined(USE_AMD64_IOPL)
45e9809aff7304721fddb95654901b32195c9c7avboxsync#include <machine/sysarch.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync#endif
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync# define CLEARDTR_SUPPORT
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync# if defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT) || defined(WSCONS_SUPPORT)
45e9809aff7304721fddb95654901b32195c9c7avboxsync# define USE_VT_SYSREQ
45e9809aff7304721fddb95654901b32195c9c7avboxsync# endif
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync#endif
45e9809aff7304721fddb95654901b32195c9c7avboxsync/* __FreeBSD_kernel__ || __NetBSD__ || __OpenBSD__ || __bsdi__ */
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync/**************************************************************************/
45e9809aff7304721fddb95654901b32195c9c7avboxsync/* IRIX */
45e9809aff7304721fddb95654901b32195c9c7avboxsync/**************************************************************************/
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync/**************************************************************************/
45e9809aff7304721fddb95654901b32195c9c7avboxsync/* Generic */
45e9809aff7304721fddb95654901b32195c9c7avboxsync/**************************************************************************/
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync#include <sys/wait.h> /* May need to adjust this for other OSs */
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync/*
45e9809aff7304721fddb95654901b32195c9c7avboxsync * Hack originally for ISC 2.2 POSIX headers, but may apply elsewhere,
45e9809aff7304721fddb95654901b32195c9c7avboxsync * and it's safe, so just do it.
45e9809aff7304721fddb95654901b32195c9c7avboxsync */
45e9809aff7304721fddb95654901b32195c9c7avboxsync#if !defined(O_NDELAY) && defined(O_NONBLOCK)
45e9809aff7304721fddb95654901b32195c9c7avboxsync# define O_NDELAY O_NONBLOCK
45e9809aff7304721fddb95654901b32195c9c7avboxsync#endif /* !O_NDELAY && O_NONBLOCK */
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync#if !defined(MAXHOSTNAMELEN)
45e9809aff7304721fddb95654901b32195c9c7avboxsync# define MAXHOSTNAMELEN 32
45e9809aff7304721fddb95654901b32195c9c7avboxsync#endif /* !MAXHOSTNAMELEN */
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync#if defined(_POSIX_SOURCE)
45e9809aff7304721fddb95654901b32195c9c7avboxsync# include <limits.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync#else
45e9809aff7304721fddb95654901b32195c9c7avboxsync# define _POSIX_SOURCE
45e9809aff7304721fddb95654901b32195c9c7avboxsync# include <limits.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync# undef _POSIX_SOURCE
45e9809aff7304721fddb95654901b32195c9c7avboxsync#endif /* _POSIX_SOURCE */
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync#if !defined(PATH_MAX)
45e9809aff7304721fddb95654901b32195c9c7avboxsync# if defined(MAXPATHLEN)
45e9809aff7304721fddb95654901b32195c9c7avboxsync# define PATH_MAX MAXPATHLEN
45e9809aff7304721fddb95654901b32195c9c7avboxsync# else
45e9809aff7304721fddb95654901b32195c9c7avboxsync# define PATH_MAX 1024
45e9809aff7304721fddb95654901b32195c9c7avboxsync# endif /* MAXPATHLEN */
45e9809aff7304721fddb95654901b32195c9c7avboxsync#endif /* !PATH_MAX */
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync#ifndef DEV_MEM
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define DEV_MEM "/dev/mem"
45e9809aff7304721fddb95654901b32195c9c7avboxsync#endif
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync#ifndef VT_SYSREQ_DEFAULT
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define VT_SYSREQ_DEFAULT FALSE
45e9809aff7304721fddb95654901b32195c9c7avboxsync#endif
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define SYSCALL(call) while(((call) == -1) && (errno == EINTR))
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define XF86_OS_PRIVS
45e9809aff7304721fddb95654901b32195c9c7avboxsync#include "xf86_OSproc.h"
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync#ifndef NO_COMPILER_H
45e9809aff7304721fddb95654901b32195c9c7avboxsync#include "compiler.h"
45e9809aff7304721fddb95654901b32195c9c7avboxsync#endif
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync#endif /* _XF86_OSLIB_H */