Merge remote-tracking branch 'koba/reviewed'

This commit is contained in:
Keith Packard 2011-10-03 13:47:49 -07:00
commit 6e965d8a18
13 changed files with 28 additions and 117 deletions

View File

@ -670,7 +670,6 @@ typedef enum {
FLAG_DISABLEVIDMODE, FLAG_DISABLEVIDMODE,
FLAG_ALLOWNONLOCAL, FLAG_ALLOWNONLOCAL,
FLAG_ALLOWMOUSEOPENFAIL, FLAG_ALLOWMOUSEOPENFAIL,
FLAG_VTSYSREQ,
FLAG_SAVER_BLANKTIME, FLAG_SAVER_BLANKTIME,
FLAG_DPMS_STANDBYTIME, FLAG_DPMS_STANDBYTIME,
FLAG_DPMS_SUSPENDTIME, FLAG_DPMS_SUSPENDTIME,
@ -711,8 +710,6 @@ static OptionInfoRec FlagOptions[] = {
{0}, FALSE }, {0}, FALSE },
{ FLAG_ALLOWMOUSEOPENFAIL, "AllowMouseOpenFail", OPTV_BOOLEAN, { FLAG_ALLOWMOUSEOPENFAIL, "AllowMouseOpenFail", OPTV_BOOLEAN,
{0}, FALSE }, {0}, FALSE },
{ FLAG_VTSYSREQ, "VTSysReq", OPTV_BOOLEAN,
{0}, FALSE },
{ FLAG_SAVER_BLANKTIME, "BlankTime" , OPTV_INTEGER, { FLAG_SAVER_BLANKTIME, "BlankTime" , OPTV_INTEGER,
{0}, FALSE }, {0}, FALSE },
{ FLAG_DPMS_STANDBYTIME, "StandbyTime", OPTV_INTEGER, { FLAG_DPMS_STANDBYTIME, "StandbyTime", OPTV_INTEGER,
@ -850,16 +847,6 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts)
if (xf86GetOptValBool(FlagOptions, FLAG_ALLOWMOUSEOPENFAIL, &value)) if (xf86GetOptValBool(FlagOptions, FLAG_ALLOWMOUSEOPENFAIL, &value))
xf86Info.allowMouseOpenFail = value; xf86Info.allowMouseOpenFail = value;
if (xf86GetOptValBool(FlagOptions, FLAG_VTSYSREQ, &value)) {
#ifdef USE_VT_SYSREQ
xf86Info.vtSysreq = value;
xf86Msg(X_CONFIG, "VTSysReq %s\n", value ? "enabled" : "disabled");
#else
if (value)
xf86Msg(X_WARNING, "VTSysReq is not supported on this OS\n");
#endif
}
xf86Info.pmFlag = TRUE; xf86Info.pmFlag = TRUE;
if (xf86GetOptValBool(FlagOptions, FLAG_NOPM, &value)) if (xf86GetOptValBool(FlagOptions, FLAG_NOPM, &value))
xf86Info.pmFlag = !value; xf86Info.pmFlag = !value;

View File

@ -96,7 +96,6 @@ InputInfoPtr xf86InputDevs = NULL;
xf86InfoRec xf86Info = { xf86InfoRec xf86Info = {
.consoleFd = -1, .consoleFd = -1,
.vtno = -1, .vtno = -1,
.vtSysreq = FALSE,
.lastEventTime = -1, .lastEventTime = -1,
.vtRequestsPending = FALSE, .vtRequestsPending = FALSE,
#ifdef sun #ifdef sun
@ -111,7 +110,6 @@ xf86InfoRec xf86Info = {
.caughtSignal = FALSE, .caughtSignal = FALSE,
.currentScreen = NULL, .currentScreen = NULL,
#ifdef CSRG_BASED #ifdef CSRG_BASED
.screenFd = -1,
.consType = -1, .consType = -1,
#endif #endif
.allowMouseOpenFail = FALSE, .allowMouseOpenFail = FALSE,

View File

@ -57,7 +57,6 @@ typedef enum {
typedef struct { typedef struct {
int consoleFd; int consoleFd;
int vtno; int vtno;
Bool vtSysreq;
/* event handler part */ /* event handler part */
int lastEventTime; int lastEventTime;
@ -76,8 +75,6 @@ typedef struct {
/* graphics part */ /* graphics part */
ScreenPtr currentScreen; ScreenPtr currentScreen;
#if defined(CSRG_BASED) || defined(__FreeBSD_kernel__) #if defined(CSRG_BASED) || defined(__FreeBSD_kernel__)
int screenFd; /* fd for memory mapped access to
* vga card */
int consType; /* Which console driver? */ int consType; /* Which console driver? */
#endif #endif

View File

@ -560,18 +560,6 @@ drivers to not report failure if the mouse device can't be opened/initialised.
It has no effect on the evdev(__drivermansuffix__) or other drivers. It has no effect on the evdev(__drivermansuffix__) or other drivers.
Default: false. Default: false.
.TP 7 .TP 7
.BI "Option \*qVTSysReq\*q \*q" boolean \*q
enables the SYSV\-style VT switch sequence for non\-SYSV systems
which support VT switching.
This sequence is
.B Alt\-SysRq
followed by a function key
.RB ( Fn ).
This prevents the __xservername__ server trapping the
keys used for the default VT switch sequence, which means that clients can
access them.
Default: off.
.TP 7
.BI "Option \*qBlankTime\*q \*q" time \*q .BI "Option \*qBlankTime\*q \*q" time \*q
sets the inactivity timeout for the sets the inactivity timeout for the
.B blank .B blank

View File

@ -340,7 +340,7 @@ mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
base = mmap(0, Size, base = mmap(0, Size,
(flags & VIDMEM_READONLY) ? (flags & VIDMEM_READONLY) ?
PROT_READ : (PROT_READ | PROT_WRITE), PROT_READ : (PROT_READ | PROT_WRITE),
MAP_FLAGS, xf86Info.screenFd, MAP_FLAGS, xf86Info.consoleFd,
(unsigned long)Base + BUS_BASE); (unsigned long)Base + BUS_BASE);
if (base == MAP_FAILED) if (base == MAP_FAILED)
{ {

View File

@ -213,7 +213,7 @@ mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
base = mmap(0, Size, base = mmap(0, Size,
(flags & VIDMEM_READONLY) ? (flags & VIDMEM_READONLY) ?
PROT_READ : (PROT_READ | PROT_WRITE), PROT_READ : (PROT_READ | PROT_WRITE),
MAP_FLAGS, xf86Info.screenFd, MAP_FLAGS, xf86Info.consoleFd,
(unsigned long)Base - 0xA0000); (unsigned long)Base - 0xA0000);
if (base == MAP_FAILED) if (base == MAP_FAILED)
{ {
@ -306,7 +306,7 @@ checkMapInfo(Bool warn, int Region)
if(!memAccP->Checked) if(!memAccP->Checked)
{ {
if(ioctl(xf86Info.screenFd, memAccP->ioctl, &(memAccP->memInfo)) == -1) if(ioctl(xf86Info.consoleFd, memAccP->ioctl, &(memAccP->memInfo)) == -1)
{ {
if(warn) if(warn)
{ {
@ -360,7 +360,7 @@ xf86MapInfoMap(struct memAccess *memInfoP, pointer Base, unsigned long Size)
Size, Size,
PROT_READ | PROT_WRITE, PROT_READ | PROT_WRITE,
MAP_SHARED, MAP_SHARED,
xf86Info.screenFd, xf86Info.consoleFd,
(unsigned long)mapInfoP->u.map_info_mmap.map_offset)) (unsigned long)mapInfoP->u.map_info_mmap.map_offset))
== (pointer)-1) == (pointer)-1)
{ {

View File

@ -37,10 +37,6 @@
#include "xf86Priv.h" #include "xf86Priv.h"
#include "xf86_OSlib.h" #include "xf86_OSlib.h"
#ifdef WSCONS_SUPPORT
#define KBD_FD(i) ((i).kbdFd != -1 ? (i).kbdFd : (i).consoleFd)
#endif
void void
xf86OSRingBell(int loudness, int pitch, int duration) xf86OSRingBell(int loudness, int pitch, int duration)
{ {

View File

@ -41,7 +41,10 @@
#include <errno.h> #include <errno.h>
static Bool KeepTty = FALSE; static Bool KeepTty = FALSE;
#ifdef PCCONS_SUPPORT
static int devConsoleFd = -1; static int devConsoleFd = -1;
#endif
#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT) #if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
static int VTnum = -1; static int VTnum = -1;
static int initialVT = -1; static int initialVT = -1;
@ -207,11 +210,7 @@ xf86OpenConsole()
"%s: No console driver found\n\tSupported drivers: %s\n\t%s", "%s: No console driver found\n\tSupported drivers: %s\n\t%s",
"xf86OpenConsole", cons_drivers, CHECK_DRIVER_MSG); "xf86OpenConsole", cons_drivers, CHECK_DRIVER_MSG);
} }
#if 0 /* stdin is already closed in OsInit() */
fclose(stdin);
#endif
xf86Info.consoleFd = fd; xf86Info.consoleFd = fd;
xf86Info.screenFd = fd;
switch (xf86Info.consType) switch (xf86Info.consType)
{ {
@ -292,7 +291,7 @@ acquire_vt:
{ {
FatalError("xf86OpenConsole: VT_SETMODE VT_PROCESS failed"); FatalError("xf86OpenConsole: VT_SETMODE VT_PROCESS failed");
} }
#if !defined(USE_DEV_IO) && !defined(USE_I386_IOPL) #if !defined(__OpenBSD__) && !defined(USE_DEV_IO) && !defined(USE_I386_IOPL)
if (ioctl(xf86Info.consoleFd, KDENABIO, 0) < 0) if (ioctl(xf86Info.consoleFd, KDENABIO, 0) < 0)
{ {
FatalError("xf86OpenConsole: KDENABIO failed (%s)", FatalError("xf86OpenConsole: KDENABIO failed (%s)",
@ -370,7 +369,6 @@ xf86OpenSyscons()
int fd = -1; int fd = -1;
vtmode_t vtmode; vtmode_t vtmode;
char vtname[12]; char vtname[12];
struct stat status;
long syscons_version; long syscons_version;
MessageType from; MessageType from;
@ -423,20 +421,11 @@ xf86OpenSyscons()
{ {
/* /*
* All VTs are in use. If initialVT was found, use it. * All VTs are in use. If initialVT was found, use it.
* Otherwise, if stdin is a VT, use that one.
* XXX stdin is already closed, so this won't work.
*/ */
if (initialVT != -1) if (initialVT != -1)
{ {
xf86Info.vtno = initialVT; xf86Info.vtno = initialVT;
} }
else if ((fstat(0, &status) >= 0)
&& S_ISCHR(status.st_mode)
&& (ioctl(0, VT_GETMODE, &vtmode) >= 0))
{
/* stdin is a VT */
xf86Info.vtno = minor(status.st_rdev) + 1;
}
else else
{ {
if (syscons_version >= 0x100) if (syscons_version >= 0x100)
@ -457,11 +446,7 @@ xf86OpenSyscons()
} }
close(fd); close(fd);
#ifndef __OpenBSD__
sprintf(vtname, "/dev/ttyv%01x", xf86Info.vtno - 1); sprintf(vtname, "/dev/ttyv%01x", xf86Info.vtno - 1);
#else
sprintf(vtname, "/dev/ttyC%01x", xf86Info.vtno - 1);
#endif
if ((fd = open(vtname, SYSCONS_CONSOLE_MODE, 0)) < 0) if ((fd = open(vtname, SYSCONS_CONSOLE_MODE, 0)) < 0)
{ {
FatalError("xf86OpenSyscons: Cannot open %s (%s)", FatalError("xf86OpenSyscons: Cannot open %s (%s)",
@ -506,7 +491,6 @@ xf86OpenPcvt()
int fd = -1; int fd = -1;
vtmode_t vtmode; vtmode_t vtmode;
char vtname[12], *vtprefix; char vtname[12], *vtprefix;
struct stat status;
struct pcvtid pcvt_version; struct pcvtid pcvt_version;
#ifndef __OpenBSD__ #ifndef __OpenBSD__
@ -552,20 +536,11 @@ xf86OpenPcvt()
{ {
/* /*
* All VTs are in use. If initialVT was found, use it. * All VTs are in use. If initialVT was found, use it.
* Otherwise, if stdin is a VT, use that one.
* XXX stdin is already closed, so this won't work.
*/ */
if (initialVT != -1) if (initialVT != -1)
{ {
xf86Info.vtno = initialVT; xf86Info.vtno = initialVT;
} }
else if ((fstat(0, &status) >= 0)
&& S_ISCHR(status.st_mode)
&& (ioctl(0, VT_GETMODE, &vtmode) >= 0))
{
/* stdin is a VT */
xf86Info.vtno = minor(status.st_rdev) + 1;
}
else else
{ {
FatalError("%s: Cannot find a free VT", FatalError("%s: Cannot find a free VT",
@ -673,7 +648,7 @@ xf86CloseConsole()
VT.mode = VT_AUTO; VT.mode = VT_AUTO;
ioctl(xf86Info.consoleFd, VT_SETMODE, &VT); /* dflt vt handling */ ioctl(xf86Info.consoleFd, VT_SETMODE, &VT); /* dflt vt handling */
} }
#if !defined(OpenBSD) && !defined(USE_DEV_IO) && !defined(USE_I386_IOPL) #if !defined(__OpenBSD__) && !defined(USE_DEV_IO) && !defined(USE_I386_IOPL)
if (ioctl(xf86Info.consoleFd, KDDISABIO, 0) < 0) if (ioctl(xf86Info.consoleFd, KDDISABIO, 0) < 0)
{ {
xf86FatalError("xf86CloseConsole: KDDISABIO failed (%s)", xf86FatalError("xf86CloseConsole: KDDISABIO failed (%s)",
@ -688,25 +663,17 @@ xf86CloseConsole()
case WSCONS: case WSCONS:
{ {
int mode = WSDISPLAYIO_MODE_EMUL; int mode = WSDISPLAYIO_MODE_EMUL;
ioctl(xf86Info.screenFd, WSDISPLAYIO_SMODE, &mode); ioctl(xf86Info.consoleFd, WSDISPLAYIO_SMODE, &mode);
break; break;
} }
#endif #endif
} }
if (xf86Info.screenFd != xf86Info.consoleFd)
{
close(xf86Info.screenFd);
close(xf86Info.consoleFd);
if ((xf86Info.consoleFd = open("/dev/console",O_RDONLY,0)) <0)
{
xf86FatalError("xf86CloseConsole: Cannot open /dev/console (%s)",
strerror(errno));
}
}
close(xf86Info.consoleFd); close(xf86Info.consoleFd);
#ifdef PCCONS_SUPPORT
if (devConsoleFd >= 0) if (devConsoleFd >= 0)
close(devConsoleFd); close(devConsoleFd);
#endif
return; return;
} }

View File

@ -258,7 +258,7 @@ mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
base = mmap(0, Size, base = mmap(0, Size,
(flags & VIDMEM_READONLY) ? (flags & VIDMEM_READONLY) ?
PROT_READ : (PROT_READ | PROT_WRITE), PROT_READ : (PROT_READ | PROT_WRITE),
MAP_FLAGS, xf86Info.screenFd, MAP_FLAGS, xf86Info.consoleFd,
(unsigned long)Base - 0xA0000 (unsigned long)Base - 0xA0000
); );
if (base == MAP_FAILED) if (base == MAP_FAILED)

View File

@ -73,7 +73,7 @@ volatile unsigned char *ioBase = MAP_FAILED;
static pointer static pointer
ppcMapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags) ppcMapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
{ {
int fd = xf86Info.screenFd; int fd = xf86Info.consoleFd;
pointer base; pointer base;
#ifdef DEBUG #ifdef DEBUG
xf86MsgVerb(X_INFO, 3, "mapVidMem %lx, %lx, fd = %d", xf86MsgVerb(X_INFO, 3, "mapVidMem %lx, %lx, fd = %d",
@ -125,7 +125,7 @@ xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf,
Bool xf86EnableIO() Bool xf86EnableIO()
{ {
int fd = xf86Info.screenFd; int fd = xf86Info.consoleFd;
xf86MsgVerb(X_WARNING, 3, "xf86EnableIO %d\n", fd); xf86MsgVerb(X_WARNING, 3, "xf86EnableIO %d\n", fd);
if (ioBase == MAP_FAILED) if (ioBase == MAP_FAILED)

View File

@ -58,7 +58,7 @@ static pointer
sparc64MapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, sparc64MapVidMem(int ScreenNum, unsigned long Base, unsigned long Size,
int flags) int flags)
{ {
int fd = xf86Info.screenFd; int fd = xf86Info.consoleFd;
pointer base; pointer base;
#ifdef DEBUG #ifdef DEBUG

View File

@ -168,11 +168,6 @@
# define POSIX_TTY # define POSIX_TTY
# endif /* SVR4 */ # endif /* SVR4 */
# if defined(sun) && defined(HAS_USL_VTS)
# define USE_VT_SYSREQ
# endif
#endif /* (SYSV || SVR4) */ #endif /* (SYSV || SVR4) */
/**************************************************************************/ /**************************************************************************/
@ -207,7 +202,6 @@
# define LDSMAP PIO_SCRNMAP # define LDSMAP PIO_SCRNMAP
# define LDNMAP LDSMAP # define LDNMAP LDSMAP
# define CLEARDTR_SUPPORT # define CLEARDTR_SUPPORT
# define USE_VT_SYSREQ
# endif # endif
# define POSIX_TTY # define POSIX_TTY
@ -266,9 +260,6 @@
# else /* __bsdi__ */ # else /* __bsdi__ */
# ifdef SYSCONS_SUPPORT # ifdef SYSCONS_SUPPORT
# define COMPAT_SYSCONS # define COMPAT_SYSCONS
# if defined(__NetBSD__) || defined(__OpenBSD__)
# include <machine/console.h>
# else
# if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) # if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
# if defined(__DragonFly__) || (__FreeBSD_kernel_version >= 410000) # if defined(__DragonFly__) || (__FreeBSD_kernel_version >= 410000)
# include <sys/consio.h> # include <sys/consio.h>
@ -279,22 +270,15 @@
# else # else
# include <sys/console.h> # include <sys/console.h>
# endif # endif
# endif
# endif /* SYSCONS_SUPPORT */ # endif /* SYSCONS_SUPPORT */
# if defined(PCVT_SUPPORT) # if defined(PCVT_SUPPORT) && !defined(__NetBSD__) && !defined(__OpenBSD__)
# if !defined(SYSCONS_SUPPORT) # if !defined(SYSCONS_SUPPORT)
/* no syscons, so include pcvt specific header file */ /* no syscons, so include pcvt specific header file */
# if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) # if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
# include <machine/pcvt_ioctl.h> # include <machine/pcvt_ioctl.h>
# else # else
# if defined(__NetBSD__) || defined(__OpenBSD__)
# if !defined(WSCONS_SUPPORT)
# include <machine/pcvt_ioctl.h>
# endif /* WSCONS_SUPPORT */
# else
# include <sys/pcvt_ioctl.h> # include <sys/pcvt_ioctl.h>
# endif /* __NetBSD__ */ # endif /* __FreeBSD_kernel__ */
# endif /* __FreeBSD_kernel__ || __OpenBSD__ */
# else /* pcvt and syscons: hard-code the ID magic */ # else /* pcvt and syscons: hard-code the ID magic */
# define VGAPCVTID _IOWR('V',113, struct pcvtid) # define VGAPCVTID _IOWR('V',113, struct pcvtid)
struct pcvtid { struct pcvtid {
@ -353,10 +337,6 @@
# define CLEARDTR_SUPPORT # define CLEARDTR_SUPPORT
# if defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT) || defined(WSCONS_SUPPORT)
# define USE_VT_SYSREQ
# endif
#endif #endif
/* __FreeBSD_kernel__ || __NetBSD__ || __OpenBSD__ || __bsdi__ */ /* __FreeBSD_kernel__ || __NetBSD__ || __OpenBSD__ || __bsdi__ */

View File

@ -207,8 +207,6 @@ typedef enum {
XKBLAYOUT, XKBLAYOUT,
XKBVARIANT, XKBVARIANT,
XKBOPTIONS, XKBOPTIONS,
/* The next two have become ServerFlags options */
VTSYSREQ,
/* Obsolete keyboard tokens */ /* Obsolete keyboard tokens */
SERVERNUM, SERVERNUM,
LEFTALT, LEFTALT,