summaryrefslogtreecommitdiff
path: root/os/utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'os/utils.c')
-rw-r--r--os/utils.c44
1 files changed, 42 insertions, 2 deletions
diff --git a/os/utils.c b/os/utils.c
index 60e828e28..d96acded3 100644
--- a/os/utils.c
+++ b/os/utils.c
@@ -122,6 +122,8 @@ __stdcall unsigned long GetTickCount(void);
#include "picture.h"
+Bool install_os_signal_handler = TRUE;
+
Bool noTestExtensions;
#ifdef COMPOSITE
@@ -255,7 +257,7 @@ UnlockServer(void)
#else /* LOCK_SERVER */
static Bool StillLocking = FALSE;
static char LockFile[PATH_MAX];
-static Bool nolock = FALSE;
+Bool nolock = FALSE;
/*
* LockServer --
@@ -522,6 +524,7 @@ UseMsg(void)
#ifdef RLIMIT_STACK
ErrorF("-ls int limit stack space to N Kb\n");
#endif
+ ErrorF("-notrapsignals disable catching of fatal signals\n");
#ifdef LOCK_SERVER
ErrorF("-nolock disable the locking mechanism\n");
#endif
@@ -614,6 +617,7 @@ ProcessCommandLine(int argc, char *argv[])
else if (argv[i][0] == ':') {
/* initialize display */
display = argv[i];
+ explicit_display = TRUE;
display++;
if (!VerifyDisplayName(display)) {
ErrorF("Bad display name: %s\n", display);
@@ -684,7 +688,6 @@ ProcessCommandLine(int argc, char *argv[])
else if (strcmp(argv[i], "-displayfd") == 0) {
if (++i < argc) {
displayfd = atoi(argv[i]);
- display = NULL;
#ifdef LOCK_SERVER
nolock = TRUE;
#endif
@@ -767,6 +770,9 @@ ProcessCommandLine(int argc, char *argv[])
UseMsg();
}
#endif
+ else if (strcmp(argv[i], "-notrapsignals") == 0) {
+ install_os_signal_handler = FALSE;
+ }
#ifdef LOCK_SERVER
else if (strcmp(argv[i], "-nolock") == 0) {
#if !defined(WIN32) && !defined(__CYGWIN__)
@@ -905,6 +911,7 @@ ProcessCommandLine(int argc, char *argv[])
}
else if (strcmp(argv[i], "-schedInterval") == 0) {
if (++i < argc) {
+ SmartScheduleDisable = FALSE;
SmartScheduleInterval = atoi(argv[i]);
SmartScheduleSlice = SmartScheduleInterval;
}
@@ -913,6 +920,7 @@ ProcessCommandLine(int argc, char *argv[])
}
else if (strcmp(argv[i], "-schedMax") == 0) {
if (++i < argc) {
+ SmartScheduleDisable = FALSE;
SmartScheduleMaxSlice = atoi(argv[i]);
}
else
@@ -1310,6 +1318,26 @@ OsAbort(void)
* as well. As it is now, xkbcomp messages don't end up in the log file.
*/
+#ifdef __CYGWIN__
+#include <process.h>
+int
+System(const char *command)
+{
+ int status;
+
+ if (!command)
+ return 1;
+
+ DebugF("System: `%s'\n", command);
+
+ /*
+ Use spawnl() rather than execl() to implement System() on cygwin to
+ avoid fork emulation overhead and brittleness
+ */
+ status = spawnl(_P_WAIT, "/bin/sh", "sh", "-c", command, (char *) NULL);
+ return status;
+}
+#else
int
System(const char *command)
{
@@ -1351,6 +1379,7 @@ System(const char *command)
return p == -1 ? -1 : status;
}
+#endif
static struct pid {
struct pid *next;
@@ -1662,6 +1691,17 @@ System(const char *cmdline)
return dwExitCode;
}
+#elif defined(__CYGWIN__)
+const char*
+Win32TempDir(void)
+{
+ if (getenv("TEMP") != NULL)
+ return getenv("TEMP");
+ else if (getenv("TMP") != NULL)
+ return getenv("TMP");
+ else
+ return "/tmp";
+}
#endif
/*