diff options
Diffstat (limited to 'xorg-server/hw/xfree86')
-rw-r--r-- | xorg-server/hw/xfree86/common/xf86Config.c | 3 | ||||
-rw-r--r-- | xorg-server/hw/xfree86/common/xf86Configure.c | 2 | ||||
-rw-r--r-- | xorg-server/hw/xfree86/common/xf86Helper.c | 4 | ||||
-rw-r--r-- | xorg-server/hw/xfree86/common/xf86Init.c | 40 | ||||
-rw-r--r-- | xorg-server/hw/xfree86/common/xf86Option.c | 2 | ||||
-rw-r--r-- | xorg-server/hw/xfree86/common/xf86Priv.h | 2 | ||||
-rw-r--r-- | xorg-server/hw/xfree86/common/xf86ShowOpts.c | 260 | ||||
-rw-r--r-- | xorg-server/hw/xfree86/common/xf86Xinput.c | 1 |
8 files changed, 170 insertions, 144 deletions
diff --git a/xorg-server/hw/xfree86/common/xf86Config.c b/xorg-server/hw/xfree86/common/xf86Config.c index 4047350c4..19af91509 100644 --- a/xorg-server/hw/xfree86/common/xf86Config.c +++ b/xorg-server/hw/xfree86/common/xf86Config.c @@ -1222,6 +1222,7 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout) devs = xnfrealloc(servlayoutp->inputs,
(count + 1) * sizeof(InputInfoPtr));
devs[count - 1] = xnfalloc(sizeof(InputInfoRec));
+ Pointer.fd = -1;
*devs[count - 1] = Pointer;
devs[count - 1]->options =
xf86addNewOption(devs[count -1]->options,
@@ -1267,6 +1268,7 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout) devs = xnfrealloc(servlayoutp->inputs,
(count + 1) * sizeof(InputInfoPtr));
devs[count - 1] = xnfalloc(sizeof(InputInfoRec));
+ Pointer.fd = -1;
*devs[count - 1] = Pointer;
devs[count - 1]->options =
xf86addNewOption(NULL, xnfstrdup("AlwaysCore"), NULL);
@@ -1363,6 +1365,7 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout) devs = xnfrealloc(servlayoutp->inputs,
(count + 1) * sizeof(InputInfoPtr));
devs[count - 1] = xnfalloc(sizeof(InputInfoRec));
+ Keyboard.fd = -1;
*devs[count - 1] = Keyboard;
devs[count - 1]->options =
xf86addNewOption(devs[count - 1]->options,
diff --git a/xorg-server/hw/xfree86/common/xf86Configure.c b/xorg-server/hw/xfree86/common/xf86Configure.c index ba0628ffd..aabb8e11b 100644 --- a/xorg-server/hw/xfree86/common/xf86Configure.c +++ b/xorg-server/hw/xfree86/common/xf86Configure.c @@ -749,7 +749,7 @@ DoConfigure(void) bail:
OsCleanup(TRUE);
- AbortDDX();
+ AbortDDX(EXIT_ERR_CONFIGURE);
fflush(stderr);
exit(0);
}
diff --git a/xorg-server/hw/xfree86/common/xf86Helper.c b/xorg-server/hw/xfree86/common/xf86Helper.c index da15b0503..a210df042 100644 --- a/xorg-server/hw/xfree86/common/xf86Helper.c +++ b/xorg-server/hw/xfree86/common/xf86Helper.c @@ -1198,9 +1198,9 @@ xf86LogInit(void) }
void
-xf86CloseLog(void)
+xf86CloseLog(enum ExitCode error)
{
- LogClose();
+ LogClose(error);
}
diff --git a/xorg-server/hw/xfree86/common/xf86Init.c b/xorg-server/hw/xfree86/common/xf86Init.c index 44071996c..94e1a5dbd 100644 --- a/xorg-server/hw/xfree86/common/xf86Init.c +++ b/xorg-server/hw/xfree86/common/xf86Init.c @@ -791,6 +791,21 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv) NULL);
}
+static InputInfoPtr
+duplicateDevice(InputInfoPtr pInfo)
+{
+ InputInfoPtr dup = calloc(1, sizeof(InputInfoRec));
+ if (dup) {
+ dup->name = strdup(pInfo->name);
+ dup->driver = strdup(pInfo->driver);
+ dup->options = xf86OptionListDuplicate(pInfo->options);
+ /* type_name is a const string */
+ dup->type_name = pInfo->type_name;
+ dup->fd = -1;
+ }
+ return dup;
+}
+
/*
* InitInput --
* Initialize all supported input devices.
@@ -799,7 +814,7 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv) void
InitInput(int argc, char **argv)
{
- InputInfoPtr* pDev;
+ InputInfoPtr* pInfo;
DeviceIntPtr dev;
xf86Info.vtRequestsPending = FALSE;
@@ -807,14 +822,21 @@ InitInput(int argc, char **argv) mieqInit();
/* Initialize all configured input devices */
- for (pDev = xf86ConfigLayout.inputs; pDev && *pDev; pDev++) {
+ for (pInfo = xf86ConfigLayout.inputs; pInfo && *pInfo; pInfo++) {
+ InputInfoPtr dup;
/* Replace obsolete keyboard driver with kbd */
- if (!xf86NameCmp((*pDev)->driver, "keyboard")) {
- strcpy((*pDev)->driver, "kbd");
+ if (!xf86NameCmp((*pInfo)->driver, "keyboard")) {
+ strcpy((*pInfo)->driver, "kbd");
}
+ /* Data passed into xf86NewInputDevice will be freed on shutdown.
+ * Duplicate from xf86ConfigLayout.inputs, otherwise we don't have any
+ * xorg.conf input devices in the second generation
+ */
+ dup = duplicateDevice(*pInfo);
+
/* If one fails, the others will too */
- if (xf86NewInputDevice(*pDev, &dev, TRUE) == BadAlloc)
+ if (xf86NewInputDevice(dup, &dev, TRUE) == BadAlloc)
break;
}
@@ -880,7 +902,7 @@ OsVendorInit(void) */
void
-ddxGiveUp(void)
+ddxGiveUp(enum ExitCode error)
{
int i;
@@ -907,7 +929,7 @@ ddxGiveUp(void) if (xorgHWOpenConsole)
xf86CloseConsole();
- xf86CloseLog();
+ xf86CloseLog(error);
/* If an unexpected signal was caught, dump a core for debugging */
if (xf86Info.caughtSignal)
@@ -924,7 +946,7 @@ ddxGiveUp(void) */
void
-AbortDDX(void)
+AbortDDX(enum ExitCode error)
{
int i;
@@ -957,7 +979,7 @@ AbortDDX(void) * This is needed for an abnormal server exit, since the normal exit stuff
* MUST also be performed (i.e. the vt must be left in a defined state)
*/
- ddxGiveUp();
+ ddxGiveUp(error);
}
void
diff --git a/xorg-server/hw/xfree86/common/xf86Option.c b/xorg-server/hw/xfree86/common/xf86Option.c index 08f143347..576796d6c 100644 --- a/xorg-server/hw/xfree86/common/xf86Option.c +++ b/xorg-server/hw/xfree86/common/xf86Option.c @@ -340,7 +340,7 @@ pointer xf86AddNewOption(pointer head, const char *name, const char *val)
{
/* XXX These should actually be allocated in the parser library. */
- char *tmp = strdup(val);
+ char *tmp = val ? strdup(val) : NULL;
char *tmp_name = strdup(name);
return xf86addNewOption(head, tmp_name, tmp);
diff --git a/xorg-server/hw/xfree86/common/xf86Priv.h b/xorg-server/hw/xfree86/common/xf86Priv.h index a77d38fd3..436594ba6 100644 --- a/xorg-server/hw/xfree86/common/xf86Priv.h +++ b/xorg-server/hw/xfree86/common/xf86Priv.h @@ -140,7 +140,7 @@ extern _X_EXPORT pmWait (*xf86PMConfirmEventToOs)(int fd,pmEvent event); /* xf86Helper.c */
extern _X_EXPORT void xf86LogInit(void);
-extern _X_EXPORT void xf86CloseLog(void);
+extern _X_EXPORT void xf86CloseLog(enum ExitCode error);
/* xf86Init.c */
extern _X_EXPORT Bool xf86LoadModules(char **list, pointer *optlist);
diff --git a/xorg-server/hw/xfree86/common/xf86ShowOpts.c b/xorg-server/hw/xfree86/common/xf86ShowOpts.c index 7aa79eb6a..a8059168d 100644 --- a/xorg-server/hw/xfree86/common/xf86ShowOpts.c +++ b/xorg-server/hw/xfree86/common/xf86ShowOpts.c @@ -1,130 +1,130 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86ShopwOpts.c,v 3.80 2003/10/08 14:58:27 dawes Exp $ */
-/*
- * Copyright 2000-2002 by Alan Hourihane, Flint Mountain, North Wales.
- *
- * 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 Alan Hourihane not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Alan Hourihane makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL ALAN HOURIHANE 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.
- *
- * Author: Marcus Schaefer, ms@suse.de
- *
- */
-
-#include <ctype.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <X11/X.h>
-#include <X11/Xmd.h>
-#include "os.h"
-#ifdef XFree86LOADER
-#include "loaderProcs.h"
-#endif
-#include "xf86.h"
-#include "xf86Config.h"
-#include "xf86_OSlib.h"
-#include "xf86Priv.h"
-/* #include "xf86PciData.h" */
-#define IN_XSERVER
-#include "xf86Parser.h"
-#include "xf86tokens.h"
-#include "Configint.h"
-#include "xf86DDC.h"
-#if defined(__sparc__) && !defined(__OpenBSD__)
-#include "xf86Bus.h"
-#include "xf86Sbus.h"
-#endif
-#include "globals.h"
-
-static const char*
-optionTypeToSting(OptionValueType type)
-{
- switch (type) {
- case OPTV_NONE:
- return "";
- case OPTV_INTEGER:
- return "<int>";
- case OPTV_STRING:
- return "<str>";
- case OPTV_ANYSTR:
- return "<str>";
- case OPTV_REAL:
- return "<real>";
- case OPTV_BOOLEAN:
- return "<bool>";
- case OPTV_FREQ:
- return "<freq>";
- case OPTV_PERCENT:
- return "<percent>";
- default:
- return "<undef>";
- }
-}
-
-void DoShowOptions (void) {
- int i = 0;
- char **vlist = 0;
- char *pSymbol = 0;
- XF86ModuleData *initData = 0;
- if (! (vlist = xf86DriverlistFromCompile())) {
- ErrorF("Missing output drivers\n");
- goto bail;
- }
- xf86LoadModules (vlist,0);
- free(vlist);
- for (i = 0; i < xf86NumDrivers; i++) {
- if (xf86DriverList[i]->AvailableOptions) {
- OptionInfoPtr pOption = (OptionInfoPtr)(*xf86DriverList[i]->AvailableOptions)(0,0);
- if (! pOption) {
- ErrorF ("(EE) Couldn't read option table for %s driver\n",
- xf86DriverList[i]->driverName
- );
- continue;
- }
- XNFasprintf(&pSymbol, "%sModuleData",
- xf86DriverList[i]->driverName);
- initData = LoaderSymbol (pSymbol);
- if (initData) {
- XF86ModuleVersionInfo *vers = initData->vers;
- OptionInfoPtr p;
- ErrorF ("Driver[%d]:%s[%s] {\n",
- i,xf86DriverList[i]->driverName,vers->vendor
- );
- for (p = pOption; p->name != NULL; p++) {
- const char *opttype = optionTypeToSting(p->type);
- /* XXX: Why overallocate by 2 bytes?
- * Otherwise, this would be strdup()
- */
- char *optname = malloc(strlen(p->name) + 2 + 1);
- if (!optname) {
- continue;
- }
- sprintf(optname, "%s", p->name);
- ErrorF ("\t%s:%s\n", optname,opttype);
- }
- ErrorF ("}\n");
- }
- }
- }
- bail:
- OsCleanup (TRUE);
- AbortDDX ();
- fflush (stderr);
- exit (0);
-}
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86ShopwOpts.c,v 3.80 2003/10/08 14:58:27 dawes Exp $ */ +/* + * Copyright 2000-2002 by Alan Hourihane, Flint Mountain, North Wales. + * + * 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 Alan Hourihane not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Alan Hourihane makes no representations + * about the suitability of this software for any purpose. It is provided + * "as is" without express or implied warranty. + * + * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL ALAN HOURIHANE 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. + * + * Author: Marcus Schaefer, ms@suse.de + * + */ + +#include <ctype.h> +#include <stdlib.h> +#include <unistd.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> +#include <X11/X.h> +#include <X11/Xmd.h> +#include "os.h" +#ifdef XFree86LOADER +#include "loaderProcs.h" +#endif +#include "xf86.h" +#include "xf86Config.h" +#include "xf86_OSlib.h" +#include "xf86Priv.h" +/* #include "xf86PciData.h" */ +#define IN_XSERVER +#include "xf86Parser.h" +#include "xf86tokens.h" +#include "Configint.h" +#include "xf86DDC.h" +#if defined(__sparc__) && !defined(__OpenBSD__) +#include "xf86Bus.h" +#include "xf86Sbus.h" +#endif +#include "globals.h" + +static const char* +optionTypeToSting(OptionValueType type) +{ + switch (type) { + case OPTV_NONE: + return ""; + case OPTV_INTEGER: + return "<int>"; + case OPTV_STRING: + return "<str>"; + case OPTV_ANYSTR: + return "<str>"; + case OPTV_REAL: + return "<real>"; + case OPTV_BOOLEAN: + return "<bool>"; + case OPTV_FREQ: + return "<freq>"; + case OPTV_PERCENT: + return "<percent>"; + default: + return "<undef>"; + } +} + +void DoShowOptions (void) { + int i = 0; + char **vlist = 0; + char *pSymbol = 0; + XF86ModuleData *initData = 0; + if (! (vlist = xf86DriverlistFromCompile())) { + ErrorF("Missing output drivers\n"); + goto bail; + } + xf86LoadModules (vlist,0); + free(vlist); + for (i = 0; i < xf86NumDrivers; i++) { + if (xf86DriverList[i]->AvailableOptions) { + OptionInfoPtr pOption = (OptionInfoPtr)(*xf86DriverList[i]->AvailableOptions)(0,0); + if (! pOption) { + ErrorF ("(EE) Couldn't read option table for %s driver\n", + xf86DriverList[i]->driverName + ); + continue; + } + XNFasprintf(&pSymbol, "%sModuleData", + xf86DriverList[i]->driverName); + initData = LoaderSymbol (pSymbol); + if (initData) { + XF86ModuleVersionInfo *vers = initData->vers; + OptionInfoPtr p; + ErrorF ("Driver[%d]:%s[%s] {\n", + i,xf86DriverList[i]->driverName,vers->vendor + ); + for (p = pOption; p->name != NULL; p++) { + const char *opttype = optionTypeToSting(p->type); + /* XXX: Why overallocate by 2 bytes? + * Otherwise, this would be strdup() + */ + char *optname = malloc(strlen(p->name) + 2 + 1); + if (!optname) { + continue; + } + sprintf(optname, "%s", p->name); + ErrorF ("\t%s:%s\n", optname,opttype); + } + ErrorF ("}\n"); + } + } + } + bail: + OsCleanup (TRUE); + AbortDDX (EXIT_ERR_DRIVERS); + fflush (stderr); + exit (0); +} diff --git a/xorg-server/hw/xfree86/common/xf86Xinput.c b/xorg-server/hw/xfree86/common/xf86Xinput.c index afef0994d..a53531cc1 100644 --- a/xorg-server/hw/xfree86/common/xf86Xinput.c +++ b/xorg-server/hw/xfree86/common/xf86Xinput.c @@ -844,6 +844,7 @@ xf86NewInputDevice(InputInfoPtr pInfo, DeviceIntPtr *pdev, BOOL enable) {
OsReleaseSignals();
xf86Msg(X_ERROR, "Couldn't init device \"%s\"\n", pInfo->name);
+ RemoveDevice(dev, TRUE);
rval = BadMatch;
goto unwind;
}
|