[PATCH 6/9] os/utils.c: Provide only stubs for Lock/UnlockServer on WIN32

Jon TURNEY jon.turney at dronecode.org.uk
Wed Jan 11 12:13:26 PST 2012


From: Ryan Pavlik <rpavlik at iastate.edu>

MinGW and MSVC lack the POSIX functions to compile the lock file code.

Reviewed-by: Jon TURNEY <jon.turney at dronecode.org.uk>
---
 os/utils.c |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/os/utils.c b/os/utils.c
index 3c07f9c..5ef37ac 100644
--- a/os/utils.c
+++ b/os/utils.c
@@ -237,6 +237,19 @@ OsSignal(int sig, OsSigHandlerPtr handler)
 #define LOCK_PREFIX "/.X"
 #define LOCK_SUFFIX "-lock"
 
+#if !defined(WIN32) || defined(__CYGWIN__)
+#define LOCK_SERVER
+#endif
+
+#ifndef LOCK_SERVER
+void
+LockServer(void)
+{}
+
+void
+UnlockServer(void)
+{}
+#else /* LOCK_SERVER */
 static Bool StillLocking = FALSE;
 static char LockFile[PATH_MAX];
 static Bool nolock = FALSE;
@@ -381,6 +394,7 @@ UnlockServer(void)
   (void) unlink(LockFile);
   }
 }
+#endif /* LOCK_SERVER */
 
 /* Force connections to close on SIGHUP from init */
 
@@ -502,7 +516,9 @@ void UseMsg(void)
 #ifdef RLIMIT_STACK
     ErrorF("-ls int                limit stack space to N Kb\n");
 #endif
+#ifdef LOCK_SERVER
     ErrorF("-nolock                disable the locking mechanism\n");
+#endif
     ErrorF("-nolisten string       don't listen on protocol\n");
     ErrorF("-noreset               don't reset after last client exists\n");
     ErrorF("-background [none]     create root window with no background\n");
@@ -751,6 +767,8 @@ ProcessCommandLine(int argc, char *argv[])
 		UseMsg();
 	}
 #endif
+
+#ifdef LOCK_SERVER
 	else if ( strcmp ( argv[i], "-nolock") == 0)
 	{
 #if !defined(WIN32) && !defined(__CYGWIN__)
@@ -760,6 +778,8 @@ ProcessCommandLine(int argc, char *argv[])
 #endif
 	    nolock = TRUE;
 	}
+#endif
+
 	else if ( strcmp( argv[i], "-nolisten") == 0)
 	{
             if(++i < argc) {
-- 
1.7.5.1



More information about the xorg-devel mailing list