Merge remote-tracking branch 'jturney/master'

This commit is contained in:
Keith Packard 2012-10-29 09:09:16 -07:00
commit 74a3130426
4 changed files with 37 additions and 8 deletions

View File

@ -420,7 +420,7 @@ case $host_os in
darwin*) darwin*)
AC_DEFINE(CSRG_BASED, 1, [System is BSD-like]) AC_DEFINE(CSRG_BASED, 1, [System is BSD-like])
;; ;;
cygwin*) cygwin*|mingw*)
CFLAGS="$CFLAGS -DFD_SETSIZE=256" CFLAGS="$CFLAGS -DFD_SETSIZE=256"
;; ;;
esac esac
@ -1904,7 +1904,7 @@ if test "x$XWIN" = xyes; then
XWIN_SERVER_NAME=Xming XWIN_SERVER_NAME=Xming
AC_DEFINE(RELOCATE_PROJECTROOT,1,[Make PROJECT_ROOT relative to the xserver location]) AC_DEFINE(RELOCATE_PROJECTROOT,1,[Make PROJECT_ROOT relative to the xserver location])
AC_DEFINE(HAS_WINSOCK,1,[Use Windows sockets]) AC_DEFINE(HAS_WINSOCK,1,[Use Windows sockets])
XWIN_SYS_LIBS=-lws2_32 XWIN_SYS_LIBS="-lpthread -lws2_32"
;; ;;
esac esac

View File

@ -35,7 +35,7 @@ The server will not build if your toolchain does not support these extensions.
* interleaved code and declarations: { foo = TRUE; int bar; do_stuff(); } * interleaved code and declarations: { foo = TRUE; int bar; do_stuff(); }
Use of OS and library facilities throughout the X server tree Use of library facilities throughout the X server tree
------------------------------------------------------------- -------------------------------------------------------------
Non-OS-dependent code can assume facilities at least as good as Non-OS-dependent code can assume facilities at least as good as
@ -44,6 +44,17 @@ be C99, but even gcc+glibc doesn't implement that yet.
Unix-like systems are assumed to be at least as good as UNIX03. Unix-like systems are assumed to be at least as good as UNIX03.
Note that there are two Windows ports, Cygwin and MinGW:
- Cygwin is more or less like Linux.
- MinGW is more restrictive. Windows does not provide the required
POSIX facilities, so some non-OS-dependent code is stubbed out or
has an alternate implementation if WIN32 is defined. Code that
needs to be portable to Windows should be careful to, well, be portable.
Required OS facilities
-------------------------------------------------------------
Linux systems must be at least 2.4 or later. As a practical matter Linux systems must be at least 2.4 or later. As a practical matter
though, 2.4 kernels never receive any testing. Use 2.6 already. though, 2.4 kernels never receive any testing. Use 2.6 already.
@ -51,11 +62,7 @@ TODO: Solaris.
TODO: *BSD. TODO: *BSD.
Code that needs to be portable to Windows should be careful to, Windows-dependent code assumes at least NT 5.1.
well, be portable. Note that there are two Windows ports, cygwin and
mingw. Cygwin is more or less like Linux, but mingw is a bit more
restrictive. TODO: document which versions of Windows we actually care
about.
OSX support is generally limited to the most recent version. Currently OSX support is generally limited to the most recent version. Currently
that means 10.5. that means 10.5.

View File

@ -645,6 +645,7 @@ winPrefsLoadPreferences(char *path)
if (path) if (path)
prefFile = fopen(path, "r"); prefFile = fopen(path, "r");
#ifdef __CYGWIN__
else { else {
char defaultPrefs[] = char defaultPrefs[] =
"MENU rmenu {\n" "MENU rmenu {\n"
@ -656,6 +657,7 @@ winPrefsLoadPreferences(char *path)
path = "built-in default"; path = "built-in default";
prefFile = fmemopen(defaultPrefs, strlen(defaultPrefs), "r"); prefFile = fmemopen(defaultPrefs, strlen(defaultPrefs), "r");
} }
#endif
if (!prefFile) { if (!prefFile) {
ErrorF("LoadPreferences: %s not found\n", path); ErrorF("LoadPreferences: %s not found\n", path);

View File

@ -235,6 +235,19 @@ OsSignal(int sig, OsSigHandlerPtr handler)
#define LOCK_PREFIX "/.X" #define LOCK_PREFIX "/.X"
#define LOCK_SUFFIX "-lock" #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 Bool StillLocking = FALSE;
static char LockFile[PATH_MAX]; static char LockFile[PATH_MAX];
static Bool nolock = FALSE; static Bool nolock = FALSE;
@ -382,6 +395,7 @@ UnlockServer(void)
(void) unlink(LockFile); (void) unlink(LockFile);
} }
} }
#endif /* LOCK_SERVER */
/* Force connections to close on SIGHUP from init */ /* Force connections to close on SIGHUP from init */
@ -503,7 +517,9 @@ UseMsg(void)
#ifdef RLIMIT_STACK #ifdef RLIMIT_STACK
ErrorF("-ls int limit stack space to N Kb\n"); ErrorF("-ls int limit stack space to N Kb\n");
#endif #endif
#ifdef LOCK_SERVER
ErrorF("-nolock disable the locking mechanism\n"); ErrorF("-nolock disable the locking mechanism\n");
#endif
ErrorF("-nolisten string don't listen on protocol\n"); ErrorF("-nolisten string don't listen on protocol\n");
ErrorF("-noreset don't reset after last client exists\n"); ErrorF("-noreset don't reset after last client exists\n");
ErrorF("-background [none] create root window with no background\n"); ErrorF("-background [none] create root window with no background\n");
@ -664,7 +680,9 @@ ProcessCommandLine(int argc, char *argv[])
if (++i < argc) { if (++i < argc) {
displayfd = atoi(argv[i]); displayfd = atoi(argv[i]);
display = NULL; display = NULL;
#ifdef LOCK_SERVER
nolock = TRUE; nolock = TRUE;
#endif
} }
else else
UseMsg(); UseMsg();
@ -744,6 +762,7 @@ ProcessCommandLine(int argc, char *argv[])
UseMsg(); UseMsg();
} }
#endif #endif
#ifdef LOCK_SERVER
else if (strcmp(argv[i], "-nolock") == 0) { else if (strcmp(argv[i], "-nolock") == 0) {
#if !defined(WIN32) && !defined(__CYGWIN__) #if !defined(WIN32) && !defined(__CYGWIN__)
if (getuid() != 0) if (getuid() != 0)
@ -753,6 +772,7 @@ ProcessCommandLine(int argc, char *argv[])
#endif #endif
nolock = TRUE; nolock = TRUE;
} }
#endif
else if (strcmp(argv[i], "-nolisten") == 0) { else if (strcmp(argv[i], "-nolisten") == 0) {
if (++i < argc) { if (++i < argc) {
if (_XSERVTransNoListen(argv[i])) if (_XSERVTransNoListen(argv[i]))