diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c index 2b8c2d52b..5d424afff 100644 --- a/hw/xfree86/common/xf86Config.c +++ b/hw/xfree86/common/xf86Config.c @@ -83,7 +83,8 @@ extern DeviceAssocRec mouse_assoc; #endif #if (defined(i386) || defined(__i386__)) && \ - (defined(__FreeBSD__) || defined(__NetBSD__) || defined(linux) || \ + (defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || \ + defined(__NetBSD__) || defined(linux) || \ (defined(SVR4) && !defined(sun)) || defined(__GNU__)) #define SUPPORT_PC98 #endif diff --git a/hw/xfree86/common/xf86Configure.c b/hw/xfree86/common/xf86Configure.c index 41aa10e3b..0f7a334ea 100644 --- a/hw/xfree86/common/xf86Configure.c +++ b/hw/xfree86/common/xf86Configure.c @@ -84,7 +84,7 @@ static char *DFLT_MOUSE_DEV = "/dev/mouse"; #elif defined(__QNXNTO__) static char *DFLT_MOUSE_PROTO = "OSMouse"; static char *DFLT_MOUSE_DEV = "/dev/devi/mouse0"; -#elif defined(__FreeBSD__) +#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) static char *DFLT_MOUSE_DEV = "/dev/sysmouse"; static char *DFLT_MOUSE_PROTO = "auto"; #else diff --git a/hw/xfree86/common/xf86Privstr.h b/hw/xfree86/common/xf86Privstr.h index 93d64fd51..2f15e14cb 100644 --- a/hw/xfree86/common/xf86Privstr.h +++ b/hw/xfree86/common/xf86Privstr.h @@ -120,7 +120,7 @@ typedef struct { /* graphics part */ Bool sharedMonitor; ScreenPtr currentScreen; -#ifdef CSRG_BASED +#if defined(CSRG_BASED) || defined(__FreeBSD_kernel__) int screenFd; /* fd for memory mapped access to * vga card */ int consType; /* Which console driver? */ @@ -222,7 +222,7 @@ typedef struct _RootWinProp { #define XCOMP ((unsigned long) 0x00008000) /* BSD console driver types (consType) */ -#ifdef CSRG_BASED +#if defined(CSRG_BASED) || defined(__FreeBSD_kernel__) #define PCCONS 0 #define CODRV011 1 #define CODRV01X 2 diff --git a/hw/xfree86/os-support/bsd/alpha_video.c b/hw/xfree86/os-support/bsd/alpha_video.c index 0ed261061..ca0f0f8e7 100644 --- a/hw/xfree86/os-support/bsd/alpha_video.c +++ b/hw/xfree86/os-support/bsd/alpha_video.c @@ -37,7 +37,7 @@ #include #ifndef __NetBSD__ # include -# ifdef __FreeBSD__ +# if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) # include # endif # else @@ -399,7 +399,7 @@ xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf, } -#if defined(__FreeBSD__) || defined(__OpenBSD__) +#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__OpenBSD__) extern int ioperm(unsigned long from, unsigned long num, int on); @@ -417,7 +417,7 @@ xf86DisableIO() return; } -#endif /* __FreeBSD__ || __OpenBSD__ */ +#endif /* __FreeBSD_kernel__ || __OpenBSD__ */ #ifdef USE_ALPHA_PIO @@ -492,7 +492,7 @@ writeSparse16(int Value, pointer Base, register unsigned long Offset); static void writeSparse32(int Value, pointer Base, register unsigned long Offset); -#ifdef __FreeBSD__ +#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) extern int sysarch(int, void *); #endif @@ -504,7 +504,7 @@ struct parms { static int sethae(u_int64_t hae) { -#ifdef __FreeBSD__ +#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) #ifndef ALPHA_SETHAE #define ALPHA_SETHAE 0 #endif diff --git a/hw/xfree86/os-support/bsd/bsd_init.c b/hw/xfree86/os-support/bsd/bsd_init.c index 3cdea419b..4d883a2be 100644 --- a/hw/xfree86/os-support/bsd/bsd_init.c +++ b/hw/xfree86/os-support/bsd/bsd_init.c @@ -38,7 +38,9 @@ #include "xf86_OSlib.h" #include +#include #include +#include static Bool KeepTty = FALSE; static int devConsoleFd = -1; @@ -80,6 +82,10 @@ static int initialVT = -1; #define WSCONS_PCVT_COMPAT_CONSOLE_DEV "/dev/ttyE0" #endif +#ifdef __GLIBC__ +#define setpgrp setpgid +#endif + #define CHECK_DRIVER_MSG \ "Check your kernel's console driver configuration and /dev entries" @@ -239,11 +245,11 @@ xf86OpenConsole() * switching anymore. Here we check for FreeBSD 3.1 and up. * Add cases for other *BSD that behave the same. */ +#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) uname (&uts); - if (strcmp(uts.sysname, "FreeBSD") == 0) { - i = atof(uts.release) * 100; - if (i >= 310) goto acquire_vt; - } + i = atof(uts.release) * 100; + if (i >= 310) goto acquire_vt; +#endif /* otherwise fall through */ case PCVT: /* diff --git a/hw/xfree86/os-support/bsd/bsd_io.c b/hw/xfree86/os-support/bsd/bsd_io.c index 817749988..3b1f58889 100644 --- a/hw/xfree86/os-support/bsd/bsd_io.c +++ b/hw/xfree86/os-support/bsd/bsd_io.c @@ -31,6 +31,7 @@ #endif #include +#include #include "compiler.h" @@ -148,7 +149,7 @@ xf86SetKbdRepeat(char rad) } #if defined(SYSCONS_SUPPORT) || defined(PCCONS_SUPPORT) || defined(PCVT_SUPPORT) || defined(WSCONS_SUPPORT) -static struct termio kbdtty; +static struct termios kbdtty; #endif void diff --git a/hw/xfree86/os-support/bsd/bsd_kbd.c b/hw/xfree86/os-support/bsd/bsd_kbd.c index 461646c4a..18219e5bc 100644 --- a/hw/xfree86/os-support/bsd/bsd_kbd.c +++ b/hw/xfree86/os-support/bsd/bsd_kbd.c @@ -15,6 +15,7 @@ #endif #include +#include #include "compiler.h" @@ -41,7 +42,7 @@ static KbdProtocolRec protocols[] = { }; typedef struct { - struct termio kbdtty; + struct termios kbdtty; } BsdKbdPrivRec, *BsdKbdPrivPtr; static @@ -74,10 +75,16 @@ SetKbdLeds(InputInfoPtr pInfo, int leds) KbdDevPtr pKbd = (KbdDevPtr) pInfo->private; int real_leds = 0; +#ifdef LED_CAP if (leds & XLED1) real_leds |= LED_CAP; +#endif +#ifdef LED_NUM if (leds & XLED2) real_leds |= LED_NUM; +#endif +#ifdef LED_SCR if (leds & XLED3) real_leds |= LED_SCR; if (leds & XLED4) real_leds |= LED_SCR; +#endif switch (pKbd->consType) { @@ -119,9 +126,15 @@ GetKbdLeds(InputInfoPtr pInfo) #endif } +#ifdef LED_CAP if (real_leds & LED_CAP) leds |= XLED1; +#endif +#ifdef LED_NUM if (real_leds & LED_NUM) leds |= XLED2; +#endif +#ifdef LED_SCR if (real_leds & LED_SCR) leds |= XLED3; +#endif return(leds); } @@ -311,16 +324,20 @@ Bool SpecialKey(InputInfoPtr pInfo, int key, Bool down, int modifiers) case KEY_F8: case KEY_F9: case KEY_F10: +#ifdef VT_ACTIVATE if (down) { ioctl(xf86Info.consoleFd, VT_ACTIVATE, key - KEY_F1 + 1); return TRUE; } +#endif case KEY_F11: case KEY_F12: +#ifdef VT_ACTIVATE if (down) { ioctl(xf86Info.consoleFd, VT_ACTIVATE, key - KEY_F11 + 11); return TRUE; } +#endif } } } diff --git a/hw/xfree86/os-support/bsd/bsd_mouse.c b/hw/xfree86/os-support/bsd/bsd_mouse.c index daf48fbc0..e4a1a4e6e 100644 --- a/hw/xfree86/os-support/bsd/bsd_mouse.c +++ b/hw/xfree86/os-support/bsd/bsd_mouse.c @@ -72,7 +72,7 @@ static void usbSigioReadInput (int fd, void *closure); #endif -#if defined(__FreeBSD__) +#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) /* These are for FreeBSD */ #define DEFAULT_MOUSE_DEV "/dev/mouse" #define DEFAULT_SYSMOUSE_DEV "/dev/sysmouse" @@ -101,7 +101,7 @@ SupportedInterfaces(void) { #if defined(__NetBSD__) return MSE_SERIAL | MSE_BUS | MSE_PS2 | MSE_AUTO; -#elif defined(__FreeBSD__) +#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) return MSE_SERIAL | MSE_BUS | MSE_PS2 | MSE_AUTO | MSE_MISC; #else return MSE_SERIAL | MSE_BUS | MSE_PS2 | MSE_XPS2 | MSE_AUTO; @@ -124,7 +124,7 @@ static const char *internalNames[] = { * main "mouse" driver. */ static const char *miscNames[] = { -#if defined(__FreeBSD__) +#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) "SysMouse", #endif NULL @@ -153,7 +153,7 @@ CheckProtocol(const char *protocol) static const char * DefaultProtocol(void) { -#if defined(__FreeBSD__) +#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) return "Auto"; #elif defined(__OpenBSD__) && defined(WSCONS_SUPPORT) return "WSMouse"; @@ -162,7 +162,7 @@ DefaultProtocol(void) #endif } -#if defined(__FreeBSD__) && defined(MOUSE_PROTO_SYSMOUSE) +#if (defined(__FreeBSD__) || defined(__FreeBSD_kernel__)) && defined(MOUSE_PROTO_SYSMOUSE) static struct { int dproto; const char *name; @@ -231,7 +231,7 @@ SetSysMouseRes(InputInfoPtr pInfo, const char *protocol, int rate, int res) mode.rate = rate > 0 ? rate : -1; mode.resolution = res > 0 ? res : -1; mode.accelfactor = -1; -#if defined(__FreeBSD__) +#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) if (pMse->autoProbe || (protocol && xf86NameCmp(protocol, "SysMouse") == 0)) { /* @@ -249,7 +249,7 @@ SetSysMouseRes(InputInfoPtr pInfo, const char *protocol, int rate, int res) } #endif -#if defined(__FreeBSD__) +#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) #define MOUSED_PID_FILE "/var/run/moused.pid" @@ -773,7 +773,7 @@ xf86OSMouseInit(int flags) p->BuiltinNames = BuiltinNames; p->DefaultProtocol = DefaultProtocol; p->CheckProtocol = CheckProtocol; -#if defined(__FreeBSD__) && defined(MOUSE_PROTO_SYSMOUSE) +#if (defined(__FreeBSD__) || defined(__FreeBSD_kernel__)) && defined(MOUSE_PROTO_SYSMOUSE) p->SetupAuto = SetupAuto; p->SetPS2Res = SetSysMouseRes; p->SetBMRes = SetSysMouseRes; @@ -783,7 +783,7 @@ xf86OSMouseInit(int flags) p->SetupAuto = SetupAuto; p->SetMiscRes = SetMouseRes; #endif -#if defined(__FreeBSD__) || defined(__OpenBSD__) +#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__OpenBSD__) p->FindDevice = FindDevice; #endif p->PreInit = bsdMousePreInit; diff --git a/hw/xfree86/os-support/bsd/i386_video.c b/hw/xfree86/os-support/bsd/i386_video.c index 1515d0e1e..3f4cdb010 100644 --- a/hw/xfree86/os-support/bsd/i386_video.c +++ b/hw/xfree86/os-support/bsd/i386_video.c @@ -34,6 +34,9 @@ #include "xf86.h" #include "xf86Priv.h" +#include +#include + #ifdef HAS_MTRR_SUPPORT #ifndef __NetBSD__ #include diff --git a/hw/xfree86/os-support/linux/lnx_agp.c b/hw/xfree86/os-support/linux/lnx_agp.c index a3a32b7e5..6a5c83db2 100644 --- a/hw/xfree86/os-support/linux/lnx_agp.c +++ b/hw/xfree86/os-support/linux/lnx_agp.c @@ -22,7 +22,7 @@ #if defined(linux) #include #include -#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) +#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) #include #include #endif diff --git a/hw/xfree86/os-support/xf86_OSlib.h b/hw/xfree86/os-support/xf86_OSlib.h index 76e8d010e..c86247a46 100644 --- a/hw/xfree86/os-support/xf86_OSlib.h +++ b/hw/xfree86/os-support/xf86_OSlib.h @@ -326,12 +326,24 @@ typedef signed long xf86ssize_t; #endif /* DGUX && SVR4 */ /**************************************************************************/ -/* Linux */ +/* Linux or Glibc-based system */ /**************************************************************************/ -#if defined(linux) +#if defined(__linux__) || defined(__GLIBC__) # include # include -# include +# include +# include +# include + +#ifdef __GNU__ /* GNU/Hurd */ +# define USE_OSMOUSE +#endif + +# ifdef __linux__ +# include +# else /* __GLIBC__ */ +# include +# endif # ifdef __sparc__ # include # endif @@ -340,20 +352,21 @@ typedef signed long xf86ssize_t; # include -# define HAS_USL_VTS # include -# include -# include -# define LDGMAP GIO_SCRNMAP -# define LDSMAP PIO_SCRNMAP -# define LDNMAP LDSMAP - -# define CLEARDTR_SUPPORT -# define USE_VT_SYSREQ +# ifdef __linux__ +# define HAS_USL_VTS +# include +# include +# define LDGMAP GIO_SCRNMAP +# define LDSMAP PIO_SCRNMAP +# define LDNMAP LDSMAP +# define CLEARDTR_SUPPORT +# define USE_VT_SYSREQ +# endif # define POSIX_TTY -#endif /* linux */ +#endif /* __linux__ || __GLIBC__ */ /**************************************************************************/ /* LynxOS AT */ @@ -413,6 +426,30 @@ extern int errno; # include +# include +# include +# include + +# if defined(__bsdi__) +# include +# if (_BSDI_VERSION < 199510) +# include +# endif +# endif /* __bsdi__ */ + +#endif /* CSRG_BASED */ + +/**************************************************************************/ +/* Kernel of *BSD */ +/**************************************************************************/ +#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || \ + defined(__NetBSD__) || defined(__OpenBSD__) || defined(__bsdi__) + +# include +# if defined(__FreeBSD_version) && !defined(__FreeBSD_kernel_version) +# define __FreeBSD_kernel_version __FreeBSD_version +# endif + # if !defined(LINKKIT) /* Don't need this stuff for the Link Kit */ # if defined(__bsdi__) @@ -434,9 +471,8 @@ extern int errno; # if defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) # include # else -# if defined(__FreeBSD__) -# include -# if __FreeBSD_version >= 410000 +# if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) +# if (__FreeBSD_kernel_version >= 410000) # include # include # else @@ -450,7 +486,7 @@ extern int errno; # if defined(PCVT_SUPPORT) # if !defined(SYSCONS_SUPPORT) /* no syscons, so include pcvt specific header file */ -# if defined(__FreeBSD__) || defined(__DragonFly__) +# if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) # include # else # if defined(__NetBSD__) || defined(__OpenBSD__) @@ -460,7 +496,7 @@ extern int errno; # else # include # endif /* __NetBSD__ */ -# endif /* __FreeBSD__ || __OpenBSD__ */ +# endif /* __FreeBSD_kernel__ || __OpenBSD__ */ # else /* pcvt and syscons: hard-code the ID magic */ # define VGAPCVTID _IOWR('V',113, struct pcvtid) struct pcvtid { @@ -473,9 +509,8 @@ extern int errno; # include # include # endif /* WSCONS_SUPPORT */ -# if defined(__FreeBSD__) -# include -# if __FreeBSD_version >= 500013 +# if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) +# if (__FreeBSD_kernel_version >= 500013) # include # else # undef MOUSE_GETINFO @@ -514,17 +549,6 @@ extern int errno; # endif /* __bsdi__ */ # endif /* !LINKKIT */ -# include -# include -# include - -# if defined(__bsdi__) -# include -# if (_BSDI_VERSION < 199510) -# include -# endif -# endif /* __bsdi__ */ - #if defined(USE_I386_IOPL) || defined(USE_AMD64_IOPL) #include #endif @@ -535,7 +559,8 @@ extern int errno; # define USE_VT_SYSREQ # endif -#endif /* CSRG_BASED */ +#endif +/* __FreeBSD_kernel__ || __NetBSD__ || __OpenBSD__ || __bsdi__ */ /**************************************************************************/ /* OS/2 */ @@ -644,25 +669,6 @@ extern char* __XOS2RedirRoot(char*); #endif -/**************************************************************************/ -/* GNU/Hurd */ -/**************************************************************************/ -#if defined(__GNU__) - -#include -#include -#include -#include -#include -#include -#include -#include - -#define POSIX_TTY -#define USE_OSMOUSE - -#endif /* __GNU__ */ - /**************************************************************************/ /* IRIX */ /**************************************************************************/