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/*
45e9809aff7304721fddb95654901b32195c9c7avboxsync * Define some things from the "ANSI" C wrappers that are needed in the
45e9809aff7304721fddb95654901b32195c9c7avboxsync * the core server.
45e9809aff7304721fddb95654901b32195c9c7avboxsync */
45e9809aff7304721fddb95654901b32195c9c7avboxsync#ifndef HAVE_WRAPPER_DECLS
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define HAVE_WRAPPER_DECLS
45e9809aff7304721fddb95654901b32195c9c7avboxsync#undef usleep
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define usleep(a) xf86usleep(a)
45e9809aff7304721fddb95654901b32195c9c7avboxsyncextern void xf86usleep(unsigned long);
45e9809aff7304721fddb95654901b32195c9c7avboxsyncextern int xf86getpagesize(void);
45e9809aff7304721fddb95654901b32195c9c7avboxsyncextern int xf86GetErrno(void);
45e9809aff7304721fddb95654901b32195c9c7avboxsynctypedef unsigned long xf86size_t;
45e9809aff7304721fddb95654901b32195c9c7avboxsynctypedef signed long xf86ssize_t;
45e9809aff7304721fddb95654901b32195c9c7avboxsync#endif
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(DGUX) && !defined(sgi) && \
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__) || defined(ISC)
45e9809aff7304721fddb95654901b32195c9c7avboxsync# include <sys/param.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync# endif
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync# ifdef ISC
45e9809aff7304721fddb95654901b32195c9c7avboxsync# define TIOCMSET (TIOC|26) /* set all modem bits */
45e9809aff7304721fddb95654901b32195c9c7avboxsync# define TIOCMBIS (TIOC|27) /* bis modem bits */
45e9809aff7304721fddb95654901b32195c9c7avboxsync# define TIOCMBIC (TIOC|28) /* bic modem bits */
45e9809aff7304721fddb95654901b32195c9c7avboxsync# define TIOCMGET (TIOC|29) /* get all modem bits */
45e9809aff7304721fddb95654901b32195c9c7avboxsync# endif
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(sun) && defined (SVR4) /* Solaris? */
45e9809aff7304721fddb95654901b32195c9c7avboxsync# if defined(i386) || defined(__x86) /* on x86 or x64? */
45e9809aff7304721fddb95654901b32195c9c7avboxsync# if !defined(V86SC_IOPL) /* Solaris 7 or later? */
45e9809aff7304721fddb95654901b32195c9c7avboxsync# include <sys/v86.h> /* Nope */
45e9809aff7304721fddb95654901b32195c9c7avboxsync# endif
45e9809aff7304721fddb95654901b32195c9c7avboxsync# endif /* V86SC_IOPL */
45e9809aff7304721fddb95654901b32195c9c7avboxsync# else
45e9809aff7304721fddb95654901b32195c9c7avboxsync# include <sys/v86.h> /* Not solaris */
45e9809aff7304721fddb95654901b32195c9c7avboxsync# endif /* sun && i386 && SVR4 */
45e9809aff7304721fddb95654901b32195c9c7avboxsync# if defined(sun) && (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(sparc) && !defined(__SOL8__))
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# include <sys/at_ansi.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync# include <sys/kd.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync# include <sys/vt.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync# elif 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# ifdef ISC
45e9809aff7304721fddb95654901b32195c9c7avboxsync# include <termios.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync# define POSIX_TTY
45e9809aff7304721fddb95654901b32195c9c7avboxsync# endif
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync# if defined(sun) && defined (i386) && defined (SVR4) && !defined(__SOL8__)
45e9809aff7304721fddb95654901b32195c9c7avboxsync# define USE_VT_SYSREQ
45e9809aff7304721fddb95654901b32195c9c7avboxsync# define VT_SYSREQ_DEFAULT TRUE
45e9809aff7304721fddb95654901b32195c9c7avboxsync# endif
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync# if defined(ATT) && !defined(i386)
45e9809aff7304721fddb95654901b32195c9c7avboxsync# define i386 /* not defined in ANSI C mode */
45e9809aff7304721fddb95654901b32195c9c7avboxsync# endif /* ATT && !i386 */
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync# ifdef SYSV
45e9809aff7304721fddb95654901b32195c9c7avboxsync# if !defined(ISC) || defined(ISC202) || defined(ISC22)
45e9809aff7304721fddb95654901b32195c9c7avboxsync# define NEED_STRERROR
45e9809aff7304721fddb95654901b32195c9c7avboxsync# endif
45e9809aff7304721fddb95654901b32195c9c7avboxsync# endif
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync#endif /* (SYSV || SVR4) && !DGUX */
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync/**************************************************************************/
45e9809aff7304721fddb95654901b32195c9c7avboxsync/* DG/ux R4.20MU03 Intel AViion Machines */
45e9809aff7304721fddb95654901b32195c9c7avboxsync/**************************************************************************/
45e9809aff7304721fddb95654901b32195c9c7avboxsync#if defined(DGUX) && defined(SVR4)
45e9809aff7304721fddb95654901b32195c9c7avboxsync#include <sys/ioctl.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync#include <signal.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync#include <ctype.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync#include <termios.h> /* Use termios for BSD Flavor ttys */
45e9809aff7304721fddb95654901b32195c9c7avboxsync#include <sys/termios.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync#include <sys/stat.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync#include <sys/types.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync#include <sys/param.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync#include <errno.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync#include <sys/sysi86.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync#include <unistd.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync#include <sys/proc.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync#include <sys/map.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync#include <sys/sysmacros.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync#include <sys/mman.h> /* Memory handling */
45e9809aff7304721fddb95654901b32195c9c7avboxsync#include <sys/kd.h> /* definitios for KDENABIO KDDISABIO needed for IOPL s */
45e9809aff7304721fddb95654901b32195c9c7avboxsync#include <sys/kbd.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync#include <fcntl.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync#include <time.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync#include <sys/stream.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync#include <sys/ptms.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync#include <sys/socket.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync#include <sys/utsname.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync#include <sys/stropts.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync#include <sys/sockio.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define POSIX_TTY
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync#undef HAS_USL_VTS
45e9809aff7304721fddb95654901b32195c9c7avboxsync#undef USE_VT_SYSREQ
45e9809aff7304721fddb95654901b32195c9c7avboxsync#undef VT_ACKACQ
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define LED_CAP KBD_LED_CAPS_LOCK
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define LED_NUM KBD_LED_NUM_LOCK
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define LED_SCR KBD_LED_SCROLL_LOCK
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define KDGKBTYPE KBD_GET_LANGUAGE
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync/* General keyboard types */
45e9809aff7304721fddb95654901b32195c9c7avboxsync# define KB_84 2
45e9809aff7304721fddb95654901b32195c9c7avboxsync# define KB_101 1 /* Because ioctl(dgkeybdFd,KBD_GET_LANGUAGE,&type) gives 1=US keyboard */
45e9809aff7304721fddb95654901b32195c9c7avboxsync# define KB_OTHER 3
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define KDSETLED KBD_SET_LED
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define KDGETLED KBD_GET_STATE
45e9809aff7304721fddb95654901b32195c9c7avboxsync#undef KDMKTONE
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define KDMKTONE KBD_TONE_HIGH
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync#undef DEV_MEM
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define DEV_MEM "/dev/mem"
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define CLEARDTR_SUPPORT
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync#undef VT_SYSREQ_DEFAULT
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define VT_SYSREQ_DEFAULT FALSE /* Make sure that we dont define any VTs since DG/ux has none */
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync#endif /* DGUX && 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 __GNU__ /* GNU/Hurd */
45e9809aff7304721fddb95654901b32195c9c7avboxsync# define USE_OSMOUSE
45e9809aff7304721fddb95654901b32195c9c7avboxsync#endif
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/* LynxOS AT */
45e9809aff7304721fddb95654901b32195c9c7avboxsync/**************************************************************************/
45e9809aff7304721fddb95654901b32195c9c7avboxsync#if defined(Lynx)
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync# include <termio.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync# include <sys/ioctl.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync# include <param.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync# include <signal.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync# include <kd.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync# include <vt.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync# include <sys/stat.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync# include <errno.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsyncextern int errno;
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync/* smem_create et.al. to access physical memory */
45e9809aff7304721fddb95654901b32195c9c7avboxsync# include <smem.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync/* keyboard types */
45e9809aff7304721fddb95654901b32195c9c7avboxsync# define KB_84 1
45e9809aff7304721fddb95654901b32195c9c7avboxsync# define KB_101 2
45e9809aff7304721fddb95654901b32195c9c7avboxsync# define KB_OTHER 3
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync/* atc drivers ignores argument to VT_RELDISP ioctl */
45e9809aff7304721fddb95654901b32195c9c7avboxsync# define VT_ACKACQ 2
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync# include <termios.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync# define POSIX_TTY
45e9809aff7304721fddb95654901b32195c9c7avboxsync# define CLEARDTR_SUPPORT
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync/* LynxOS 2.5.1 has these */
45e9809aff7304721fddb95654901b32195c9c7avboxsync# ifdef LED_NUMLOCK
45e9809aff7304721fddb95654901b32195c9c7avboxsync# define LED_CAP LED_CAPSLOCK
45e9809aff7304721fddb95654901b32195c9c7avboxsync# define LED_NUM LED_NUMLOCK
45e9809aff7304721fddb95654901b32195c9c7avboxsync# define LED_SCR LED_SCROLLOCK
45e9809aff7304721fddb95654901b32195c9c7avboxsync# endif
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync#endif /* Lynx */
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/* QNX4 */
45e9809aff7304721fddb95654901b32195c9c7avboxsync/**************************************************************************/
45e9809aff7304721fddb95654901b32195c9c7avboxsync/* This is the QNX code for Watcom 10.6 and QNX 4.x */
45e9809aff7304721fddb95654901b32195c9c7avboxsync#if defined(QNX4)
45e9809aff7304721fddb95654901b32195c9c7avboxsync#include <signal.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync#include <errno.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync#include <sys/stat.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync#include <termios.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync#include <ioctl.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync#include <sys/param.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync/* Warning: by default, the fd_set size is 32 in QNX! */
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define FD_SETSIZE 256
45e9809aff7304721fddb95654901b32195c9c7avboxsync#include <sys/select.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync /* keyboard types */
45e9809aff7304721fddb95654901b32195c9c7avboxsync# define KB_84 1
45e9809aff7304721fddb95654901b32195c9c7avboxsync# define KB_101 2
45e9809aff7304721fddb95654901b32195c9c7avboxsync# define KB_OTHER 3
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync /* LEDs */
45e9809aff7304721fddb95654901b32195c9c7avboxsync# define LED_CAP 0x04
45e9809aff7304721fddb95654901b32195c9c7avboxsync# define LED_NUM 0x02
45e9809aff7304721fddb95654901b32195c9c7avboxsync# define LED_SCR 0x01
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync# define POSIX_TTY
45e9809aff7304721fddb95654901b32195c9c7avboxsync# define OSMOUSE_ONLY
45e9809aff7304721fddb95654901b32195c9c7avboxsync# define MOUSE_PROTOCOL_IN_KERNEL
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define TIOCM_DTR 0x0001 /* data terminal ready */
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define TIOCM_RTS 0x0002 /* request to send */
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define TIOCM_CTS 0x1000 /* clear to send */
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define TIOCM_DSR 0x2000 /* data set ready */
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define TIOCM_RI 0x4000 /* ring */
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define TIOCM_RNG TIOCM_RI
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define TIOCM_CD 0x8000 /* carrier detect */
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define TIOCM_CAR TIOCM_CD
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define TIOCM_LE 0x0100 /* line enable */
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define TIOCM_ST 0x0200 /* secondary transmit */
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define TIOCM_SR 0x0400 /* secondary receive */
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync#endif
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync/**************************************************************************/
45e9809aff7304721fddb95654901b32195c9c7avboxsync/* QNX/Neutrino */
45e9809aff7304721fddb95654901b32195c9c7avboxsync/**************************************************************************/
45e9809aff7304721fddb95654901b32195c9c7avboxsync/* This is the Neutrino code for for NTO2.0 and GCC */
45e9809aff7304721fddb95654901b32195c9c7avboxsync#if defined(__QNXNTO__)
45e9809aff7304721fddb95654901b32195c9c7avboxsync#include <signal.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync#include <errno.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync#include <sys/stat.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync#include <termios.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync#include <ioctl.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync#include <sys/param.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync/* Warning: by default, the fd_set size is 32 in NTO! */
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define FD_SETSIZE 256
45e9809aff7304721fddb95654901b32195c9c7avboxsync#include <sys/select.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync /* keyboard types */
45e9809aff7304721fddb95654901b32195c9c7avboxsync# define KB_84 1
45e9809aff7304721fddb95654901b32195c9c7avboxsync# define KB_101 2
45e9809aff7304721fddb95654901b32195c9c7avboxsync# define KB_OTHER 3
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync# define POSIX_TTY
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync#endif
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync/**************************************************************************/
45e9809aff7304721fddb95654901b32195c9c7avboxsync/* IRIX */
45e9809aff7304721fddb95654901b32195c9c7avboxsync/**************************************************************************/
45e9809aff7304721fddb95654901b32195c9c7avboxsync#if defined(sgi)
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync#include <errno.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync#include <sys/types.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync#include <sys/stat.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync#endif
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(X_NOT_POSIX)
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#endif /* !X_NOT_POSIX */
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#ifdef NEED_STRERROR
45e9809aff7304721fddb95654901b32195c9c7avboxsync# ifndef strerror
45e9809aff7304721fddb95654901b32195c9c7avboxsyncextern char *sys_errlist[];
45e9809aff7304721fddb95654901b32195c9c7avboxsyncextern int sys_nerr;
45e9809aff7304721fddb95654901b32195c9c7avboxsync# define strerror(n) \
45e9809aff7304721fddb95654901b32195c9c7avboxsync ((n) >= 0 && (n) < sys_nerr) ? sys_errlist[n] : "unknown error"
45e9809aff7304721fddb95654901b32195c9c7avboxsync# endif /* !strerror */
45e9809aff7304721fddb95654901b32195c9c7avboxsync#endif /* NEED_STRERROR */
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync#if defined(ISC) || defined(Lynx)
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define rint(x) RInt(x)
45e9809aff7304721fddb95654901b32195c9c7avboxsyncdouble RInt(
45e9809aff7304721fddb95654901b32195c9c7avboxsync double x
45e9809aff7304721fddb95654901b32195c9c7avboxsync);
45e9809aff7304721fddb95654901b32195c9c7avboxsync#endif
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#ifdef OSMOUSE_ONLY
45e9809aff7304721fddb95654901b32195c9c7avboxsync# ifndef MOUSE_PROTOCOL_IN_KERNEL
45e9809aff7304721fddb95654901b32195c9c7avboxsync# define MOUSE_PROTOCOL_IN_KERNEL
45e9809aff7304721fddb95654901b32195c9c7avboxsync# endif
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 */