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