From b16b9e4656e7199c2aec74a4c8ebc7a875d3ba73 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Mon, 2 Feb 2015 15:02:49 +0100 Subject: massive reduction of unneeded files --- .../hw/xfree86/os-support/shared/VTsw_noop.c | 56 - .../hw/xfree86/os-support/shared/VTsw_usl.c | 92 - .../hw/xfree86/os-support/shared/agp_noop.c | 107 - .../hw/xfree86/os-support/shared/at_scancode.c | 132 -- .../hw/xfree86/os-support/shared/bios_devmem.c | 77 - .../hw/xfree86/os-support/shared/bios_mmap.c | 164 -- .../Xserver/hw/xfree86/os-support/shared/ia64Pci.c | 244 --- .../Xserver/hw/xfree86/os-support/shared/ia64Pci.h | 46 - .../Xserver/hw/xfree86/os-support/shared/inout.S | 111 - .../hw/xfree86/os-support/shared/ioperm_noop.c | 51 - .../Xserver/hw/xfree86/os-support/shared/kbd.c | 39 - .../hw/xfree86/os-support/shared/kmod_noop.c | 39 - .../hw/xfree86/os-support/shared/libc_wrapper.c | 2153 -------------------- .../Xserver/hw/xfree86/os-support/shared/pm_noop.c | 48 - .../hw/xfree86/os-support/shared/posix_tty.c | 689 ------- .../Xserver/hw/xfree86/os-support/shared/sigio.c | 312 --- .../hw/xfree86/os-support/shared/sigiostubs.c | 86 - .../Xserver/hw/xfree86/os-support/shared/stdPci.c | 52 - .../hw/xfree86/os-support/shared/stdResource.c | 182 -- .../hw/xfree86/os-support/shared/std_kbdEv.c | 50 - .../hw/xfree86/os-support/shared/sysv_kbd.c | 106 - .../Xserver/hw/xfree86/os-support/shared/vidmem.c | 300 --- .../Xserver/hw/xfree86/os-support/shared/xf86Axp.c | 50 - .../Xserver/hw/xfree86/os-support/shared/xf86Axp.h | 36 - 24 files changed, 5222 deletions(-) delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/shared/VTsw_noop.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/shared/VTsw_usl.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/shared/agp_noop.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/shared/at_scancode.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/shared/bios_devmem.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/shared/bios_mmap.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/shared/ia64Pci.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/shared/ia64Pci.h delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/shared/inout.S delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/shared/ioperm_noop.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/shared/kbd.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/shared/kmod_noop.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/shared/libc_wrapper.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/shared/pm_noop.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/shared/posix_tty.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/shared/sigio.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/shared/sigiostubs.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/shared/stdPci.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/shared/stdResource.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/shared/std_kbdEv.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/shared/sysv_kbd.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/shared/vidmem.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/shared/xf86Axp.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/shared/xf86Axp.h (limited to 'nx-X11/programs/Xserver/hw/xfree86/os-support/shared') diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/shared/VTsw_noop.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/shared/VTsw_noop.c deleted file mode 100644 index ac8ae3b0a..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/shared/VTsw_noop.c +++ /dev/null @@ -1,56 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/VTsw_noop.c,v 3.1.4.1 1998/06/05 16:23:20 dawes Exp $ */ -/* - * Copyright 1993 by David Wexelblat - * - * 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 - * documentation, and that the name of David Wexelblat not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. David Wexelblat makes no representations - * about the suitability of this software for any purpose. It is provided - * "as is" without express or implied warranty. - * - * DAVID WEXELBLAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL DAVID WEXELBLAT 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 OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - * - */ -/* $XConsortium: VTsw_noop.c /main/3 1996/02/21 17:53:25 kaleb $ */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include - -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" - -/* - * No-op functions for OSs without VTs - */ - -Bool -xf86VTSwitchPending() -{ - return(FALSE); -} - -Bool -xf86VTSwitchAway() -{ - return(FALSE); -} - -Bool -xf86VTSwitchTo() -{ - return(TRUE); -} diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/shared/VTsw_usl.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/shared/VTsw_usl.c deleted file mode 100644 index b38470aea..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/shared/VTsw_usl.c +++ /dev/null @@ -1,92 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/VTsw_usl.c,v 3.1.4.1 1998/06/05 16:23:21 dawes Exp $ */ -/* - * Copyright 1993 by David Wexelblat - * - * 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 - * documentation, and that the name of David Wexelblat not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. David Wexelblat makes no representations - * about the suitability of this software for any purpose. It is provided - * "as is" without express or implied warranty. - * - * DAVID WEXELBLAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL DAVID WEXELBLAT 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 OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - * - */ -/* $XConsortium: VTsw_usl.c /main/3 1996/02/21 17:53:28 kaleb $ */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include - -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" - -#ifdef OSHEADER -# include OSHEADER -#endif - -/* - * Handle the VT-switching interface for OSs that use USL-style ioctl()s - * (the sysv, sco, and linux subdirs). - */ - -/* - * This function is the signal handler for the VT-switching signal. It - * is only referenced inside the OS-support layer. - */ -void -xf86VTRequest(int sig) -{ - signal(sig, (void(*)(int))xf86VTRequest); - xf86Info.vtRequestsPending = TRUE; - return; -} - -Bool -xf86VTSwitchPending() -{ - return(xf86Info.vtRequestsPending ? TRUE : FALSE); -} - -Bool -xf86VTSwitchAway() -{ - xf86Info.vtRequestsPending = FALSE; - if (ioctl(xf86Info.consoleFd, VT_RELDISP, 1) < 0) - { - return(FALSE); - } - else - { -#ifdef OSSWITCHAWAY - OSSWITCHAWAY; -#endif - return(TRUE); - } -} - -Bool -xf86VTSwitchTo() -{ - xf86Info.vtRequestsPending = FALSE; - if (ioctl(xf86Info.consoleFd, VT_RELDISP, VT_ACKACQ) < 0) - { - return(FALSE); - } - else - { - return(TRUE); - } -} diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/shared/agp_noop.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/shared/agp_noop.c deleted file mode 100644 index c13b29c38..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/shared/agp_noop.c +++ /dev/null @@ -1,107 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/agp_noop.c,v 1.5 2003/08/24 17:37:05 dawes Exp $ */ -/* - * Copyright (c) 2000-2003 by The XFree86 Project, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the copyright holder(s) - * and author(s) shall not be used in advertising or otherwise to promote - * the sale, use or other dealings in this Software without prior written - * authorization from the copyright holder(s) and author(s). - */ - -/* - * Abstraction of the AGP GART interface. Stubs for platforms without - * AGP GART support. - */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#ifdef __UNIXOS2__ -# define I_NEED_OS2_H -#endif -#include -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" -#include "xf86OSpriv.h" - -Bool -xf86GARTCloseScreen(int screenNum) -{ - return FALSE; -} - -Bool -xf86AgpGARTSupported() -{ - return FALSE; -} - -AgpInfoPtr -xf86GetAGPInfo(int screenNum) -{ - return NULL; -} - -Bool -xf86AcquireGART(int screenNum) -{ - return FALSE; -} - -Bool -xf86ReleaseGART(int screenNum) -{ - return FALSE; -} - -int -xf86AllocateGARTMemory(int screenNum, unsigned long size, int type, - unsigned long *physical) -{ - return -1; -} - -Bool -xf86DeallocateGARTMemory(int screenNum, int key) -{ - return FALSE; -} - -Bool -xf86BindGARTMemory(int screenNum, int key, unsigned long offset) -{ - return FALSE; -} - - -Bool -xf86UnbindGARTMemory(int screenNum, int key) -{ - return FALSE; -} - -Bool -xf86EnableAGP(int screenNum, CARD32 mode) -{ - return FALSE; -} diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/shared/at_scancode.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/shared/at_scancode.c deleted file mode 100644 index 8947254bc..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/shared/at_scancode.c +++ /dev/null @@ -1,132 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/at_scancode.c,v 1.4 2003/08/24 17:37:05 dawes Exp $ */ -/* - * Copyright (c) 2002-2003 by The XFree86 Project, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the copyright holder(s) - * and author(s) shall not be used in advertising or otherwise to promote - * the sale, use or other dealings in this Software without prior written - * authorization from the copyright holder(s) and author(s). - */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include "xf86.h" -#include "xf86Xinput.h" -#include "xf86OSKbd.h" -#include "atKeynames.h" - -Bool -ATScancode(InputInfoPtr pInfo, int *scanCode) -{ - KbdDevPtr pKbd = (KbdDevPtr) pInfo->private; - - switch (pKbd->scanPrefix) { - case 0: - switch (*scanCode) { - case KEY_Prefix0: - case KEY_Prefix1: - pKbd->scanPrefix = *scanCode; /* special prefixes */ - return TRUE; - } - if (!xf86IsPc98()) { - switch (*scanCode) { - case 0x59: *scanCode = KEY_0x59; break; - case 0x5a: *scanCode = KEY_0x5A; break; - case 0x5b: *scanCode = KEY_0x5B; break; - case 0x5c: *scanCode = KEY_KP_Equal; break; /* Keypad Equal */ - case 0x5d: *scanCode = KEY_0x5D; break; - case 0x5e: *scanCode = KEY_0x5E; break; - case 0x5f: *scanCode = KEY_0x5F; break; - case 0x62: *scanCode = KEY_0x62; break; - case 0x63: *scanCode = KEY_0x63; break; - case 0x64: *scanCode = KEY_0x64; break; - case 0x65: *scanCode = KEY_0x65; break; - case 0x66: *scanCode = KEY_0x66; break; - case 0x67: *scanCode = KEY_0x67; break; - case 0x68: *scanCode = KEY_0x68; break; - case 0x69: *scanCode = KEY_0x69; break; - case 0x6a: *scanCode = KEY_0x6A; break; - case 0x6b: *scanCode = KEY_0x6B; break; - case 0x6c: *scanCode = KEY_0x6C; break; - case 0x6d: *scanCode = KEY_0x6D; break; - case 0x6e: *scanCode = KEY_0x6E; break; - case 0x6f: *scanCode = KEY_0x6F; break; - case 0x70: *scanCode = KEY_0x70; break; - case 0x71: *scanCode = KEY_0x71; break; - case 0x72: *scanCode = KEY_0x72; break; - case 0x73: *scanCode = KEY_0x73; break; - case 0x74: *scanCode = KEY_0x74; break; - case 0x75: *scanCode = KEY_0x75; break; - case 0x76: *scanCode = KEY_0x76; break; - } - } - break; - case KEY_Prefix0: - pKbd->scanPrefix = 0; - switch (*scanCode) { - case KEY_KP_7: *scanCode = KEY_Home; break; /* curs home */ - case KEY_KP_8: *scanCode = KEY_Up; break; /* curs up */ - case KEY_KP_9: *scanCode = KEY_PgUp; break; /* curs pgup */ - case KEY_KP_4: *scanCode = KEY_Left; break; /* curs left */ - case KEY_KP_5: *scanCode = KEY_Begin; break; /* curs begin */ - case KEY_KP_6: *scanCode = KEY_Right; break; /* curs right */ - case KEY_KP_1: *scanCode = KEY_End; break; /* curs end */ - case KEY_KP_2: *scanCode = KEY_Down; break; /* curs down */ - case KEY_KP_3: *scanCode = KEY_PgDown; break; /* curs pgdown */ - case KEY_KP_0: *scanCode = KEY_Insert; break; /* curs insert */ - case KEY_KP_Decimal: *scanCode = KEY_Delete; break; /* curs delete */ - case KEY_Enter: *scanCode = KEY_KP_Enter; break; /* keypad enter */ - case KEY_LCtrl: *scanCode = KEY_RCtrl; break; /* right ctrl */ - case KEY_KP_Multiply: *scanCode = KEY_Print; break; /* print */ - case KEY_Slash: *scanCode = KEY_KP_Divide; break; /* keyp divide */ - case KEY_Alt: *scanCode = KEY_AltLang; break; /* right alt */ - case KEY_ScrollLock: *scanCode = KEY_Break; break; /* curs break */ - case 0x5b: *scanCode = KEY_LMeta; break; - case 0x5c: *scanCode = KEY_RMeta; break; - case 0x5d: *scanCode = KEY_Menu; break; - case KEY_F3: *scanCode = KEY_F13; break; - case KEY_F4: *scanCode = KEY_F14; break; - case KEY_F5: *scanCode = KEY_F15; break; - case KEY_F6: *scanCode = KEY_F16; break; - case KEY_F7: *scanCode = KEY_F17; break; - case KEY_KP_Plus: *scanCode = KEY_KP_DEC; break; - case 0x2A: - case 0x36: - return TRUE; - default: - xf86MsgVerb(X_INFO, 4, "Unreported Prefix0 scancode: 0x%02x\n", - *scanCode); - *scanCode += 0x78; - } - break; - case KEY_Prefix1: - pKbd->scanPrefix = (*scanCode == KEY_LCtrl) ? KEY_LCtrl : 0; - return TRUE; - case KEY_LCtrl: - pKbd->scanPrefix = 0; - if (*scanCode != KEY_NumLock) - return TRUE; - *scanCode = KEY_Pause; /* pause */ - } - return FALSE; -} diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/shared/bios_devmem.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/shared/bios_devmem.c deleted file mode 100644 index 8bd6d3f3e..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/shared/bios_devmem.c +++ /dev/null @@ -1,77 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/bios_devmem.c,v 3.5 1998/09/13 00:51:32 dawes Exp $ */ -/* - * Copyright 1993 by David Wexelblat - * - * 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 - * documentation, and that the name of David Wexelblat not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. David Wexelblat makes no representations - * about the suitability of this software for any purpose. It is provided - * "as is" without express or implied warranty. - * - * DAVID WEXELBLAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL DAVID WEXELBLAT 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 OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - * - */ -/* $XConsortium: bios_devmem.c /main/5 1996/10/19 18:07:41 kaleb $ */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" -#include - -/* - * Read BIOS via /dev/mem. - */ - -#ifndef DEV_MEM -# define DEV_MEM "/dev/mem" -#endif - -int -xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf, - int Len) -{ - int fd; - -#ifdef __ia64__ - if ((fd = open(DEV_MEM, O_RDONLY | O_SYNC)) < 0) -#else - if ((fd = open(DEV_MEM, O_RDONLY)) < 0) -#endif - { - xf86Msg(X_WARNING, "xf86ReadBIOS: Failed to open %s (%s)\n", - DEV_MEM, strerror(errno)); - return(-1); - } - - if (lseek(fd, (Base+Offset), SEEK_SET) < 0) - { - xf86Msg(X_WARNING, "xf86ReadBIOS: %s seek failed (%s)\n", - DEV_MEM, strerror(errno)); - close(fd); - return(-1); - } - if (read(fd, Buf, Len) != Len) - { - xf86Msg(X_WARNING, "xf86ReadBIOS: %s read failed (%s)\n", - DEV_MEM, strerror(errno)); - close(fd); - return(-1); - } - close(fd); - return(Len); -} diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/shared/bios_mmap.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/shared/bios_mmap.c deleted file mode 100644 index b4ff8c31f..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/shared/bios_mmap.c +++ /dev/null @@ -1,164 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/bios_mmap.c,v 1.8 2000/11/19 16:38:06 tsi Exp $ */ -/* - * Copyright 1993 by David Wexelblat - * - * 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 - * documentation, and that the name of David Wexelblat not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. David Wexelblat makes no representations - * about the suitability of this software for any purpose. It is provided - * "as is" without express or implied warranty. - * - * DAVID WEXELBLAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL DAVID WEXELBLAT 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 OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - * - */ -/* $XConsortium: bios_V4mmap.c /main/4 1996/02/21 17:54:27 kaleb $ */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include - -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" - -#ifndef MAP_FAILED -#define MAP_FAILED ((void *)-1) -#endif - -/* - * Read BIOS via mmap()ing DEV_MEM - */ - -#ifndef __alpha__ -int -xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf, - int Len) -{ - int fd; - unsigned char *ptr; - int psize; - int mlen; - - if ((fd = open(DEV_MEM, O_RDONLY)) < 0) - { - xf86Msg(X_WARNING, "xf86ReadBIOS: Failed to open %s (%s)\n", - DEV_MEM, strerror(errno)); - return(-1); - } - psize = xf86getpagesize(); - Offset += Base & (psize - 1); - Base &= ~(psize - 1); - mlen = (Offset + Len + psize - 1) & ~(psize - 1); - ptr = (unsigned char *)mmap((caddr_t)0, mlen, PROT_READ, - MAP_SHARED, fd, (off_t)Base); - if (ptr == MAP_FAILED) - { - xf86Msg(X_WARNING, "xf86ReadBIOS: %s mmap failed (%s)\n", - DEV_MEM, strerror(errno)); - close(fd); - return(-1); - } -#ifdef DEBUG - ErrorF("xf86ReadBIOS: BIOS at 0x%08x has signature 0x%04x\n", - Base, ptr[0] | (ptr[1] << 8)); -#endif - (void)memcpy(Buf, (void *)(ptr + Offset), Len); - (void)munmap((caddr_t)ptr, mlen); - (void)close(fd); - return(Len); -} - -#else /* __alpha__ */ - - /* - * We trick "mmap" into mapping BUS memory for us via BUS_BASE, - * which is the KSEG address of the start of the DENSE memory - * area. - */ - - /* - * NOTE: there prolly ought to be more validity checks and all - * re: boundaries and sizes and such... - */ - -/* - * The Jensen lacks dense memory, thus we have to address the bus via - * the sparse addressing scheme. - * - * Martin Ostermann (ost@comnets.rwth-aachen.de) - Apr.-Sep. 1996 - */ - -#ifdef linux - -#ifdef TEST_JENSEN_CODE /* define to test the Sparse addressing on a non-Jensen */ -#define SPARSE (5) -#define isJensen (1) -#else -#define isJensen (!_bus_base()) -#define SPARSE (7) -#endif - -extern unsigned long _bus_base(void); -extern unsigned long _bus_base_sparse(void); -#define BUS_BASE (isJensen ? _bus_base_sparse() : _bus_base()) -#define JENSEN_SHIFT(x) (isJensen ? ((long)x< -#endif - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "compiler.h" -#include "460gxPCI.h" -#include "e8870PCI.h" -#include "zx1PCI.h" -#include "altixPCI.h" -#include "Pci.h" -#include "ia64Pci.h" - -/* - * We use special in/out routines here since Altix platforms require the - * use of the sysfs legacy_io interface. The legacy_io file maps to the I/O - * space of a given PCI domain; reads and writes are used to do port I/O. - * The file descriptor for the file is stored in the upper bits of the - * value passed in by the caller, and is created and populated by - * xf86MapDomainIO. - * - * If the legacy_io interface doesn't exist, we fall back to the glibc in/out - * routines, which are prefixed by an underscore (e.g. _outb). - */ -static int ia64_port_to_fd(unsigned long port) -{ - return (port >> 24) & 0xffffffff; -} - -void outb(unsigned long port, unsigned char val) -{ - int fd = ia64_port_to_fd(port); - - if (!fd) { - _outb(val, port & 0xffff); - goto out; - } - if (lseek(fd, port & 0xffff, SEEK_SET) == -1) { - ErrorF("I/O lseek failed\n"); - goto out; - } - if (write(fd, &val, 1) != 1) { - ErrorF("I/O write failed\n"); - goto out; - } - out: - return; -} - -void outw(unsigned long port, unsigned short val) -{ - int fd = ia64_port_to_fd(port); - - if (!fd) { - _outw(val, port & 0xffff); - goto out; - } - if (lseek(fd, port & 0xffff, SEEK_SET) == -1) { - ErrorF("I/O lseek failed\n"); - goto out; - } - if (write(fd, &val, 2) != 2) { - ErrorF("I/O write failed\n"); - goto out; - } - out: - return; -} - -void outl(unsigned long port, unsigned int val) -{ - int fd = ia64_port_to_fd(port); - - if (!fd) { - _outl(val, port & 0xffff); - goto out; - } - if (lseek(fd, port & 0xffff, SEEK_SET) == -1) { - ErrorF("I/O lseek failed\n"); - goto out; - } - if (write(fd, &val, 4) != 4) { - ErrorF("I/O write failed\n"); - goto out; - } - out: - return; -} - -unsigned int inb(unsigned long port) -{ - int fd = ia64_port_to_fd(port); - unsigned char val; - - if (!fd) - return _inb(port & 0xffff); - - if (lseek(fd, port & 0xffff, SEEK_SET) == -1) { - ErrorF("I/O lseek failed\n"); - val = -1; - goto out; - } - if (read(fd, &val, 1) != 1) { - ErrorF("I/O read failed\n"); - val = -1; - goto out; - } - out: - return val; -} - -unsigned int inw(unsigned long port) -{ - int fd = ia64_port_to_fd(port); - unsigned short val; - - if (!fd) - return _inw(port & 0xffff); - - if (lseek(fd, port & 0xffff, SEEK_SET) == -1) { - ErrorF("I/O lseek failed\n"); - val = -1; - goto out; - } - if (read(fd, &val, 2) != 2) { - ErrorF("I/O read failed\n"); - val = -1; - goto out; - } - out: - return val; -} - -unsigned int inl(unsigned long port) -{ - int fd = ia64_port_to_fd(port); - unsigned int val; - - if (!fd) - return _inl(port & 0xffff); - - if (lseek(fd, port & 0xffff, SEEK_SET) == -1) { - ErrorF("I/O lseek failed\n"); - val = -1; - goto out; - } - if (read(fd, &val, 4) != 4) { - ErrorF("I/O read failed\n"); - val = -1; - goto out; - } - out: - return val; -} - -void -ia64ScanPCIWrapper(scanpciWrapperOpt flags) -{ - static IA64Chipset chipset = NONE_CHIPSET; - - if (flags == SCANPCI_INIT) { - - /* PCI configuration space probes should be done first */ - if (xorgProbe460GX(flags)) { - chipset = I460GX_CHIPSET; - xf86PreScan460GX(); - return; - } else if (xorgProbeE8870(flags)) { - chipset = E8870_CHIPSET; - xf86PreScanE8870(); - return; - } -#ifdef OS_PROBE_PCI_CHIPSET - chipset = OS_PROBE_PCI_CHIPSET(flags); - switch (chipset) { - case ZX1_CHIPSET: - xf86PreScanZX1(); - return; - case ALTIX_CHIPSET: - xf86PreScanAltix(); - return; - default: - return; - } -#endif - } else /* if (flags == SCANPCI_TERM) */ { - - switch (chipset) { - case I460GX_CHIPSET: - xf86PostScan460GX(); - return; - case E8870_CHIPSET: - xf86PostScanE8870(); - return; - case ZX1_CHIPSET: - xf86PostScanZX1(); - return; - case ALTIX_CHIPSET: - xf86PostScanAltix(); - return; - default: - return; - } - } -} diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/shared/ia64Pci.h b/nx-X11/programs/Xserver/hw/xfree86/os-support/shared/ia64Pci.h deleted file mode 100644 index 978c9ff0e..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/shared/ia64Pci.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2004, Egbert Eich - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * EGBERT EICH BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CON- - * NECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of Egbert Eich shall not - * be used in advertising or otherwise to promote the sale, use or other deal- - *ings in this Software without prior written authorization from Egbert Eich. - * - */ -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#ifndef _IA64_PCI_H -# define _IA64_PCI_H - -#include "Pci.h" - -typedef enum { - NONE_CHIPSET, - I460GX_CHIPSET, - E8870_CHIPSET, - ZX1_CHIPSET, - ALTIX_CHIPSET -} IA64Chipset; - -# ifdef OS_PROBE_PCI_CHIPSET -extern IA64Chipset OS_PROBE_PCI_CHIPSET(scanpciWrapperOpt flags); -# endif -#endif diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/shared/inout.S b/nx-X11/programs/Xserver/hw/xfree86/os-support/shared/inout.S deleted file mode 100644 index 73a2cbbb6..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/shared/inout.S +++ /dev/null @@ -1,111 +0,0 @@ -/* $XConsortium: inout.s /main/6 1996/02/21 17:53:35 kaleb $ */ - - - - - -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/inout.s,v 3.5 1996/12/23 06:50:58 dawes Exp $ */ - -#include "assyntax.h" - -/* - * Make i80386 io primitives available at C-level. - */ - - FILE("inout.s") - AS_BEGIN - SEG_TEXT - -/* - *----------------------------------------------------------------------- - * inb --- - * Input one byte. - * - * Results: - * Byte in al. - *----------------------------------------------------------------------- - */ - GLOBL GLNAME(inb) -GLNAME(inb): - MOV_L (REGOFF(4,ESP),EDX) - SUB_L (EAX,EAX) - IN_B - RET - -/* - *----------------------------------------------------------------------- - * outb --- - * Output one byte. - * - * Results: - * None. - *----------------------------------------------------------------------- - */ - GLOBL GLNAME(outb) -GLNAME(outb): - MOV_L (REGOFF(4,sp),EDX) - MOV_L (REGOFF(8,sp),EAX) - OUT_B - RET -/* - *----------------------------------------------------------------------- - * inw --- - * Input one 16-bit word. - * - * Results: - * Word in ax. - *----------------------------------------------------------------------- - */ - GLOBL GLNAME(inw) -GLNAME(inw): - MOV_L (REGOFF(4,ESP),EDX) - IN_W - RET - -/* - *----------------------------------------------------------------------- - * outw --- - * Output one 16-bit word. - * - * Results: - * None. - *----------------------------------------------------------------------- - */ - GLOBL GLNAME(outw) -GLNAME(outw): - MOV_L (REGOFF(4,ESP),EDX) - MOV_L (REGOFF(8,ESP),EAX) - OUT_W - RET - -/* - *----------------------------------------------------------------------- - * inl --- - * Input one 32-bit longword. - * - * Results: - * Word in eax. - *----------------------------------------------------------------------- - */ - GLOBL GLNAME(inl) -GLNAME(inl): - MOV_L (REGOFF(4,ESP),EDX) - IN_L - RET - -/* - *----------------------------------------------------------------------- - * outl --- - * Output one 32-bit longword. - * - * Results: - * None. - *----------------------------------------------------------------------- - */ - GLOBL GLNAME(outl) -GLNAME(outl): - MOV_L (REGOFF(4,ESP),EDX) - MOV_L (REGOFF(8,ESP),EAX) - OUT_L - RET - diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/shared/ioperm_noop.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/shared/ioperm_noop.c deleted file mode 100644 index b3ea044f9..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/shared/ioperm_noop.c +++ /dev/null @@ -1,51 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/ioperm_noop.c,v 3.3 1998/07/25 16:57:00 dawes Exp $ */ -/* - * Copyright 1993 by David Wexelblat - * - * 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 - * documentation, and that the name of David Wexelblat not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. David Wexelblat makes no representations - * about the suitability of this software for any purpose. It is provided - * "as is" without express or implied warranty. - * - * DAVID WEXELBLAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL DAVID WEXELBLAT 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 OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - * - */ -/* $XConsortium: ioperm_noop.c /main/3 1996/02/21 17:53:39 kaleb $ */ - -/* - * Some platforms don't bother with I/O permissions, - * or the permissions are implicit with opening/enabling the console. - */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" - -Bool -xf86EnableIO() -{ - return TRUE; -} - -void -xf86DisableIO() -{ - return; -} - diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/shared/kbd.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/shared/kbd.c deleted file mode 100644 index 822c8fe52..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/shared/kbd.c +++ /dev/null @@ -1,39 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/kbd.c,v 1.3 2003/08/24 17:37:05 dawes Exp $ */ -/* - * Copyright (c) 2001-2003 by The XFree86 Project, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the copyright holder(s) - * and author(s) shall not be used in advertising or otherwise to promote - * the sale, use or other dealings in this Software without prior written - * authorization from the copyright holder(s) and author(s). - */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include "xf86OSKbd.h" - -Bool -xf86OSKbdPreInit(InputInfoPtr pInfo) -{ - return FALSE; -} diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/shared/kmod_noop.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/shared/kmod_noop.c deleted file mode 100644 index 620e9bf35..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/shared/kmod_noop.c +++ /dev/null @@ -1,39 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/kmod_noop.c,v 1.2 2003/08/24 17:37:05 dawes Exp $ */ -/* - * Copyright (c) 2000 by The XFree86 Project, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the copyright holder(s) - * and author(s) shall not be used in advertising or otherwise to promote - * the sale, use or other dealings in this Software without prior written - * authorization from the copyright holder(s) and author(s). - */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include "xf86_OSproc.h" - -int xf86LoadKernelModule(const char *pathname) -{ - (void) pathname; - return 0; /* failure */ -} diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/shared/libc_wrapper.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/shared/libc_wrapper.c deleted file mode 100644 index aba445945..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/shared/libc_wrapper.c +++ /dev/null @@ -1,2153 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/libc_wrapper.c,v 1.102 2003/11/19 03:52:58 dawes Exp $ */ -/* - * Copyright 1997-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 - * documentation, and that the names of Orest Zborowski and David Wexelblat - * not be used in advertising or publicity pertaining to distribution of - * the software without specific, written prior permission. Orest Zborowski - * and David Wexelblat make no representations about the suitability of this - * software for any purpose. It is provided "as is" without express or - * implied warranty. - * - * THE XFREE86 PROJECT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD - * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS, IN NO EVENT SHALL OREST ZBOROWSKI OR DAVID WEXELBLAT 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 OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#if defined(linux) && !defined(__GLIBC__) -#undef __STRICT_ANSI__ -#endif -#include -#ifdef __UNIXOS2__ -#define I_NEED_OS2_H -#endif -#include -#include -#include -#include -#if defined(__bsdi__) -#undef _POSIX_SOURCE -#undef _ANSI_SOURCE -#endif -#include -#include -#ifdef sun -#include -#endif -#include -#include -#include -#include "os.h" -#include -#include -#include -#include -#include -#include -#ifdef __UNIXOS2__ -#define NO_MMAP -#include -#endif -#ifdef HAS_SVR3_MMAPDRV -#define NO_MMAP -#ifdef SELF_CONTAINED_WRAPPER -#include -#include -#include -#if !defined(_NEED_SYSI86) -# include -# include -#endif -#include -struct kd_memloc MapDSC; -int mmapFd = -2; -#else -extern struct kd_memloc MapDSC; -extern int mmapFd; -#endif -#endif -#ifndef NO_MMAP -#include -#ifndef MAP_FAILED -#define MAP_FAILED ((caddr_t)-1) -#endif -#endif -#if !defined(ISC) -#include -#endif - -#define NEED_XF86_TYPES -#define NEED_XF86_PROTOTYPES -#define DONT_DEFINE_WRAPPERS -#include "xf86_ansic.h" - -#ifndef SELF_CONTAINED_WRAPPER -#include "xf86.h" -#include "xf86Priv.h" -#define NO_OSLIB_PROTOTYPES -#define XF86_OS_PRIVS -#define HAVE_WRAPPER_DECLS -#include "xf86_OSlib.h" -#else -void xf86WrapperInit(void); -#endif - - -#ifndef X_NOT_POSIX -#include -#else -#ifdef SYSV -#include -#else -#ifdef USG -#include -#else -#include -#ifndef dirent -#define dirent direct -#endif -#endif -#endif -#endif -typedef struct dirent DIRENTRY; - -#ifdef __UNIXOS2__ -#define _POSIX_SOURCE -#endif -#ifdef ISC202 -#include -#define WIFEXITED(a) ((a & 0x00ff) == 0) /* LSB will be 0 */ -#define WEXITSTATUS(a) ((a & 0xff00) >> 8) -#define WIFSIGNALED(a) ((a & 0xff00) == 0) /* MSB will be 0 */ -#define WTERMSIG(a) (a & 0x00ff) -#else -#if defined(ISC) && !defined(_POSIX_SOURCE) -#define _POSIX_SOURCE -#include -#include -#undef _POSIX_SOURCE -#else -#if (defined(ISC) && defined(_POSIX_SOURCE)) || defined(Lynx) || (defined (__alpha__) && defined(linux)) -#include -#endif -#include -#endif -#endif -#ifdef Lynx -#if !defined(S_IFIFO) && defined(S_IFFIFO) -#define S_IFIFO S_IFFIFO -#endif -#endif - -/* For xf86getpagesize() */ -#if defined(linux) -#define HAS_SC_PAGESIZE -#define HAS_GETPAGESIZE -#elif defined(CSRG_BASED) -#define HAS_GETPAGESIZE -#elif defined(DGUX) -#define HAS_GETPAGESIZE -#elif defined(sun) && !defined(SVR4) -#define HAS_GETPAGESIZE -#endif -#ifdef XNO_SYSCONF -#undef _SC_PAGESIZE -#endif -#ifdef HAVE_SYSV_IPC -#include -#include -#endif -#include - -#if defined(setjmp) && defined(__GNU_LIBRARY__) && \ - (!defined(__GLIBC__) || (__GLIBC__ < 2) || \ - ((__GLIBC__ == 2) && (__GLIBC_MINOR__ < 3))) -#define HAS_GLIBC_SIGSETJMP 1 -#endif - -#if 0 -#define SETBUF_RETURNS_INT -#endif - -double xf86HUGE_VAL; - -#ifndef SELF_CONTAINED_WRAPPERS -extern void xf86DisableIO(void); -#endif - -/* - * This file contains the XFree86 wrappers for libc functions that can be - * called by loadable modules - */ - -double -xf86hypot(double x, double y) -{ - return(hypot(x,y)); -} - -void -xf86qsort(void *base, xf86size_t nmemb, xf86size_t size, - int (*comp)(const void *, const void *)) -{ - qsort(base, nmemb, size, comp); -} - -/* string functions */ - -char* -xf86strcat(char* dest, const char* src) -{ - return(strcat(dest,src)); -} - -char* -xf86strchr(const char* s, int c) -{ - return strchr(s,c); -} - -int -xf86strcmp(const char* s1, const char* s2) -{ - return strcmp(s1,s2); -} - -/* Just like the BSD version. It assumes that tolower() is ANSI-compliant */ -int -xf86strcasecmp(const char* s1, const char* s2) -{ - const unsigned char *us1 = (const unsigned char *)s1; - const unsigned char *us2 = (const unsigned char *)s2; - - while (tolower(*us1) == tolower(*us2++)) - if (*us1++ == '\0') - return 0; - - return tolower(*us1) - tolower(*--us2); -} - -char* -xf86strcpy(char* dest, const char* src) -{ - return strcpy(dest,src); -} - -xf86size_t -xf86strcspn(const char* s1, const char* s2) -{ - return (xf86size_t)strcspn(s1,s2); -} - -xf86size_t -xf86strlen(const char* s) -{ - return (xf86size_t)strlen(s); -} - -xf86size_t -xf86strlcat(char *dest, const char *src, xf86size_t size) -{ - return(strlcat(dest, src, size)); -} - -xf86size_t -xf86strlcpy(char *dest, const char *src, xf86size_t size) -{ - return strlcpy(dest, src, size); -} - -char* -xf86strncat(char* dest, const char* src, xf86size_t n) -{ - return strncat(dest,src,(size_t)n); -} - -int -xf86strncmp(const char* s1, const char* s2, xf86size_t n) -{ - return strncmp(s1,s2,(size_t)n); -} - -/* Just like the BSD version. It assumes that tolower() is ANSI-compliant */ -int -xf86strncasecmp(const char* s1, const char* s2, xf86size_t n) -{ - if (n != 0) { - const unsigned char *us1 = (const unsigned char *)s1; - const unsigned char *us2 = (const unsigned char *)s2; - - do { - if (tolower(*us1) != tolower(*us2++)) - return tolower(*us1) - tolower(*--us2); - if (*us1++ == '\0') - break; - } while (--n != 0); - } - return 0; -} - -char* -xf86strncpy(char* dest, const char* src, xf86size_t n) -{ - return strncpy(dest,src,(size_t)n); -} - -char* -xf86strpbrk(const char* s1, const char* s2) -{ - return strpbrk(s1,s2); -} - -char* -xf86strrchr(const char* s, int c) -{ - return strrchr(s,c); -} - -xf86size_t -xf86strspn(const char* s1, const char* s2) -{ - return strspn(s1,s2); -} - -char* -xf86strstr(const char* s1, const char* s2) -{ - return strstr(s1,s2); -} - -char* -xf86strtok(char* s1, const char* s2) -{ - return strtok(s1,s2); -} - -char* -xf86strdup(const char* s) -{ - return xstrdup(s); -} - -int -xf86sprintf(char *s, const char *format, ...) -{ - int ret; - va_list args; - va_start(args, format); - ret = vsprintf(s, format, args); - va_end(args); - return ret; -} - -int -xf86snprintf(char *s, xf86size_t len, const char *format, ...) -{ - int ret; - va_list args; - va_start(args, format); - ret = vsnprintf(s, (size_t)len, format, args); - va_end(args); - return ret; -} - -void -xf86bzero(void* s, unsigned int n) -{ - memset(s, 0, n); -} - -#ifdef HAVE_VSSCANF -int -xf86sscanf(char *s, const char *format, ...) -#else -int -xf86sscanf(char *s, const char *format, char *a0, char *a1, char *a2, - char *a3, char *a4, char *a5, char *a6, char *a7, char *a8, - char *a9) /* limit of ten args */ -#endif -{ -#ifdef HAVE_VSSCANF - int ret; - va_list args; - va_start(args, format); - - ret = vsscanf(s,format,args); - va_end(args); - return ret; -#else - return sscanf(s, format, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); -#endif -} - -/* Basic I/O */ - -int xf86errno; - -/* XXX This is not complete */ - -static int -xfToOsOpenFlags(int xfflags) -{ - int flags = 0; - - /* XXX This assumes O_RDONLY is 0 */ - if (xfflags & XF86_O_WRONLY) - flags |= O_WRONLY; - if (xfflags & XF86_O_RDWR) - flags |= O_RDWR; - if (xfflags & XF86_O_CREAT) - flags |= O_CREAT; - - return flags; -} - -int -xf86open(const char *path, int flags, ...) -{ - int fd; - va_list ap; - - va_start(ap, flags); - flags = xfToOsOpenFlags(flags); - if (flags & O_CREAT) { - /* can't request a mode_t directly on systems where mode_t - is an unsigned short */ - mode_t mode = (mode_t)va_arg(ap, unsigned int); - fd = open(path, flags, mode); - } else { - fd = open(path, flags); - } - va_end(ap); - xf86errno = xf86GetErrno(); - - return fd; -} - -int -xf86close(int fd) -{ - int status = close(fd); - - xf86errno = xf86GetErrno(); - return status; -} - -long -xf86lseek(int fd, long offset, int whence) -{ - switch (whence) { - case XF86_SEEK_SET: - whence = SEEK_SET; - break; - case XF86_SEEK_CUR: - whence = SEEK_CUR; - break; - case XF86_SEEK_END: - whence = SEEK_END; - break; - } - return (long)lseek(fd, (off_t)offset, whence); -} - -int -xf86ioctl(int fd, unsigned long request, pointer argp) -{ - int status = ioctl(fd, request, argp); - - xf86errno = xf86GetErrno(); - return status; -} - -xf86ssize_t -xf86read(int fd, void *buf, xf86size_t nbytes) -{ - xf86ssize_t n = read(fd, buf, (size_t)nbytes); - - xf86errno = xf86GetErrno(); - return n; -} - -xf86ssize_t -xf86write(int fd, const void *buf, xf86size_t nbytes) -{ - xf86ssize_t n = write(fd, buf, (size_t)nbytes); - - xf86errno = xf86GetErrno(); - return n; -} - -void* -xf86mmap(void *start, xf86size_t length, int prot, - int flags, int fd, xf86size_t /* off_t */ offset) -{ -#ifndef NO_MMAP - int p=0, f=0; - void *rc; - - if (flags & XF86_MAP_FIXED) f |= MAP_FIXED; - if (flags & XF86_MAP_SHARED) f |= MAP_SHARED; - if (flags & XF86_MAP_PRIVATE) f |= MAP_PRIVATE; -#if defined(__amd64__) && defined(linux) - if (flags & XF86_MAP_32BIT) f |= MAP_32BIT; -#endif - if (prot & XF86_PROT_EXEC) p |= PROT_EXEC; - if (prot & XF86_PROT_READ) p |= PROT_READ; - if (prot & XF86_PROT_WRITE) p |= PROT_WRITE; - if (prot & XF86_PROT_NONE) p |= PROT_NONE; - - rc = mmap(start,(size_t)length,p,f,fd,(off_t)offset); - - xf86errno = xf86GetErrno(); - if (rc == MAP_FAILED) - return XF86_MAP_FAILED; - else - return rc; -#else -#ifdef HAS_SVR3_MMAPDRV - void *rc; -#ifdef SELF_CONTAINED_WRAPPER - if(mmapFd < 0) { - if ((mmapFd = open("/dev/mmap", O_RDWR)) == -1) { - ErrorF("Warning: failed to open /dev/mmap \n"); - xf86errno = xf86_ENOSYS; - return XF86_MAP_FAILED; - } - } -#endif - MapDSC.vaddr = (char *)start; - MapDSC.physaddr = (char *)offset; - MapDSC.length = length; - MapDSC.ioflg = 1; - - rc = (pointer)ioctl(mmapFd, MAP, &MapDSC); - xf86errno = xf86GetErrno(); - if (rc == NULL) - return XF86_MAP_FAILED; - else - return rc; -#else - ErrorF("Warning: mmap() is not supported on this platform\n"); - xf86errno = xf86_ENOSYS; - return XF86_MAP_FAILED; -#endif -#endif -} - -int -xf86munmap(void *start, xf86size_t length) -{ -#ifndef NO_MMAP - int rc = munmap(start,(size_t)length); - - xf86errno = xf86GetErrno(); - return rc; -#else -#ifdef HAS_SVR3_MMAPDRV - int rc = ioctl(mmapFd, UNMAPRM , start); - - xf86errno = xf86GetErrno(); - return rc; -#else - ErrorF("Warning: munmap() is not supported on this platform\n"); - xf86errno = xf86_ENOSYS; - return -1; -#endif -#endif -} - -int -xf86stat(const char *file_name, struct xf86stat *xfst) -{ - int rc; - struct stat st; - - rc = stat(file_name, &st); - xf86errno = xf86GetErrno(); - xfst->st_rdev = st.st_rdev; /* Not much is currently supported */ - return rc; -} - -int -xf86fstat(int fd, struct xf86stat *xfst) -{ - int rc; - struct stat st; - - rc = fstat(fd, &st); - xf86errno = xf86GetErrno(); - xfst->st_rdev = st.st_rdev; /* Not much is currently supported */ - return rc; -} - -static int -xfToOsAccessMode(int xfmode) -{ - switch(xfmode) { - case XF86_R_OK: return R_OK; - case XF86_W_OK: return W_OK; - case XF86_X_OK: return X_OK; - case XF86_F_OK: return F_OK; - } - return 0; -} - -int -xf86access(const char *pathname, int mode) -{ - int rc; - - mode = xfToOsAccessMode(mode); - rc = access(pathname, mode); - xf86errno = xf86GetErrno(); - return rc; -} - - - -/* limited stdio support */ - -#define XF86FILE_magic 0x58464856 /* "XFHV" */ - -typedef struct _xf86_file_ { - INT32 fileno; - INT32 magic; - FILE* filehnd; - char* fname; -} XF86FILE_priv; - -XF86FILE_priv stdhnd[3] = { - { 0, XF86FILE_magic, NULL, "$stdinp$" }, - { 0, XF86FILE_magic, NULL, "$stdout$" }, - { 0, XF86FILE_magic, NULL, "$stderr$" } -}; - -XF86FILE* xf86stdin = (XF86FILE*)&stdhnd[0]; -XF86FILE* xf86stdout = (XF86FILE*)&stdhnd[1]; -XF86FILE* xf86stderr = (XF86FILE*)&stdhnd[2]; - -void -xf86WrapperInit() -{ - if (stdhnd[0].filehnd == NULL) - stdhnd[0].filehnd = stdin; - if (stdhnd[1].filehnd == NULL) - stdhnd[1].filehnd = stdout; - if (stdhnd[2].filehnd == NULL) - stdhnd[2].filehnd = stderr; - xf86HUGE_VAL = HUGE_VAL; -} - -XF86FILE* -xf86fopen(const char* fn, const char* mode) -{ - XF86FILE_priv* fp; - FILE *f = fopen(fn,mode); - xf86errno = xf86GetErrno(); - if (!f) return 0; - - fp = xalloc(sizeof(XF86FILE_priv)); - fp->magic = XF86FILE_magic; - fp->filehnd = f; - fp->fileno = fileno(f); - fp->fname = xf86strdup(fn); -#ifdef DEBUG - ErrorF("xf86fopen(%s,%s) yields FILE %p XF86FILE %p\n", - fn,mode,f,fp); -#endif - return (XF86FILE*)fp; -} - -static void _xf86checkhndl(XF86FILE_priv* f,const char *func) -{ - if (!f || f->magic != XF86FILE_magic || - !f->filehnd || !f->fname) { - FatalError("libc_wrapper error: passed invalid FILE handle to %s", - func); - exit(42); - } -} - -int -xf86fclose(XF86FILE* f) -{ - XF86FILE_priv* fp = (XF86FILE_priv*)f; - int ret; - - _xf86checkhndl(fp,"xf86fclose"); - - /* somewhat bad check */ - if (fp->fileno < 3 && fp->fname[0]=='$') { - /* assume this is stdin/out/err, don't dispose */ - ret = fclose(fp->filehnd); - } else { - ret = fclose(fp->filehnd); - fp->magic = 0; /* invalidate */ - xfree(fp->fname); - xfree(fp); - } - return ret ? -1 : 0; -} - -int -xf86printf(const char *format, ...) -{ - int ret; - va_list args; - va_start(args, format); - - ret = printf(format,args); - va_end(args); - return ret; -} - -int -xf86fprintf(XF86FILE* f, const char *format, ...) -{ - XF86FILE_priv* fp = (XF86FILE_priv*)f; - - int ret; - va_list args; - va_start(args, format); - -#ifdef DEBUG - ErrorF("xf86fprintf for XF86FILE %p\n", fp); -#endif - _xf86checkhndl(fp,"xf86fprintf"); - - ret = vfprintf(fp->filehnd,format,args); - va_end(args); - return ret; -} - -int -xf86vfprintf(XF86FILE* f, const char *format, va_list ap) -{ - XF86FILE_priv* fp = (XF86FILE_priv*)f; - -#ifdef DEBUG - ErrorF("xf86vfprintf for XF86FILE %p\n", fp); -#endif - _xf86checkhndl(fp,"xf86vfprintf"); - - return vfprintf(fp->filehnd,format,ap); -} - -int -xf86vsprintf(char *s, const char *format, va_list ap) -{ - return vsprintf(s, format, ap); -} - -int -xf86vsnprintf(char *s, xf86size_t len, const char *format, va_list ap) -{ - return vsnprintf(s, (size_t)len, format, ap); -} - -#ifdef HAVE_VFSCANF -int -xf86fscanf(XF86FILE* f, const char *format, ...) -#else -int -xf86fscanf(XF86FILE* f, const char *format, char *a0, char *a1, char *a2, - char *a3, char *a4, char *a5, char *a6, char *a7, char *a8, - char *a9) /* limit of ten args */ -#endif -{ - XF86FILE_priv* fp = (XF86FILE_priv*)f; - -#ifdef HAVE_VFSCANF - int ret; - va_list args; - va_start(args, format); - - _xf86checkhndl(fp,"xf86fscanf"); - - ret = vfscanf(fp->filehnd,format,args); - va_end(args); - return ret; -#else - _xf86checkhndl(fp,"xf86fscanf"); - return fscanf(fp->filehnd, format, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); -#endif -} - -char * -xf86fgets(char *buf, INT32 n, XF86FILE* f) -{ - XF86FILE_priv* fp = (XF86FILE_priv*)f; - - _xf86checkhndl(fp,"xf86fgets"); - return fgets(buf,(int)n,fp->filehnd); -} - -int -xf86fputs(const char *buf, XF86FILE* f) -{ - XF86FILE_priv* fp = (XF86FILE_priv*)f; - - _xf86checkhndl(fp,"xf86fputs"); - return fputs(buf,fp->filehnd); -} - -int -xf86getc(XF86FILE* f) -{ - XF86FILE_priv* fp = (XF86FILE_priv*)f; - - _xf86checkhndl(fp,"xf86getc"); - return getc(fp->filehnd); -} - -int -xf86fgetc(XF86FILE* f) -{ - XF86FILE_priv* fp = (XF86FILE_priv*)f; - - _xf86checkhndl(fp,"xf86fgetc"); - return fgetc(fp->filehnd); -} - -int -xf86fputc(int c,XF86FILE* f) -{ - XF86FILE_priv* fp = (XF86FILE_priv*)f; - - _xf86checkhndl(fp,"xf86fputc"); - return fputc(c,fp->filehnd); -} - -int -xf86fflush(XF86FILE* f) -{ - XF86FILE_priv* fp = (XF86FILE_priv*)f; - - _xf86checkhndl(fp,"xf86fflush"); - return fflush(fp->filehnd); -} - -xf86size_t -xf86fread(void* buf, xf86size_t sz, xf86size_t cnt, XF86FILE* f) -{ - XF86FILE_priv* fp = (XF86FILE_priv*)f; - -#ifdef DEBUG - ErrorF("xf86fread for XF86FILE %p\n", fp); -#endif - _xf86checkhndl(fp,"xf86fread"); - return fread(buf,(size_t)sz,(size_t)cnt,fp->filehnd); -} - -xf86size_t -xf86fwrite(const void* buf, xf86size_t sz, xf86size_t cnt, XF86FILE* f) -{ - XF86FILE_priv* fp = (XF86FILE_priv*)f; - - _xf86checkhndl(fp,"xf86fwrite"); - return fwrite(buf,(size_t)sz,(size_t)cnt,fp->filehnd); -} - -int -xf86fseek(XF86FILE* f, long offset, int whence) -{ - XF86FILE_priv* fp = (XF86FILE_priv*)f; - - _xf86checkhndl(fp,"xf86fseek"); - switch (whence) { - case XF86_SEEK_SET: - whence = SEEK_SET; - break; - case XF86_SEEK_CUR: - whence = SEEK_CUR; - break; - case XF86_SEEK_END: - whence = SEEK_END; - break; - } - return fseek(fp->filehnd,offset,whence); -} - -long -xf86ftell(XF86FILE* f) -{ - XF86FILE_priv* fp = (XF86FILE_priv*)f; - - _xf86checkhndl(fp,"xf86ftell"); - return ftell(fp->filehnd); -} - -#define mapnum(e) case (xf86_##e): err = e; break; - -char* -xf86strerror(int n) -{ - int err; - - switch (n) - { - case 0: err = 0; break; - mapnum (EACCES); - mapnum (EAGAIN); - mapnum (EBADF); - mapnum (EEXIST); - mapnum (EFAULT); - mapnum (EINTR); - mapnum (EINVAL); - mapnum (EISDIR); - mapnum (ELOOP); /* not POSIX 1 */ - mapnum (EMFILE); - mapnum (ENAMETOOLONG); - mapnum (ENFILE); - mapnum (ENOENT); - mapnum (ENOMEM); - mapnum (ENOSPC); - mapnum (ENOTDIR); - mapnum (EPIPE); - mapnum (EROFS); -#ifndef __UNIXOS2__ - mapnum (ETXTBSY); /* not POSIX 1 */ -#endif - mapnum (ENOTTY); -#ifdef ENOSYS - mapnum (ENOSYS); -#endif - mapnum (EBUSY); - mapnum (ENODEV); - mapnum (EIO); -#ifdef ESRCH - mapnum (ESRCH); -#endif -#ifdef ENXIO - mapnum (ENXIO); -#endif -#ifdef E2BIG - mapnum (E2BIG); -#endif -#ifdef ENOEXEC - mapnum (ENOEXEC); -#endif -#ifdef ECHILD - mapnum (ECHILD); -#endif -#ifdef ENOTBLK - mapnum (ENOTBLK); -#endif -#ifdef EXDEV - mapnum (EXDEV); -#endif -#ifdef EFBIG - mapnum (EFBIG); -#endif -#ifdef ESPIPE - mapnum (ESPIPE); -#endif -#ifdef EMLINK - mapnum (EMLINK); -#endif -#ifdef EDOM - mapnum (EDOM); -#endif -#ifdef ERANGE - mapnum (ERANGE); -#endif - - default: - err = 999; - } - return strerror(err); -} - -#undef mapnum - - -/* required for portable fgetpos/fsetpos, - * use as - * XF86fpos_t* pos = xalloc(xf86fpossize()); - */ -long -xf86fpossize() -{ - return sizeof(fpos_t); -} - -int -xf86fgetpos(XF86FILE* f,XF86fpos_t* pos) -{ - XF86FILE_priv* fp = (XF86FILE_priv*)f; - fpos_t *ppos = (fpos_t*)pos; - - _xf86checkhndl(fp,"xf86fgetpos"); -#ifndef ISC - return fgetpos(fp->filehnd,ppos); -#else - *ppos = ftell(fp->filehnd); - if (*ppos < 0L) - return(-1); - return(0); -#endif -} - -int -xf86fsetpos(XF86FILE* f,const XF86fpos_t* pos) -{ - XF86FILE_priv* fp = (XF86FILE_priv*)f; - fpos_t *ppos = (fpos_t*)pos; - - /* XXX need to handle xf86errno here */ - _xf86checkhndl(fp,"xf86fsetpos"); -#ifndef ISC - return fsetpos(fp->filehnd,ppos); -#else - if (ppos == NULL) - { - errno = EINVAL; - return EOF; - } - return fseek(fp->filehnd, *ppos, SEEK_SET); -#endif -} - -void -xf86perror(const char *s) -{ - perror(s); -} - -int -xf86remove(const char *s) -{ -#ifdef _POSIX_SOURCE - return remove(s); -#else - return unlink(s); -#endif -} - -int -xf86rename(const char *old, const char *new) -{ -#ifdef _POSIX_SOURCE - return rename(old,new); -#else - int ret = link(old,new); - if (!ret) { - ret = unlink(old); - if (ret) unlink(new); - } else - ret = unlink(new); - return ret; -#endif -} - -void -xf86rewind(XF86FILE* f) -{ - XF86FILE_priv* fp = (XF86FILE_priv*)f; - - _xf86checkhndl(fp,"xf86fsetpos"); - rewind(fp->filehnd); -} - -void -xf86clearerr(XF86FILE* f) -{ - XF86FILE_priv* fp = (XF86FILE_priv*)f; - - _xf86checkhndl(fp,"xf86clearerr"); - clearerr(fp->filehnd); -} - -int -xf86feof(XF86FILE* f) -{ - XF86FILE_priv* fp = (XF86FILE_priv*)f; - - _xf86checkhndl(fp,"xf86feof"); - return feof(fp->filehnd); -} - -int -xf86ferror(XF86FILE* f) -{ - XF86FILE_priv* fp = (XF86FILE_priv*)f; - - _xf86checkhndl(fp,"xf86ferror"); - return ferror(fp->filehnd); -} - -XF86FILE* -xf86freopen(const char* fname,const char* mode,XF86FILE* fold) -{ - XF86FILE_priv* fp = (XF86FILE_priv*)fold; - FILE *fnew; - - _xf86checkhndl(fp,"xf86freopen"); - fnew = freopen(fname,mode,fp->filehnd); - xf86errno = xf86GetErrno(); - if (!fnew) { - xf86fclose(fold); /* discard old XF86FILE structure */ - return 0; - } - /* recycle the old XF86FILE structure */ - fp->magic = XF86FILE_magic; - fp->filehnd = fnew; - fp->fileno = fileno(fnew); - fp->fname = xf86strdup(fname); -#ifdef DEBUG - ErrorF("xf86freopen(%s,%s,%p) yields FILE %p XF86FILE %p\n", - fname,mode,fold,fnew,fp); -#endif - return (XF86FILE*)fp; -} - -int -xf86setbuf(XF86FILE* f, char *buf) -{ - XF86FILE_priv* fp = (XF86FILE_priv*)f; - - _xf86checkhndl(fp,"xf86fsetbuf"); -#ifdef SETBUF_RETURNS_INT - return setbuf(fp->filehnd, buf); -#else - setbuf(fp->filehnd, buf); - return 0; -#endif -} - -int -xf86setvbuf(XF86FILE* f, char *buf, int mode, xf86size_t size) -{ - XF86FILE_priv* fp = (XF86FILE_priv*)f; - int vbufmode; - - _xf86checkhndl(fp,"xf86fsetvbuf"); - - switch (mode) { - case XF86_IONBF: - vbufmode = _IONBF; - break; - case XF86_IOLBF: - vbufmode = _IOFBF; - break; - case XF86_IOFBF: - vbufmode = _IOLBF; - break; - default: - FatalError("libc_wrapper error: mode in setvbuf incorrect"); - exit(42); - } - - return setvbuf(fp->filehnd,buf,vbufmode,(size_t)size); -} - -XF86FILE* -xf86tmpfile(void) -{ -#ifdef NEED_TMPFILE - return xf86fopen(tmpnam((char*)0),"w+"); -#else - XF86FILE_priv* fp; - FILE *f = tmpfile(); - xf86errno = xf86GetErrno(); - if (!f) return 0; - - fp = xalloc(sizeof(XF86FILE_priv)); - fp->magic = XF86FILE_magic; - fp->filehnd = f; - fp->fileno = fileno(f); - fp->fname = xf86strdup("*tmpfile*"); /* so that it can be xfree()'d */ -#ifdef DEBUG - ErrorF("xf86tmpfile() yields FILE %p XF86FILE %p\n",f,fp); -#endif - return (XF86FILE*)fp; -} -#endif /* HAS_TMPFILE */ - - -int -xf86ungetc(int c,XF86FILE* f) -{ - XF86FILE_priv* fp = (XF86FILE_priv*)f; - - _xf86checkhndl(fp,"xf86ungetc"); - return ungetc(c,fp->filehnd); -} - -/* Misc functions. Some are ANSI C, some are not. */ - -void -xf86usleep(usec) - unsigned long usec; -{ -#if (defined(SYSV) || defined(SVR4)) && !defined(sun) - syscall(3112, (usec) / 1000 + 1); -#else - usleep(usec); -#endif -} - -void -xf86getsecs(long * secs, long * usecs) -{ - struct timeval tv; - - X_GETTIMEOFDAY(&tv); - if (secs) - *secs = tv.tv_sec; - if (usecs) - *usecs= tv.tv_usec; - - return; -} - -int -xf86ffs(int mask) -{ - int n; - if (mask == 0) return 0; - for (n = 1; (mask & 1)==0; n++) - mask >>= 1; - return n; -} - -char * -xf86getenv(const char * a) -{ - /* Only allow this when the real and effective uids are the same */ - if (getuid() != geteuid()) - return NULL; - else - return(getenv(a)); -} - -void * -xf86bsearch(const void *key, const void *base, xf86size_t nmemb, - xf86size_t size, int (*compar)(const void *, const void *)) -{ - return bsearch(key, base, (size_t)nmemb, (size_t)size, compar); -} - -int -xf86execl(const char *pathname, const char *arg, ...) -{ -#ifndef __UNIXOS2__ - int i; - pid_t pid; - int exit_status; - char *arglist[5]; - va_list args; - va_start(args, arg); - arglist[0] = (char*)&args; - i = 1; - while (i < 5 && (arglist[i++] = va_arg(args, char *)) != NULL) - ; - va_end(args); - - if ((pid = fork()) < 0) { - ErrorF("Fork failed (%s)\n", strerror(errno)); - return -1; - } else if (pid == 0) { /* child */ - /* - * Make sure that the child doesn't inherit any I/O permissions it - * shouldn't have. It's better to put constraints on the development - * of a clock program than to give I/O permissions to a bogus program - * in someone's XF86Config file - */ -#ifndef SELF_CONTAINED_WRAPPER - xf86DisableIO(); -#endif - if (setuid(getuid()) == -1) { - ErrorF("xf86Execl: setuid() failed: %s\n", strerror(errno)); - exit(255); - } -#if !defined(SELF_CONTAINED_WRAPPER) - /* set stdin, stdout to the consoleFD, and leave stderr alone */ - for (i = 0; i < 2; i++) - { - if (xf86Info.consoleFd != i) - { - close(i); - dup(xf86Info.consoleFd); - } - } -#endif - - execv(pathname, arglist); - ErrorF("Exec failed for command \"%s\" (%s)\n", - pathname, strerror(errno)); - exit(255); - } - - /* parent */ - wait(&exit_status); - if (WIFEXITED(exit_status)) - { - switch (WEXITSTATUS(exit_status)) - { - case 0: /* OK */ - return 0; - case 255: /* exec() failed */ - return(255); - default: /* bad exit status */ - ErrorF("Program \"%s\" had bad exit status %d\n", - pathname, WEXITSTATUS(exit_status)); - return(WEXITSTATUS(exit_status)); - } - } - else if (WIFSIGNALED(exit_status)) - { - ErrorF("Program \"%s\" died on signal %d\n", - pathname, WTERMSIG(exit_status)); - return(WTERMSIG(exit_status)); - } -#ifdef WIFSTOPPED - else if (WIFSTOPPED(exit_status)) - { - ErrorF("Program \"%s\" stopped by signal %d\n", - pathname, WSTOPSIG(exit_status)); - return(WSTOPSIG(exit_status)); - } -#endif - else /* should never get to this point */ - { - ErrorF("Program \"%s\" has unknown exit condition\n", - pathname); - return(1); - } -#else - return(1); -#endif /* __UNIXOS2__ Disable this crazy business for now */ -} - -void -xf86abort(void) -{ - ErrorF("Module called abort() function\n"); - abort(); -} - -void -xf86exit(int ex) -{ - ErrorF("Module called exit() function with value=%d\n",ex); - exit(ex); -} - -/* directory handling functions */ -#define XF86DIR_magic 0x78666876 /* "xfhv" */ - -typedef struct _xf86_dir_ { - DIR *dir; - INT32 magic; - XF86DIRENT *dirent; -} XF86DIR_priv; - -static void -_xf86checkdirhndl(XF86DIR_priv* f,const char *func) -{ - if (!f || f->magic != XF86DIR_magic || !f->dir || !f->dirent) { - FatalError("libc_wrapper error: passed invalid DIR handle to %s", - func); - exit(42); - } -} - -XF86DIR * -xf86opendir(const char *name) -{ - XF86DIR_priv *dp; - DIR *dirp; - - dirp = opendir(name); - if (!dirp) - return (XF86DIR*)0; - - dp = xalloc(sizeof(XF86DIR_priv)); - dp->magic = XF86DIR_magic; /* This time I have this, Dirk! :-) */ - dp->dir = dirp; - dp->dirent = xalloc(sizeof(struct _xf86dirent)); - - return (XF86DIR*)dp; -} - -XF86DIRENT* -xf86readdir(XF86DIR* dirp) -{ - XF86DIR_priv* dp = (XF86DIR_priv*)dirp; - DIRENTRY *de; - XF86DIRENT* xde; - int sz; - - _xf86checkdirhndl(dp,"xf86readdir"); - - de = readdir(dp->dir); - if (!de) - return (XF86DIRENT*)0; - xde = dp->dirent; - sz = strlen(de->d_name); - strncpy(xde->d_name,de->d_name, sz>_XF86NAMELEN ? (_XF86NAMELEN+1) : (sz+1)); - xde->d_name[_XF86NAMELEN] = '\0'; /* be sure to have a 0 byte */ - return xde; -} - -void -xf86rewinddir(XF86DIR* dirp) -{ - XF86DIR_priv* dp = (XF86DIR_priv*)dirp; - - _xf86checkdirhndl(dp,"xf86readdir"); - rewinddir(dp->dir); -} - -int -xf86closedir(XF86DIR* dir) -{ - XF86DIR_priv* dp = (XF86DIR_priv*)dir; - int n; - - _xf86checkdirhndl(dp,"xf86readdir"); - - n = closedir(dp->dir); - dp->magic = 0; - xfree(dp->dirent); - xfree(dp); - - return n; -} - -static mode_t -xfToOsChmodMode(xf86mode_t xfmode) -{ - mode_t mode = 0; - - if (xfmode & XF86_S_ISUID) mode |= S_ISUID; - if (xfmode & XF86_S_ISGID) mode |= S_ISGID; -#ifndef __UNIXOS2__ - if (xfmode & XF86_S_ISVTX) mode |= S_ISVTX; -#endif - if (xfmode & XF86_S_IRUSR) mode |= S_IRUSR; - if (xfmode & XF86_S_IWUSR) mode |= S_IWUSR; - if (xfmode & XF86_S_IXUSR) mode |= S_IXUSR; - if (xfmode & XF86_S_IRGRP) mode |= S_IRGRP; - if (xfmode & XF86_S_IWGRP) mode |= S_IWGRP; - if (xfmode & XF86_S_IXGRP) mode |= S_IXGRP; - if (xfmode & XF86_S_IROTH) mode |= S_IROTH; - if (xfmode & XF86_S_IWOTH) mode |= S_IWOTH; - if (xfmode & XF86_S_IXOTH) mode |= S_IXOTH; - - return mode; -} - -int -xf86chmod(const char *path, xf86mode_t xfmode) -{ - mode_t mode = xfToOsChmodMode(xfmode); - int rc = chmod(path, mode); - - xf86errno = xf86GetErrno(); - return rc; -} - -int -xf86chown(const char *path, xf86uid_t owner, xf86gid_t group) -{ -#ifndef __UNIXOS2__ - int rc = chown(path, owner, group); -#else - int rc = 0; -#endif - xf86errno = xf86GetErrno(); - return rc; -} - -xf86uid_t -xf86geteuid(void) -{ - return geteuid(); -} - -xf86gid_t -xf86getegid(void) -{ - return getegid(); -} - -int -xf86getpid(void) -{ - return getpid(); -} - -static mode_t -xfToOsMknodMode(xf86mode_t xfmode) -{ - mode_t mode = xfToOsChmodMode(xfmode); - - if (xfmode & XF86_S_IFREG) mode |= S_IFREG; - if (xfmode & XF86_S_IFCHR) mode |= S_IFCHR; -#ifndef __UNIXOS2__ - if (xfmode & XF86_S_IFBLK) mode |= S_IFBLK; -#endif - if (xfmode & XF86_S_IFIFO) mode |= S_IFIFO; - - return mode; -} - -int xf86mknod(const char *pathname, xf86mode_t xfmode, xf86dev_t dev) -{ - mode_t mode = xfToOsMknodMode(xfmode); -#ifndef __UNIXOS2__ - int rc = mknod(pathname, mode, dev); -#else - int rc = 0; -#endif - xf86errno = xf86GetErrno(); - return rc; -} - -unsigned int xf86sleep(unsigned int seconds) -{ - return sleep(seconds); -} - -int xf86mkdir(const char *pathname, xf86mode_t xfmode) -{ - mode_t mode = xfToOsChmodMode(xfmode); - int rc = mkdir(pathname, mode); - - xf86errno = xf86GetErrno(); - return rc; -} - - -/* Several math functions */ - -int -xf86abs(int x) -{ - return abs(x); -} - -double -xf86acos(double x) -{ - return acos(x); -} - -double -xf86asin(double x) -{ - return asin(x); -} - -double -xf86atan(double x) -{ - return atan(x); -} - -double -xf86atan2(double x,double y) -{ - return atan2(x,y); -} - -double -xf86atof(const char* s) -{ - return atof(s); -} - -int -xf86atoi(const char* s) -{ - return atoi(s); -} - -long -xf86atol(const char* s) -{ - return atol(s); -} - -double -xf86ceil(double x) -{ - return ceil(x); -} - -double -xf86cos(double x) -{ - return(cos(x)); -} - -double -xf86exp(double x) -{ - return(exp(x)); -} - -double -xf86fabs(double x) -{ - return(fabs(x)); -} - -int -xf86finite(double x) -{ -#ifndef QNX4 -#ifndef __UNIXOS2__ - return(finite(x)); -#else - return(isfinite(x)); -#endif /* __UNIXOS2__ */ -#else - /* XXX Replace this with something that really works. */ - return 1; -#endif -} - -double -xf86floor(double x) -{ - return floor(x); -} - -double -xf86fmod(double x,double y) -{ - return fmod(x,y); -} - -long -xf86labs(long x) -{ - return labs(x); -} - -double -xf86ldexp(double x, int exp) -{ - return ldexp(x, exp); -} - -double -xf86log(double x) -{ - return(log(x)); -} - -double -xf86log10(double x) -{ - return(log10(x)); -} - -double -xf86modf(double x,double* y) -{ - return modf(x,y); -} - -double -xf86pow(double x, double y) -{ - return(pow(x,y)); -} - -double -xf86sin(double x) -{ - return sin(x); -} - -double -xf86sqrt(double x) -{ - return(sqrt(x)); -} - -double -xf86strtod(const char *s, char **end) -{ - return strtod(s,end); -} - -long -xf86strtol(const char *s, char **end, int radix) -{ - return strtol(s,end,radix); -} - -unsigned long -xf86strtoul(const char *s, char **end,int radix) -{ - return strtoul(s,end,radix); -} - -double -xf86tan(double x) -{ - return tan(x); -} - -/* memory functions */ -void* -xf86memchr(const void* s, int c, xf86size_t n) -{ - return memchr(s,c,(size_t)n); -} - -int -xf86memcmp(const void* s1, const void* s2, xf86size_t n) -{ - return(memcmp(s1,s2,(size_t)n)); -} - -void* -xf86memcpy(void* dest, const void* src, xf86size_t n) -{ - return(memcpy(dest,src,(size_t)n)); -} - -void* -xf86memmove(void* dest, const void* src, xf86size_t n) -{ - return(memmove(dest,src,(size_t)n)); -} - -void* -xf86memset(void* s, int c, xf86size_t n) -{ - return(memset(s,c,(size_t)n)); -} - -/* ctype functions */ - -int -xf86isalnum(int c) -{ - return isalnum(c) ? 1 : 0; -} - -int -xf86isalpha(int c) -{ - return isalpha(c) ? 1 : 0; -} - -int -xf86iscntrl(int c) -{ - return iscntrl(c) ? 1 : 0; -} - -int -xf86isdigit(int c) -{ - return isdigit(c) ? 1 : 0; -} - -int -xf86isgraph(int c) -{ - return isgraph(c) ? 1 : 0; -} - -int -xf86islower(int c) -{ - return islower(c) ? 1 : 0; -} - -int -xf86isprint(int c) -{ - return isprint(c) ? 1 : 0; -} - -int -xf86ispunct(int c) -{ - return ispunct(c) ? 1 : 0; -} - -int -xf86isspace(int c) -{ - return isspace(c) ? 1 : 0; -} - -int -xf86isupper(int c) -{ - return isupper(c) ? 1 : 0; -} - -int -xf86isxdigit(int c) -{ - return isxdigit(c) ? 1 : 0; -} - -int -xf86tolower(int c) -{ - return tolower(c); -} - -int -xf86toupper(int c) -{ - return toupper(c); -} - -/* memory allocation functions */ -void* -xf86calloc(xf86size_t sz,xf86size_t n) -{ - return xcalloc(sz, n); -} - -void -xf86free(void* p) -{ - xfree(p); -} - -double -xf86frexp(double x, int *exp) -{ - return frexp(x, exp); -} - -void* -xf86malloc(xf86size_t n) -{ - return xalloc(n); -} - -void* -xf86realloc(void* p, xf86size_t n) -{ - return xrealloc(p,n); -} - -/* - * XXX This probably doesn't belong here. - */ -int -xf86getpagesize() -{ - static int pagesize = -1; - - if (pagesize != -1) - return pagesize; - -#if defined(_SC_PAGESIZE) || defined(HAS_SC_PAGESIZE) - pagesize = sysconf(_SC_PAGESIZE); -#endif -#ifdef _SC_PAGE_SIZE - if (pagesize == -1) - pagesize = sysconf(_SC_PAGE_SIZE); -#endif -#ifdef HAS_GETPAGESIZE - if (pagesize == -1) - pagesize = getpagesize(); -#endif -#ifdef PAGE_SIZE - if (pagesize == -1) - pagesize = PAGE_SIZE; -#endif - if (pagesize == -1) - FatalError("xf86getpagesize: Cannot determine page size"); - - return pagesize; -} - - -#define mapnum(e) case (e): return (xf86_##e) - -int -xf86GetErrno () -{ - switch (errno) - { - case 0: return 0; - mapnum (EACCES); - mapnum (EAGAIN); - mapnum (EBADF); - mapnum (EEXIST); - mapnum (EFAULT); - mapnum (EINTR); - mapnum (EINVAL); - mapnum (EISDIR); - mapnum (ELOOP); /* not POSIX 1 */ - mapnum (EMFILE); - mapnum (ENAMETOOLONG); - mapnum (ENFILE); - mapnum (ENOENT); - mapnum (ENOMEM); - mapnum (ENOSPC); - mapnum (ENOTDIR); - mapnum (EPIPE); - mapnum (EROFS); -#ifndef __UNIXOS2__ - mapnum (ETXTBSY); /* not POSIX 1 */ -#endif - mapnum (ENOTTY); -#ifdef ENOSYS - mapnum (ENOSYS); -#endif - mapnum (EBUSY); - mapnum (ENODEV); - mapnum (EIO); -#ifdef ESRCH - mapnum (ESRCH); -#endif -#ifdef ENXIO - mapnum (ENXIO); -#endif -#ifdef E2BIG - mapnum (E2BIG); -#endif -#ifdef ENOEXEC - mapnum (ENOEXEC); -#endif -#ifdef ECHILD - mapnum (ECHILD); -#endif -#ifdef ENOTBLK - mapnum (ENOTBLK); -#endif -#ifdef EXDEV - mapnum (EXDEV); -#endif -#ifdef EFBIG - mapnum (EFBIG); -#endif -#ifdef ESPIPE - mapnum (ESPIPE); -#endif -#ifdef EMLINK - mapnum (EMLINK); -#endif -#ifdef EDOM - mapnum (EDOM); -#endif -#ifdef ERANGE - mapnum (ERANGE); -#endif - default: - return (xf86_UNKNOWN); - } -} - -#undef mapnum - - - -#ifdef HAVE_SYSV_IPC - -int -xf86shmget(xf86key_t key, int size, int xf86shmflg) -{ - int shmflg; - int ret; - - /* This copies the permissions (SHM_R, SHM_W for u, g, o). */ - shmflg = xf86shmflg & 0777; - - if (key == XF86IPC_PRIVATE) key = IPC_PRIVATE; - - if (xf86shmflg & XF86IPC_CREAT) shmflg |= IPC_CREAT; - if (xf86shmflg & XF86IPC_EXCL) shmflg |= IPC_EXCL; - if (xf86shmflg & XF86IPC_NOWAIT) shmflg |= IPC_NOWAIT; - ret = shmget((key_t) key, size, shmflg); - - if (ret == -1) - xf86errno = xf86GetErrno(); - - return ret; -} - -char * -xf86shmat(int id, char *addr, int xf86shmflg) -{ - int shmflg = 0; - pointer ret; - -#ifdef SHM_RDONLY - if (xf86shmflg & XF86SHM_RDONLY) shmflg |= SHM_RDONLY; -#endif -#ifdef SHM_RND - if (xf86shmflg & XF86SHM_RND) shmflg |= SHM_RND; -#endif -#ifdef SHM_REMAP - if (xf86shmflg & XF86SHM_REMAP) shmflg |= SHM_REMAP; -#endif - - ret = shmat(id,addr,shmflg); - - if (ret == (pointer) -1) - xf86errno = xf86GetErrno(); - - return ret; -} - -int -xf86shmdt(char *addr) -{ - int ret; - - ret = shmdt(addr); - - if (ret == -1) - xf86errno = xf86GetErrno(); - - return ret; -} - -/* - * for now only implement the rmid command. - */ -int -xf86shmctl(int id, int xf86cmd, pointer buf) -{ - int cmd; - int ret; - - switch (xf86cmd) { - case XF86IPC_RMID: - cmd = IPC_RMID; - break; - default: - return 0; - } - - ret = shmctl(id, cmd, buf); - - if (ret == -1) - xf86errno = xf86GetErrno(); - - return ret; -} -#else - -int -xf86shmget(xf86key_t key, int size, int xf86shmflg) -{ - xf86errno = ENOSYS; - - return -1; -} - -char * -xf86shmat(int id, char *addr, int xf86shmflg) -{ - xf86errno = ENOSYS; - - return (char *)-1; -} - -int -xf86shmctl(int id, int xf86cmd, pointer buf) -{ - xf86errno = ENOSYS; - - return -1; -} - -int -xf86shmdt(char *addr) -{ - xf86errno = ENOSYS; - - return -1; -} -#endif /* HAVE_SYSV_IPC */ - -int -xf86getjmptype() -{ -#ifdef HAS_GLIBC_SIGSETJMP - return 1; -#else - return 0; -#endif -} - -#ifdef HAS_GLIBC_SIGSETJMP - -int -xf86setjmp(xf86jmp_buf env) -{ -#if defined(__GLIBC__) && (__GLIBC__ >= 2) - return __sigsetjmp((void *)env, xf86setjmp1_arg2()); -#else - return xf86setjmp1(env, xf86setjmp1_arg2()); -#endif -} - -int -xf86setjmp0(xf86jmp_buf env) -{ - FatalError("setjmp: type 0 called instead of type %d", xf86getjmptype()); -} - -#if !defined(__GLIBC__) || (__GLIBC__ < 2) /* libc5 */ - -int -xf86setjmp1(xf86jmp_buf env, int arg2) -{ - __sigjmp_save((void *)env, arg2); - return __setjmp((void *)env); -} - -#endif - -#else /* HAS_GLIBC_SIGSETJMP */ - -int -xf86setjmp1(xf86jmp_buf env, int arg2) -{ - FatalError("setjmp: type 1 called instead of type %d", xf86getjmptype()); -} - -int -xf86setjmp0(xf86jmp_buf env) -{ - return setjmp((void *)env); -} - -#endif /* HAS_GLIBC_SIGSETJMP */ - -int -xf86setjmp1_arg2() -{ - return 1; -} - -int -xf86setjmperror(xf86jmp_buf env) -{ - FatalError("setjmp: don't know how to handle setjmp() type %d", - xf86getjmptype()); -} - diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/shared/pm_noop.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/shared/pm_noop.c deleted file mode 100644 index 6e24653ba..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/shared/pm_noop.c +++ /dev/null @@ -1,48 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/pm_noop.c,v 1.2 2003/08/24 17:37:06 dawes Exp $ */ -/* - * Copyright (c) 2000 by The XFree86 Project, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the copyright holder(s) - * and author(s) shall not be used in advertising or otherwise to promote - * the sale, use or other dealings in this Software without prior written - * authorization from the copyright holder(s) and author(s). - */ - -/* Stubs for the OS-support layer power-management functions. */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include "os.h" -#include "xf86.h" -#include "xf86Priv.h" -#define XF86_OS_PRIVS -#include "xf86_OSproc.h" - -PMClose -xf86OSPMOpen(void) -{ - return NULL; -} - - diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/shared/posix_tty.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/shared/posix_tty.c deleted file mode 100644 index be3703944..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/shared/posix_tty.c +++ /dev/null @@ -1,689 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/posix_tty.c,v 3.30 2003/08/24 17:37:06 dawes Exp $ */ -/* - * Copyright 1993-2003 by The XFree86 Project, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF - * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - * Except as contained in this notice, the name of the XFree86 Project shall - * not be used in advertising or otherwise to promote the sale, use or other - * dealings in this Software without prior written authorization from the - * XFree86 Project. - */ -/* - * - * Copyright (c) 1997 Metro Link Incorporated - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF - * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - * Except as contained in this notice, the name of the Metro Link shall not be - * used in advertising or otherwise to promote the sale, use or other dealings - * in this Software without prior written authorization from Metro Link. - * - */ - -/* $XConsortium: posix_tty.c /main/7 1996/10/19 18:07:47 kaleb $ */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" - -static int -GetBaud (int baudrate) -{ -#ifdef B300 - if (baudrate == 300) - return B300; -#endif -#ifdef B1200 - if (baudrate == 1200) - return B1200; -#endif -#ifdef B2400 - if (baudrate == 2400) - return B2400; -#endif -#ifdef B4800 - if (baudrate == 4800) - return B4800; -#endif -#ifdef B9600 - if (baudrate == 9600) - return B9600; -#endif -#ifdef B19200 - if (baudrate == 19200) - return B19200; -#endif -#ifdef B38400 - if (baudrate == 38400) - return B38400; -#endif -#ifdef B57600 - if (baudrate == 57600) - return B57600; -#endif -#ifdef B115200 - if (baudrate == 115200) - return B115200; -#endif -#ifdef B230400 - if (baudrate == 230400) - return B230400; -#endif -#ifdef B460800 - if (baudrate == 460800) - return B460800; -#endif - return (0); -} - -int -xf86OpenSerial (pointer options) -{ -#ifdef Lynx - struct sgttyb ms_sgtty; -#endif - struct termios t; - int fd, i; - char *dev; - - dev = xf86SetStrOption (options, "Device", NULL); - if (!dev) - { - xf86Msg (X_ERROR, "xf86OpenSerial: No Device specified.\n"); - return (-1); - } - - SYSCALL (fd = open (dev, O_RDWR | O_NONBLOCK)); - if (fd == -1) - { - xf86Msg (X_ERROR, - "xf86OpenSerial: Cannot open device %s\n\t%s.\n", - dev, strerror (errno)); - xfree(dev); - return (-1); - } - - if (!isatty (fd)) - { -#if 1 - /* Allow non-tty devices to be opened. */ - xfree(dev); - return (fd); -#else - xf86Msg (X_WARNING, - "xf86OpenSerial: Specified device %s is not a tty\n", - dev); - SYSCALL (close (fd)); - errno = EINVAL; - xfree(dev); - return (-1); -#endif - } - -#ifdef Lynx - /* LynxOS does not assert DTR without this */ - ioctl (fd, TIOCGETP, (char *) &ms_sgtty); - ioctl (fd, TIOCSDTR, (char *) &ms_sgtty); -#endif - - /* set up default port parameters */ - SYSCALL (tcgetattr (fd, &t)); - t.c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP|INLCR\ - |IGNCR|ICRNL|IXON); - t.c_oflag &= ~OPOST; - t.c_lflag &= ~(ECHO|ECHONL|ICANON|ISIG|IEXTEN); - t.c_cflag &= ~(CSIZE|PARENB); - t.c_cflag |= CS8|CLOCAL; - - cfsetispeed (&t, B9600); - cfsetospeed (&t, B9600); - t.c_cc[VMIN] = 1; - t.c_cc[VTIME] = 0; - - SYSCALL (tcsetattr (fd, TCSANOW, &t)); - - if (xf86SetSerial (fd, options) == -1) - { - SYSCALL (close (fd)); - xfree(dev); - return (-1); - } - - SYSCALL (i = fcntl (fd, F_GETFL, 0)); - if (i == -1) - { - SYSCALL (close (fd)); - xfree(dev); - return (-1); - } - i &= ~O_NONBLOCK; - SYSCALL (i = fcntl (fd, F_SETFL, i)); - if (i == -1) - { - SYSCALL (close (fd)); - xfree(dev); - return (-1); - } - xfree(dev); - return (fd); -} - -int -xf86SetSerial (int fd, pointer options) -{ - struct termios t; - int val; - const char *s; - int baud, r; - - if (fd < 0) - return -1; - - /* Don't try to set parameters for non-tty devices. */ - if (!isatty(fd)) - return 0; - - SYSCALL (tcgetattr (fd, &t)); - - if ((val = xf86SetIntOption (options, "BaudRate", 0))) - { - if ((baud = GetBaud (val))) - { - cfsetispeed (&t, baud); - cfsetospeed (&t, baud); - } - else - { - xf86Msg (X_ERROR, - "Invalid Option BaudRate value: %d\n", val); - return (-1); - } - } - - if ((val = xf86SetIntOption (options, "StopBits", 0))) - { - switch (val) - { - case 1: - t.c_cflag &= ~(CSTOPB); - break; - case 2: - t.c_cflag |= CSTOPB; - break; - default: - xf86Msg (X_ERROR, - "Invalid Option StopBits value: %d\n", val); - return (-1); - break; - } - } - - if ((val = xf86SetIntOption (options, "DataBits", 0))) - { - switch (val) - { - case 5: - t.c_cflag &= ~(CSIZE); - t.c_cflag |= CS5; - break; - case 6: - t.c_cflag &= ~(CSIZE); - t.c_cflag |= CS6; - break; - case 7: - t.c_cflag &= ~(CSIZE); - t.c_cflag |= CS7; - break; - case 8: - t.c_cflag &= ~(CSIZE); - t.c_cflag |= CS8; - break; - default: - xf86Msg (X_ERROR, - "Invalid Option DataBits value: %d\n", val); - return (-1); - break; - } - } - - if ((s = xf86SetStrOption (options, "Parity", NULL))) - { - if (xf86NameCmp (s, "Odd") == 0) - { - t.c_cflag |= PARENB | PARODD; - } - else if (xf86NameCmp (s, "Even") == 0) - { - t.c_cflag |= PARENB; - t.c_cflag &= ~(PARODD); - } - else if (xf86NameCmp (s, "None") == 0) - { - t.c_cflag &= ~(PARENB); - } - else - { - xf86Msg (X_ERROR, "Invalid Option Parity value: %s\n", - s); - return (-1); - } - } - - if ((val = xf86SetIntOption (options, "Vmin", -1)) != -1) - { - t.c_cc[VMIN] = val; - } - if ((val = xf86SetIntOption (options, "Vtime", -1)) != -1) - { - t.c_cc[VTIME] = val; - } - - if ((s = xf86SetStrOption (options, "FlowControl", NULL))) - { - xf86MarkOptionUsedByName (options, "FlowControl"); - if (xf86NameCmp (s, "Xoff") == 0) - { - t.c_iflag |= IXOFF; - } - else if (xf86NameCmp (s, "Xon") == 0) - { - t.c_iflag |= IXON; - } - else if (xf86NameCmp (s, "XonXoff") == 0) - { - t.c_iflag |= IXON|IXOFF; - } - else if (xf86NameCmp (s, "None") == 0) - { - t.c_iflag &= ~(IXON | IXOFF); - } - else - { - xf86Msg (X_ERROR, - "Invalid Option FlowControl value: %s\n", s); - return (-1); - } - } - - if ((xf86SetBoolOption (options, "ClearDTR", FALSE))) - { -#ifdef CLEARDTR_SUPPORT -# if !defined(Lynx) || defined(TIOCMBIC) - val = TIOCM_DTR; - SYSCALL (ioctl(fd, TIOCMBIC, &val)); -# else - SYSCALL (ioctl(fd, TIOCCDTR, NULL)); -# endif -#else - xf86Msg (X_WARNING, - "Option ClearDTR not supported on this OS\n"); - return (-1); -#endif - xf86MarkOptionUsedByName (options, "ClearDTR"); - } - - if ((xf86SetBoolOption (options, "ClearRTS", FALSE))) - { -#ifdef CLEARRTS_SUPPORT - val = TIOCM_RTS; - SYSCALL (ioctl(fd, TIOCMBIC, &val)); -#else - xf86Msg (X_WARNING, - "Option ClearRTS not supported on this OS\n"); - return (-1); -#endif - xf86MarkOptionUsedByName (options, "ClearRTS"); - } - - SYSCALL (r = tcsetattr (fd, TCSANOW, &t)); - return (r); -} - -int -xf86SetSerialSpeed (int fd, int speed) -{ - struct termios t; - int baud, r; - - if (fd < 0) - return -1; - - /* Don't try to set parameters for non-tty devices. */ - if (!isatty(fd)) - return 0; - - SYSCALL (tcgetattr (fd, &t)); - - if ((baud = GetBaud (speed))) - { - cfsetispeed (&t, baud); - cfsetospeed (&t, baud); - } - else - { - xf86Msg (X_ERROR, - "Invalid Option BaudRate value: %d\n", speed); - return (-1); - } - - SYSCALL (r = tcsetattr (fd, TCSANOW, &t)); - return (r); -} - -int -xf86ReadSerial (int fd, void *buf, int count) -{ - int r; -#ifdef DEBUG - int i; -#endif - SYSCALL (r = read (fd, buf, count)); -#ifdef DEBUG - ErrorF("ReadingSerial: 0x%x", - (unsigned char)*(((unsigned char *)buf))); - for (i = 1; i < r; i++) - ErrorF(", 0x%x",(unsigned char)*(((unsigned char *)buf) + i)); - ErrorF("\n"); -#endif - return (r); -} - -int -xf86WriteSerial (int fd, const void *buf, int count) -{ - int r; -#ifdef DEBUG - int i; - - ErrorF("WritingSerial: 0x%x",(unsigned char)*(((unsigned char *)buf))); - for (i = 1; i < count; i++) - ErrorF(", 0x%x",(unsigned char)*(((unsigned char *)buf) + i)); - ErrorF("\n"); -#endif - SYSCALL (r = write (fd, buf, count)); - return (r); -} - -int -xf86CloseSerial (int fd) -{ - int r; - - SYSCALL (r = close (fd)); - return (r); -} - -int -xf86WaitForInput (int fd, int timeout) -{ - fd_set readfds; - struct timeval to; - int r; - - FD_ZERO(&readfds); - - if (fd >= 0) { - FD_SET(fd, &readfds); - } - - to.tv_sec = timeout / 1000000; - to.tv_usec = timeout % 1000000; - - if (fd >= 0) { - SYSCALL (r = select (FD_SETSIZE, &readfds, NULL, NULL, &to)); - } - else { - SYSCALL (r = select (FD_SETSIZE, NULL, NULL, NULL, &to)); - } - xf86ErrorFVerb (9,"select returned %d\n", r); - return (r); -} - -int -xf86SerialSendBreak (int fd, int duration) -{ - int r; - - SYSCALL (r = tcsendbreak (fd, duration)); - return (r); - -} - -int -xf86FlushInput(int fd) -{ - fd_set fds; - struct timeval timeout; - char c[4]; - -#ifdef DEBUG - ErrorF("FlushingSerial\n"); -#endif - if (tcflush(fd, TCIFLUSH) == 0) - return 0; - - timeout.tv_sec = 0; - timeout.tv_usec = 0; - FD_ZERO(&fds); - FD_SET(fd, &fds); - while (select(FD_SETSIZE, &fds, NULL, NULL, &timeout) > 0) { - if (read(fd, &c, sizeof(c)) < 1) - return 0; - FD_ZERO(&fds); - FD_SET(fd, &fds); - } - return 0; -} - -static struct states { - int xf; - int os; -} modemStates[] = { -#ifdef TIOCM_LE - { XF86_M_LE, TIOCM_LE }, -#endif -#ifdef TIOCM_DTR - { XF86_M_DTR, TIOCM_DTR }, -#endif -#ifdef TIOCM_RTS - { XF86_M_RTS, TIOCM_RTS }, -#endif -#ifdef TIOCM_ST - { XF86_M_ST, TIOCM_ST }, -#endif -#ifdef TIOCM_SR - { XF86_M_SR, TIOCM_SR }, -#endif -#ifdef TIOCM_CTS - { XF86_M_CTS, TIOCM_CTS }, -#endif -#ifdef TIOCM_CAR - { XF86_M_CAR, TIOCM_CAR }, -#elif defined(TIOCM_CD) - { XF86_M_CAR, TIOCM_CD }, -#endif -#ifdef TIOCM_RNG - { XF86_M_RNG, TIOCM_RNG }, -#elif defined(TIOCM_RI) - { XF86_M_CAR, TIOCM_RI }, -#endif -#ifdef TIOCM_DSR - { XF86_M_DSR, TIOCM_DSR }, -#endif -}; - -static int numStates = sizeof(modemStates) / sizeof(modemStates[0]); - -static int -xf2osState(int state) -{ - int i; - int ret = 0; - - for (i = 0; i < numStates; i++) - if (state & modemStates[i].xf) - ret |= modemStates[i].os; - return ret; -} - -static int -os2xfState(int state) -{ - int i; - int ret = 0; - - for (i = 0; i < numStates; i++) - if (state & modemStates[i].os) - ret |= modemStates[i].xf; - return ret; -} - -static int -getOsStateMask(void) -{ - int i; - int ret = 0; - for (i = 0; i < numStates; i++) - ret |= modemStates[i].os; - return ret; -} - -static int osStateMask = 0; - -int -xf86SetSerialModemState(int fd, int state) -{ - int ret; - int s; - - if (fd < 0) - return -1; - - /* Don't try to set parameters for non-tty devices. */ - if (!isatty(fd)) - return 0; - -#ifndef TIOCMGET - return -1; -#else - if (!osStateMask) - osStateMask = getOsStateMask(); - - state = xf2osState(state); - SYSCALL((ret = ioctl(fd, TIOCMGET, &s))); - if (ret < 0) - return -1; - s &= ~osStateMask; - s |= state; - SYSCALL((ret = ioctl(fd, TIOCMSET, &s))); - if (ret < 0) - return -1; - else - return 0; -#endif -} - -int -xf86GetSerialModemState(int fd) -{ - int ret; - int s; - - if (fd < 0) - return -1; - - /* Don't try to set parameters for non-tty devices. */ - if (!isatty(fd)) - return 0; - -#ifndef TIOCMGET - return -1; -#else - SYSCALL((ret = ioctl(fd, TIOCMGET, &s))); - if (ret < 0) - return -1; - return os2xfState(s); -#endif -} - -int -xf86SerialModemSetBits(int fd, int bits) -{ - int ret; - int s; - - if (fd < 0) - return -1; - - /* Don't try to set parameters for non-tty devices. */ - if (!isatty(fd)) - return 0; - -#ifndef TIOCMGET - return -1; -#else - s = xf2osState(bits); - SYSCALL((ret = ioctl(fd, TIOCMBIS, &s))); - return ret; -#endif -} - -int -xf86SerialModemClearBits(int fd, int bits) -{ - int ret; - int s; - - if (fd < 0) - return -1; - - /* Don't try to set parameters for non-tty devices. */ - if (!isatty(fd)) - return 0; - -#ifndef TIOCMGET - return -1; -#else - s = xf2osState(bits); - SYSCALL((ret = ioctl(fd, TIOCMBIC, &s))); - return ret; -#endif -} diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/shared/sigio.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/shared/sigio.c deleted file mode 100644 index e6da3940f..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/shared/sigio.c +++ /dev/null @@ -1,312 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/sigio.c,v 1.16 2003/09/04 00:21:17 dawes Exp $ */ - -/* sigio.c -- Support for SIGIO handler installation and removal - * Created: Thu Jun 3 15:39:18 1999 by faith@precisioninsight.com - * - * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Authors: Rickard E. (Rik) Faith - */ -/* - * Copyright (c) 2002 by The XFree86 Project, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the copyright holder(s) - * and author(s) shall not be used in advertising or otherwise to promote - * the sale, use or other dealings in this Software without prior written - * authorization from the copyright holder(s) and author(s). - */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#ifdef XFree86Server -# include -# include "xf86.h" -# include "xf86Priv.h" -# include "xf86_OSlib.h" -# include "inputstr.h" -#else -# include -# include -# include -# include -# include -# include -# include -# define SYSCALL(call) while(((call) == -1) && (errno == EINTR)) -#endif - -/* - * Linux libc5 defines FASYNC, but not O_ASYNC. Don't know if it is - * functional or not. - */ -#if defined(FASYNC) && !defined(O_ASYNC) -# define O_ASYNC FASYNC -#endif - -#ifdef MAX_DEVICES -/* MAX_DEVICES represents the maximimum number of input devices usable - * at the same time plus one entry for DRM support. - */ -# define MAX_FUNCS (MAX_DEVICES + 1) -#else -# define MAX_FUNCS 16 -#endif - -typedef struct _xf86SigIOFunc { - void (*f) (int, void *); - int fd; - void *closure; -} Xf86SigIOFunc; - -static Xf86SigIOFunc xf86SigIOFuncs[MAX_FUNCS]; -static int xf86SigIOMax; -static int xf86SigIOMaxFd; -static fd_set xf86SigIOMask; - -/* - * SIGIO gives no way of discovering which fd signalled, select - * to discover - */ -static void -xf86SIGIO (int sig) -{ - int i; - fd_set ready; - struct timeval to; - int r; - - ready = xf86SigIOMask; - to.tv_sec = 0; - to.tv_usec = 0; - SYSCALL (r = select (xf86SigIOMaxFd, &ready, 0, 0, &to)); - for (i = 0; r > 0 && i < xf86SigIOMax; i++) - if (xf86SigIOFuncs[i].f && FD_ISSET (xf86SigIOFuncs[i].fd, &ready)) - { - (*xf86SigIOFuncs[i].f)(xf86SigIOFuncs[i].fd, - xf86SigIOFuncs[i].closure); - r--; - } -#ifdef XFree86Server - if (r > 0) { - xf86Msg(X_ERROR, "SIGIO %d descriptors not handled\n", r); - } -#endif -} - -static int -xf86IsPipe (int fd) -{ - struct stat buf; - - if (fstat (fd, &buf) < 0) - return 0; - return S_ISFIFO(buf.st_mode); -} - -int -xf86InstallSIGIOHandler(int fd, void (*f)(int, void *), void *closure) -{ - struct sigaction sa; - struct sigaction osa; - int i; - int blocked; - - for (i = 0; i < MAX_FUNCS; i++) - { - if (!xf86SigIOFuncs[i].f) - { - if (xf86IsPipe (fd)) - return 0; - blocked = xf86BlockSIGIO(); - if (fcntl(fd, F_SETFL, fcntl(fd, F_GETFL) | O_ASYNC) == -1) { -#ifdef XFree86Server - xf86Msg(X_WARNING, "fcntl(%d, O_ASYNC): %s\n", - fd, strerror(errno)); -#else - fprintf(stderr,"fcntl(%d, O_ASYNC): %s\n", - fd, strerror(errno)); -#endif - xf86UnblockSIGIO(blocked); - return 0; - } - if (fcntl(fd, F_SETOWN, getpid()) == -1) { -#ifdef XFree86Server - xf86Msg(X_WARNING, "fcntl(%d, F_SETOWN): %s\n", - fd, strerror(errno)); -#else - fprintf(stderr,"fcntl(%d, F_SETOWN): %s\n", - fd, strerror(errno)); -#endif - xf86UnblockSIGIO(blocked); - return 0; - } - sigemptyset(&sa.sa_mask); - sigaddset(&sa.sa_mask, SIGIO); - sa.sa_flags = 0; - sa.sa_handler = xf86SIGIO; - sigaction(SIGIO, &sa, &osa); - xf86SigIOFuncs[i].fd = fd; - xf86SigIOFuncs[i].closure = closure; - xf86SigIOFuncs[i].f = f; - if (i >= xf86SigIOMax) - xf86SigIOMax = i+1; - if (fd >= xf86SigIOMaxFd) - xf86SigIOMaxFd = fd + 1; - FD_SET (fd, &xf86SigIOMask); - xf86UnblockSIGIO(blocked); - return 1; - } - /* Allow overwriting of the closure and callback */ - else if (xf86SigIOFuncs[i].fd == fd) - { - xf86SigIOFuncs[i].closure = closure; - xf86SigIOFuncs[i].f = f; - return 1; - } - } - return 0; -} - -int -xf86RemoveSIGIOHandler(int fd) -{ - struct sigaction sa; - struct sigaction osa; - int i; - int max; - int maxfd; - int ret; - - max = 0; - maxfd = -1; - ret = 0; - for (i = 0; i < MAX_FUNCS; i++) - { - if (xf86SigIOFuncs[i].f) - { - if (xf86SigIOFuncs[i].fd == fd) - { - xf86SigIOFuncs[i].f = 0; - xf86SigIOFuncs[i].fd = 0; - xf86SigIOFuncs[i].closure = 0; - FD_CLR (fd, &xf86SigIOMask); - ret = 1; - } - else - { - max = i + 1; - if (xf86SigIOFuncs[i].fd >= maxfd) - maxfd = xf86SigIOFuncs[i].fd + 1; - } - } - } - if (ret) - { - fcntl(fd, F_SETFL, fcntl(fd, F_GETFL) & ~O_ASYNC); - xf86SigIOMax = max; - xf86SigIOMaxFd = maxfd; - if (!max) - { - sigemptyset(&sa.sa_mask); - sigaddset(&sa.sa_mask, SIGIO); - sa.sa_flags = 0; - sa.sa_handler = SIG_DFL; - sigaction(SIGIO, &sa, &osa); - } - } - return ret; -} - -int -xf86BlockSIGIO (void) -{ - sigset_t set, old; - int ret; - - sigemptyset (&set); - sigaddset (&set, SIGIO); - sigprocmask (SIG_BLOCK, &set, &old); - ret = sigismember (&old, SIGIO); -#ifdef DEBUG - ErrorF("%i = xf86BlockSIGIO()\n",ret); -#endif - return ret; -} - -void -xf86UnblockSIGIO (int wasset) -{ - sigset_t set; -#ifdef DEBUG - ErrorF("xf86UnblockSIGIO(%i)\n",wasset); -#endif - - if (!wasset) - { - sigemptyset (&set); - sigaddset (&set, SIGIO); - sigprocmask (SIG_UNBLOCK, &set, NULL); - } -} - -#ifdef XFree86Server -void -xf86AssertBlockedSIGIO (char *where) -{ - sigset_t set, old; - - sigemptyset (&set); - sigprocmask (SIG_BLOCK, &set, &old); - if (!sigismember (&old, SIGIO)) - xf86Msg (X_ERROR, "SIGIO not blocked at %s\n", where); -} - -/* XXX This is a quick hack for the benefit of xf86SetSilkenMouse() */ - -int -xf86SIGIOSupported (void) -{ - return 1; -} - -#endif diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/shared/sigiostubs.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/shared/sigiostubs.c deleted file mode 100644 index 2173bb991..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/shared/sigiostubs.c +++ /dev/null @@ -1,86 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/sigiostubs.c,v 1.4 2003/08/24 17:37:06 dawes Exp $ */ -/* - * Copyright (c) 1999-2003 by The XFree86 Project, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the copyright holder(s) - * and author(s) shall not be used in advertising or otherwise to promote - * the sale, use or other dealings in this Software without prior written - * authorization from the copyright holder(s) and author(s). - */ -/* $XdotOrg: xc/programs/Xserver/hw/xfree86/os-support/shared/sigiostubs.c,v 1.5 2005/07/03 07:01:35 daniels Exp $ */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#ifdef XFree86Server -#ifdef __UNIXOS2__ -# define I_NEED_OS2_H -#endif -# include -# include "xf86.h" -# include "xf86Priv.h" -# include "xf86_OSlib.h" -#else -# include -# include -# include -# include -# include -#endif - -int -xf86InstallSIGIOHandler(int fd, void (*f)(int, void *), void *closure) -{ - return 0; -} - -int -xf86RemoveSIGIOHandler(int fd) -{ - return 0; -} - -int -xf86BlockSIGIO (void) -{ - return 0; -} - -void -xf86UnblockSIGIO (int wasset) -{ -} - -#ifdef XFree86Server -void -xf86AssertBlockedSIGIO (char *where) -{ -} -#endif - -/* XXX This is a quick hack for the benefit of xf86SetSilkenMouse() */ -Bool -xf86SIGIOSupported () -{ - return FALSE; -} - diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/shared/stdPci.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/shared/stdPci.c deleted file mode 100644 index 491406f92..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/shared/stdPci.c +++ /dev/null @@ -1,52 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/stdPci.c,v 3.4 2003/08/24 17:37:06 dawes Exp $ */ -/* - * Copyright (c) 1999-2003 by The XFree86 Project, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the copyright holder(s) - * and author(s) shall not be used in advertising or otherwise to promote - * the sale, use or other dealings in this Software without prior written - * authorization from the copyright holder(s) and author(s). - */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#ifdef __UNIXOS2__ -# define I_NEED_OS2_H -#endif -#include -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86Privstr.h" -#include "xf86Pci.h" -#define NEED_OS_RAC_PROTOS -#include "xf86_OSlib.h" - -#ifndef HAVE_PCI_SIZE_FUNC -#define xf86StdGetPciSizeFromOS xf86GetPciSizeFromOS -#endif - -Bool -xf86StdGetPciSizeFromOS(PCITAG tag, int index, int* bits) -{ - return FALSE; -} diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/shared/stdResource.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/shared/stdResource.c deleted file mode 100644 index 4704d8194..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/shared/stdResource.c +++ /dev/null @@ -1,182 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/stdResource.c,v 1.22 2003/08/24 17:37:06 dawes Exp $ */ -/* - * Copyright (c) 1999-2003 by The XFree86 Project, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the copyright holder(s) - * and author(s) shall not be used in advertising or otherwise to promote - * the sale, use or other dealings in this Software without prior written - * authorization from the copyright holder(s) and author(s). - */ - -/* Standard resource information code */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#ifdef __UNIXOS2__ -# define I_NEED_OS2_H -#endif -#include -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86Privstr.h" -#include "xf86Pci.h" -#define NEED_OS_RAC_PROTOS -#include "xf86_OSlib.h" -#include "xf86Resources.h" - -#ifdef __UNIXOS2__ -# undef ADDRESS -#endif -/* Avoid Imakefile changes */ -#include "bus/Pci.h" - -#ifdef USESTDRES -#define xf86StdBusAccWindowsFromOS xf86BusAccWindowsFromOS -#define xf86StdAccResFromOS xf86AccResFromOS -#define xf86StdPciBusAccWindowsFromOS xf86PciBusAccWindowsFromOS -#define xf86StdIsaBusAccWindowsFromOS xf86IsaBusAccWindowsFromOS - -resRange PciAvoid[] = {_PCI_AVOID_PC_STYLE, _END}; -#endif - -#ifdef INCLUDE_XF86_NO_DOMAIN - -resPtr -xf86StdBusAccWindowsFromOS(void) -{ - /* Fallback is to allow addressing of all memory space */ - resPtr ret = NULL; - resRange range; - - RANGE(range, 0x00000000, 0xffffffff, ResExcMemBlock); - ret = xf86AddResToList(ret, &range, -1); - - /* Fallback is to allow addressing of all I/O space */ - RANGE(range, 0x00000000, 0x0000ffff, ResExcIoBlock); - ret = xf86AddResToList(ret, &range, -1); - return ret; -} - -resPtr -xf86StdPciBusAccWindowsFromOS(void) -{ - /* Fallback is to allow addressing of all memory space */ - resPtr ret = NULL; - resRange range; - - RANGE(range, 0x00000000, 0xffffffff, ResExcMemBlock); - ret = xf86AddResToList(ret, &range, -1); - - /* Fallback is to allow addressing of all I/O space */ - RANGE(range, 0x00000000, 0x0000ffff, ResExcIoBlock); - ret = xf86AddResToList(ret, &range, -1); - return ret; -} - -#ifdef INCLUDE_UNUSED - -resPtr -xf86StdIsaBusAccWindowsFromOS(void) -{ - /* Fallback is to allow addressing of all memory space */ - resPtr ret = NULL; - resRange range; - - RANGE(range, 0x00000000, 0xffffffff, ResExcMemBlock); - ret = xf86AddResToList(ret, &range, -1); - - /* Fallback is to allow addressing of all I/O space */ - RANGE(range, 0x00000000, 0x0000ffff, ResExcIoBlock); - ret = xf86AddResToList(ret, &range, -1); - return ret; -} - -#endif /* INCLUDE_UNUSED */ - -resPtr -xf86StdAccResFromOS(resPtr ret) -{ - resRange range; - - /* - * Fallback is to claim the following areas: - * - * 0x00000000 - 0x0009ffff low 640k host memory - * 0x000c0000 - 0x000effff location of VGA and other extensions ROMS - * 0x000f0000 - 0x000fffff system BIOS - * 0x00100000 - 0x3fffffff low 1G - 1MB host memory - * 0xfec00000 - 0xfecfffff default I/O APIC config space - * 0xfee00000 - 0xfeefffff default Local APIC config space - * 0xffe00000 - 0xffffffff high BIOS area (should this be included?) - * - * reference: Intel 440BX AGP specs - * - * The two APIC spaces appear to be BX-specific and should be dealt with - * elsewhere. - */ - - /* Fallback is to claim 0x0 - 0x9ffff and 0x100000 - 0x7fffffff */ - RANGE(range, 0x00000000, 0x0009ffff, ResExcMemBlock); - ret = xf86AddResToList(ret, &range, -1); - RANGE(range, 0x000c0000, 0x000effff, ResExcMemBlock); - ret = xf86AddResToList(ret, &range, -1); - RANGE(range, 0x000f0000, 0x000fffff, ResExcMemBlock); - ret = xf86AddResToList(ret, &range, -1); - RANGE(range, 0x00100000, 0x3fffffff, - ResExcMemBlock | ResBios | ResEstimated); - ret = xf86AddResToList(ret, &range, -1); -#if 0 - RANGE(range, 0xfec00000, 0xfecfffff, ResExcMemBlock | ResBios); - ret = xf86AddResToList(ret, &range, -1); - RANGE(range, 0xfee00000, 0xfeefffff, ResExcMemBlock | ResBios); - ret = xf86AddResToList(ret, &range, -1); -#endif - RANGE(range, 0xffe00000, 0xffffffff, ResExcMemBlock | ResBios); - ret = xf86AddResToList(ret, &range, -1); - - /* - * Fallback would be to claim well known ports in the 0x0 - 0x3ff range - * along with their sparse I/O aliases, but that's too imprecise. Instead - * claim a bare minimum here. - */ - RANGE(range, 0x00000000, 0x000000ff, ResExcIoBlock); /* For mainboard */ - ret = xf86AddResToList(ret, &range, -1); - - /* - * At minimum, the top and bottom resources must be claimed, so that - * resources that are (or appear to be) unallocated can be relocated. - */ -/* RANGE(range, 0x00000000, 0x00000000, ResExcMemBlock); - ret = xf86AddResToList(ret, &range, -1); - RANGE(range, 0xffffffff, 0xffffffff, ResExcMemBlock); - ret = xf86AddResToList(ret, &range, -1); - RANGE(range, 0x00000000, 0x00000000, ResExcIoBlock); - ret = xf86AddResToList(ret, &range, -1); */ - RANGE(range, 0x0000ffff, 0x0000ffff, ResExcIoBlock); - ret = xf86AddResToList(ret, &range, -1); - - /* XXX add others */ - return ret; -} - -#endif /* INCLUDE_XF86_NO_DOMAIN */ diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/shared/std_kbdEv.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/shared/std_kbdEv.c deleted file mode 100644 index c678162c2..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/shared/std_kbdEv.c +++ /dev/null @@ -1,50 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/std_kbdEv.c,v 3.2 1998/07/25 16:57:01 dawes Exp $ */ -/* - * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany - * Copyright 1993 by David Dawes - * - * 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 - * documentation, and that the names of Thomas Roell and David Dawes - * not be used in advertising or publicity pertaining to distribution of - * the software without specific, written prior permission. Thomas Roell and - * David Dawes makes no representations about the suitability of this - * software for any purpose. It is provided "as is" without express or - * implied warranty. - * - * THOMAS ROELL AND DAVID DAWES DISCLAIMS ALL WARRANTIES WITH REGARD TO - * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS, IN NO EVENT SHALL THOMAS ROELL OR DAVID DAWES 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 OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - */ -/* $XConsortium: std_kbdEv.c /main/4 1996/03/11 10:47:33 kaleb $ */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" - -void -xf86KbdEvents() -{ - unsigned char rBuf[64]; - int nBytes, i; - - if ((nBytes = read( xf86Info.consoleFd, (char *)rBuf, sizeof(rBuf))) - > 0) - { - for (i = 0; i < nBytes; i++) - xf86PostKbdEvent(rBuf[i]); - } -} - diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/shared/sysv_kbd.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/shared/sysv_kbd.c deleted file mode 100644 index 3a3544e8c..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/shared/sysv_kbd.c +++ /dev/null @@ -1,106 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/sysv_kbd.c,v 3.3 1998/07/25 16:57:02 dawes Exp $ */ -/* - * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany - * Copyright 1993 by David Dawes - * - * 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 - * documentation, and that the names of Thomas Roell and David Dawes - * not be used in advertising or publicity pertaining to distribution of - * the software without specific, written prior permission. Thomas Roell and - * David Dawes makes no representations about the suitability of this - * software for any purpose. It is provided "as is" without express or - * implied warranty. - * - * THOMAS ROELL AND DAVID DAWES DISCLAIMS ALL WARRANTIES WITH REGARD TO - * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS, IN NO EVENT SHALL THOMAS ROELL OR DAVID DAWES 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 OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - */ -/* $XConsortium: sysv_kbd.c /main/3 1996/02/21 17:53:59 kaleb $ */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include - -#include "compiler.h" - -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" - -int -xf86GetKbdLeds() -{ - int leds; - - ioctl(xf86Info.consoleFd, KDGETLED, &leds); - return(leds); -} - -void -xf86SetKbdRepeat(char rad) -{ -#ifdef KDSETRAD - ioctl(xf86Info.consoleFd, KDSETRAD, rad); -#endif -} - -static int kbdtrans; -static struct termio kbdtty; -static char *kbdemap = NULL; - -void -xf86KbdInit() -{ -#ifdef KDGKBMODE - ioctl (xf86Info.consoleFd, KDGKBMODE, &kbdtrans); -#endif - ioctl (xf86Info.consoleFd, TCGETA, &kbdtty); -#if defined(E_TABSZ) - kbdemap = xalloc(E_TABSZ); - if (ioctl(xf86Info.consoleFd, LDGMAP, kbdemap) < 0) - { - xfree(kbdemap); - kbdemap = NULL; - } -#endif -} - -int -xf86KbdOn() -{ - struct termio nTty; - - ioctl(xf86Info.consoleFd, KDSKBMODE, K_RAW); - ioctl(xf86Info.consoleFd, LDNMAP, 0); /* disable mapping completely */ - nTty = kbdtty; - nTty.c_iflag = (IGNPAR | IGNBRK) & (~PARMRK) & (~ISTRIP); - nTty.c_oflag = 0; - nTty.c_cflag = CREAD | CS8 | B9600; - nTty.c_lflag = 0; - nTty.c_cc[VTIME]=0; - nTty.c_cc[VMIN]=1; - ioctl(xf86Info.consoleFd, TCSETA, &nTty); - return(xf86Info.consoleFd); -} - -int -xf86KbdOff() -{ - if (kbdemap) - { - ioctl(xf86Info.consoleFd, LDSMAP, kbdemap); - } - ioctl(xf86Info.consoleFd, KDSKBMODE, kbdtrans); - ioctl(xf86Info.consoleFd, TCSETA, &kbdtty); - return(xf86Info.consoleFd); -} diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/shared/vidmem.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/shared/vidmem.c deleted file mode 100644 index 237d47a4d..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/shared/vidmem.c +++ /dev/null @@ -1,300 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/vidmem.c,v 1.17 2003/08/24 17:37:06 dawes Exp $ */ -/* - * Copyright (c) 1993-2003 by The XFree86 Project, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the copyright holder(s) - * and author(s) shall not be used in advertising or otherwise to promote - * the sale, use or other dealings in this Software without prior written - * authorization from the copyright holder(s) and author(s). - */ - - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#ifdef __UNIXOS2__ -# define I_NEED_OS2_H -#endif -#include -#include "input.h" -#include "scrnintstr.h" - -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" -#include "xf86OSpriv.h" - -/* - * This file contains the common part of the video memory mapping functions - */ - -/* - * Get a piece of the ScrnInfoRec. At the moment, this is only used to hold - * the MTRR option information, but it is likely to be expanded if we do - * auto unmapping of memory at VT switch. - * - */ - -typedef struct { - unsigned long physBase; - unsigned long size; - pointer virtBase; - pointer mtrrInfo; - int flags; -} MappingRec, *MappingPtr; - -typedef struct { - int numMappings; - MappingPtr * mappings; - Bool mtrrEnabled; - MessageType mtrrFrom; - Bool mtrrOptChecked; - ScrnInfoPtr pScrn; -} VidMapRec, *VidMapPtr; - -static int vidMapIndex = -1; - -#define VIDMAPPTR(p) ((VidMapPtr)((p)->privates[vidMapIndex].ptr)) - -static VidMemInfo vidMemInfo = {FALSE, }; -static VidMapRec vidMapRec = {0, NULL, TRUE, X_DEFAULT, FALSE, NULL}; - -static VidMapPtr -getVidMapRec(int scrnIndex) -{ - VidMapPtr vp; - ScrnInfoPtr pScrn; - - if ((scrnIndex < 0) || - !(pScrn = xf86Screens[scrnIndex])) - return &vidMapRec; - - if (vidMapIndex < 0) - vidMapIndex = xf86AllocateScrnInfoPrivateIndex(); - - if (VIDMAPPTR(pScrn) != NULL) - return VIDMAPPTR(pScrn); - - vp = pScrn->privates[vidMapIndex].ptr = xnfcalloc(sizeof(VidMapRec), 1); - vp->mtrrEnabled = TRUE; /* default to enabled */ - vp->mtrrFrom = X_DEFAULT; - vp->mtrrOptChecked = FALSE; - vp->pScrn = pScrn; - return vp; -} - -static MappingPtr -newMapping(VidMapPtr vp) -{ - vp->mappings = xnfrealloc(vp->mappings, sizeof(MappingPtr) * - (vp->numMappings + 1)); - vp->mappings[vp->numMappings] = xnfcalloc(sizeof(MappingRec), 1); - return vp->mappings[vp->numMappings++]; -} - -static MappingPtr -findMapping(VidMapPtr vp, pointer vbase, unsigned long size) -{ - int i; - - for (i = 0; i < vp->numMappings; i++) { - if (vp->mappings[i]->virtBase == vbase && - vp->mappings[i]->size == size) - return vp->mappings[i]; - } - return NULL; -} - -static void -removeMapping(VidMapPtr vp, MappingPtr mp) -{ - int i, found = 0; - - for (i = 0; i < vp->numMappings; i++) { - if (vp->mappings[i] == mp) { - found = 1; - xfree(vp->mappings[i]); - } else if (found) { - vp->mappings[i - 1] = vp->mappings[i]; - } - } - vp->numMappings--; - vp->mappings[vp->numMappings] = NULL; -} - -enum { OPTION_MTRR }; -static const OptionInfoRec opts[] = -{ - { OPTION_MTRR, "mtrr", OPTV_BOOLEAN, {0}, FALSE }, - { -1, NULL, OPTV_NONE, {0}, FALSE } -}; - -static void -checkMtrrOption(VidMapPtr vp) -{ - if (!vp->mtrrOptChecked && vp->pScrn && vp->pScrn->options != NULL) { - OptionInfoPtr options; - - options = xnfalloc(sizeof(opts)); - (void)memcpy(options, opts, sizeof(opts)); - xf86ProcessOptions(vp->pScrn->scrnIndex, vp->pScrn->options, - options); - if (xf86GetOptValBool(options, OPTION_MTRR, &vp->mtrrEnabled)) - vp->mtrrFrom = X_CONFIG; - xfree(options); - vp->mtrrOptChecked = TRUE; - } -} - -void -xf86MakeNewMapping(int ScreenNum, int Flags, unsigned long Base, unsigned long Size, pointer Vbase) -{ - VidMapPtr vp; - MappingPtr mp; - - vp = getVidMapRec(ScreenNum); - mp = newMapping(vp); - mp->physBase = Base; - mp->size = Size; - mp->virtBase = Vbase; - mp->flags = Flags; -} - -void -xf86InitVidMem(void) -{ - if (!vidMemInfo.initialised) { - memset(&vidMemInfo, 0, sizeof(VidMemInfo)); - xf86OSInitVidMem(&vidMemInfo); - } -} - -pointer -xf86MapVidMem(int ScreenNum, int Flags, unsigned long Base, unsigned long Size) -{ - pointer vbase = NULL; - VidMapPtr vp; - MappingPtr mp; - - if (((Flags & VIDMEM_FRAMEBUFFER) && - (Flags & (VIDMEM_MMIO | VIDMEM_MMIO_32BIT)))) - FatalError("Mapping memory with more than one type\n"); - - xf86InitVidMem(); - if (!vidMemInfo.initialised || !vidMemInfo.mapMem) - return NULL; - - vbase = vidMemInfo.mapMem(ScreenNum, Base, Size, Flags); - - if (!vbase || vbase == (pointer)-1) - return NULL; - - vp = getVidMapRec(ScreenNum); - mp = newMapping(vp); - mp->physBase = Base; - mp->size = Size; - mp->virtBase = vbase; - mp->flags = Flags; - - /* - * Check the "mtrr" option even when MTRR isn't supported to avoid - * warnings about unrecognised options. - */ - checkMtrrOption(vp); - - if (vp->mtrrEnabled && vidMemInfo.setWC) { - if (Flags & (VIDMEM_MMIO | VIDMEM_MMIO_32BIT)) - mp->mtrrInfo = - vidMemInfo.setWC(ScreenNum, Base, Size, FALSE, - vp->mtrrFrom); - else if (Flags & VIDMEM_FRAMEBUFFER) - mp->mtrrInfo = - vidMemInfo.setWC(ScreenNum, Base, Size, TRUE, - vp->mtrrFrom); - } - return vbase; -} - -void -xf86UnMapVidMem(int ScreenNum, pointer Base, unsigned long Size) -{ - VidMapPtr vp; - MappingPtr mp; - - if (!vidMemInfo.initialised || !vidMemInfo.unmapMem) { - xf86DrvMsg(ScreenNum, X_WARNING, - "xf86UnMapVidMem() called before xf86MapVidMem()\n"); - return; - } - - vp = getVidMapRec(ScreenNum); - mp = findMapping(vp, Base, Size); - if (!mp) { - xf86DrvMsg(ScreenNum, X_WARNING, - "xf86UnMapVidMem: cannot find region for [%p,0x%lx]\n", - Base, Size); - return; - } - if (vp->mtrrEnabled && vidMemInfo.undoWC && mp) - vidMemInfo.undoWC(ScreenNum, mp->mtrrInfo); - - vidMemInfo.unmapMem(ScreenNum, Base, Size); - removeMapping(vp, mp); -} - -Bool -xf86CheckMTRR(int ScreenNum) -{ - VidMapPtr vp = getVidMapRec(ScreenNum); - - /* - * Check the "mtrr" option even when MTRR isn't supported to avoid - * warnings about unrecognised options. - */ - checkMtrrOption(vp); - - if (vp->mtrrEnabled && vidMemInfo.setWC) - return TRUE; - - return FALSE; -} - -Bool -xf86LinearVidMem() -{ - xf86InitVidMem(); - return vidMemInfo.linearSupported; -} - -void -xf86MapReadSideEffects(int ScreenNum, int Flags, pointer base, - unsigned long Size) -{ - if (!(Flags & VIDMEM_READSIDEEFFECT)) - return; - - if (!vidMemInfo.initialised || !vidMemInfo.readSideEffects) - return; - - vidMemInfo.readSideEffects(ScreenNum, base, Size); -} - diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/shared/xf86Axp.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/shared/xf86Axp.c deleted file mode 100644 index b8953f119..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/shared/xf86Axp.c +++ /dev/null @@ -1,50 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/xf86Axp.c,v 1.3 2003/08/24 17:37:06 dawes Exp $ */ -/* - * Copyright (c) 2000 by The XFree86 Project, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the copyright holder(s) - * and author(s) shall not be used in advertising or otherwise to promote - * the sale, use or other dealings in this Software without prior written - * authorization from the copyright holder(s) and author(s). - */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include "xf86Axp.h" - -axpParams xf86AXPParams[] = { - {SYS_NONE, 0, 0, 0}, - {TSUNAMI, 0, 0, 0}, - {LCA, 1<<24,0xf8000000, 1UL << 32}, - {APECS, 1<<24,0xf8000000, 1UL << 32}, - {T2, 0,0xFC000000, 1UL << 31}, - {T2_GAMMA, 0,0xFC000000, 1UL << 31}, - {CIA, 0,0xE0000000, 1UL << 34}, - {MCPCIA, 0,0xf8000000, 1UL << 31}, - {JENSEN, 0, 0xE000000, 1UL << 32}, - {POLARIS, 0, 0, 0}, - {PYXIS, 0, 0, 0}, - {PYXIS_CIA, 0,0xE0000000, 1UL << 34}, - {IRONGATE, 0, 0, 0} -}; - diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/shared/xf86Axp.h b/nx-X11/programs/Xserver/hw/xfree86/os-support/shared/xf86Axp.h deleted file mode 100644 index 4b8b08370..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/shared/xf86Axp.h +++ /dev/null @@ -1,36 +0,0 @@ -/* $XFree86$ */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#ifndef _XF86_AXP_H_ -#define _XF86_AXP_H_ - -typedef enum { - SYS_NONE, - TSUNAMI, - LCA, - APECS, - T2, - T2_GAMMA, - CIA, - MCPCIA, - JENSEN, - POLARIS, - PYXIS, - PYXIS_CIA, - IRONGATE -} axpDevice; - -typedef struct { - axpDevice id; - unsigned long hae_thresh; - unsigned long hae_mask; - unsigned long size; -} axpParams; - -extern axpParams xf86AXPParams[]; - -#endif - -- cgit v1.2.3