diff options
author | marha <marha@users.sourceforge.net> | 2009-09-15 10:39:59 +0000 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2009-09-15 10:39:59 +0000 |
commit | a233ed27754bb0d373d63569d9a28aeb8fee5b82 (patch) | |
tree | 2732a9434bbc102653dc22df9887d94e19570836 /xorg-server/hw/xquartz/mach-startup | |
parent | a915739887477b28d924ecc8417ee107d125bd6c (diff) | |
download | vcxsrv-a233ed27754bb0d373d63569d9a28aeb8fee5b82.tar.gz vcxsrv-a233ed27754bb0d373d63569d9a28aeb8fee5b82.tar.bz2 vcxsrv-a233ed27754bb0d373d63569d9a28aeb8fee5b82.zip |
Checked in xorg-server-1.6.99.901
Diffstat (limited to 'xorg-server/hw/xquartz/mach-startup')
-rw-r--r-- | xorg-server/hw/xquartz/mach-startup/Makefile.am | 4 | ||||
-rw-r--r-- | xorg-server/hw/xquartz/mach-startup/Makefile.in | 58 | ||||
-rw-r--r-- | xorg-server/hw/xquartz/mach-startup/bundle-main.c | 57 | ||||
-rw-r--r-- | xorg-server/hw/xquartz/mach-startup/launchd_fd.c | 13 | ||||
-rw-r--r-- | xorg-server/hw/xquartz/mach-startup/stub.c | 10 |
5 files changed, 100 insertions, 42 deletions
diff --git a/xorg-server/hw/xquartz/mach-startup/Makefile.am b/xorg-server/hw/xquartz/mach-startup/Makefile.am index 2901b6559..334f06d43 100644 --- a/xorg-server/hw/xquartz/mach-startup/Makefile.am +++ b/xorg-server/hw/xquartz/mach-startup/Makefile.am @@ -3,7 +3,9 @@ AM_CPPFLAGS = \ -DXSERVER_VERSION=\"$(VERSION)\" \ -DX11BINDIR=\"$(bindir)\" -x11appdir = $(APPLE_APPLICATIONS_DIR)/X11.app/Contents/MacOS +AM_CFLAGS = $(XSERVER_CFLAGS) $(DIX_CFLAGS) + +x11appdir = $(APPLE_APPLICATIONS_DIR)/$(APPLE_APPLICATION_NAME).app/Contents/MacOS x11app_PROGRAMS = X11.bin dist_X11_bin_SOURCES = \ diff --git a/xorg-server/hw/xquartz/mach-startup/Makefile.in b/xorg-server/hw/xquartz/mach-startup/Makefile.in index 80720c35c..42fd1cf92 100644 --- a/xorg-server/hw/xquartz/mach-startup/Makefile.in +++ b/xorg-server/hw/xquartz/mach-startup/Makefile.in @@ -86,26 +86,41 @@ X11_bin_DEPENDENCIES = $(top_builddir)/hw/xquartz/libXquartz.la \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) $(am__append_1) \ $(am__append_4) -X11_bin_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ - --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(X11_bin_LDFLAGS) \ - $(LDFLAGS) -o $@ +AM_V_lt = $(am__v_lt_$(V)) +am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) +am__v_lt_0 = --silent +X11_bin_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(X11_bin_LDFLAGS) $(LDFLAGS) -o $@ dist_Xquartz_OBJECTS = stub.$(OBJEXT) launchd_fd.$(OBJEXT) nodist_Xquartz_OBJECTS = mach_startupUser.$(OBJEXT) Xquartz_OBJECTS = $(dist_Xquartz_OBJECTS) $(nodist_Xquartz_OBJECTS) Xquartz_LDADD = $(LDADD) -Xquartz_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ - --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(Xquartz_LDFLAGS) \ - $(LDFLAGS) -o $@ +Xquartz_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(Xquartz_LDFLAGS) $(LDFLAGS) -o $@ DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_$(V)) +am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) +am__v_CC_0 = @echo " CC " $@; +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +am__v_at_0 = @ CCLD = $(CC) -LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ - --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ - $(LDFLAGS) -o $@ +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_$(V)) +am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) +am__v_CCLD_0 = @echo " CCLD " $@; +AM_V_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; SOURCES = $(dist_X11_bin_SOURCES) $(nodist_X11_bin_SOURCES) \ $(dist_Xquartz_SOURCES) $(nodist_Xquartz_SOURCES) DIST_SOURCES = $(dist_X11_bin_SOURCES) $(dist_Xquartz_SOURCES) @@ -117,9 +132,9 @@ ADMIN_MAN_DIR = @ADMIN_MAN_DIR@ ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AM_MAKEFLAGS = @AM_MAKEFLAGS@ APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@ -APPLE_APPLICATION_ID = @APPLE_APPLICATION_ID@ APPLE_APPLICATION_NAME = @APPLE_APPLICATION_NAME@ APP_MAN_DIR = @APP_MAN_DIR@ APP_MAN_SUFFIX = @APP_MAN_SUFFIX@ @@ -208,6 +223,7 @@ KDRIVE_LIBS = @KDRIVE_LIBS@ KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@ KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@ KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@ +LAUNCHD_ID_PREFIX = @LAUNCHD_ID_PREFIX@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ @@ -408,7 +424,8 @@ AM_CPPFLAGS = \ -DXSERVER_VERSION=\"$(VERSION)\" \ -DX11BINDIR=\"$(bindir)\" -x11appdir = $(APPLE_APPLICATIONS_DIR)/X11.app/Contents/MacOS +AM_CFLAGS = $(XSERVER_CFLAGS) $(DIX_CFLAGS) +x11appdir = $(APPLE_APPLICATIONS_DIR)/$(APPLE_APPLICATION_NAME).app/Contents/MacOS dist_X11_bin_SOURCES = \ bundle-main.c @@ -574,10 +591,10 @@ clean-x11appPROGRAMS: rm -f $$list X11.bin$(EXEEXT): $(X11_bin_OBJECTS) $(X11_bin_DEPENDENCIES) @rm -f X11.bin$(EXEEXT) - $(X11_bin_LINK) $(X11_bin_OBJECTS) $(X11_bin_LDADD) $(LIBS) + $(AM_V_CCLD)$(X11_bin_LINK) $(X11_bin_OBJECTS) $(X11_bin_LDADD) $(LIBS) Xquartz$(EXEEXT): $(Xquartz_OBJECTS) $(Xquartz_DEPENDENCIES) @rm -f Xquartz$(EXEEXT) - $(Xquartz_LINK) $(Xquartz_OBJECTS) $(Xquartz_LDADD) $(LIBS) + $(AM_V_CCLD)$(Xquartz_LINK) $(Xquartz_OBJECTS) $(Xquartz_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) @@ -592,22 +609,25 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stub.Po@am__quote@ .c.o: -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: -@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< diff --git a/xorg-server/hw/xquartz/mach-startup/bundle-main.c b/xorg-server/hw/xquartz/mach-startup/bundle-main.c index ef5d75700..e887c469d 100644 --- a/xorg-server/hw/xquartz/mach-startup/bundle-main.c +++ b/xorg-server/hw/xquartz/mach-startup/bundle-main.c @@ -31,6 +31,10 @@ #include <CoreFoundation/CoreFoundation.h> #include <AvailabilityMacros.h> +#ifdef HAVE_DIX_CONFIG_H +#include <dix-config.h> +#endif + #include <X11/Xlib.h> #include <unistd.h> #include <stdio.h> @@ -76,7 +80,7 @@ const char *__crashreporter_info__base = "X.Org X Server " XSERVER_VERSION " Bui char __crashreporter_info__buf[4096]; char *__crashreporter_info__ = __crashreporter_info__buf; -static char *server_bootstrap_name = "org.x.X11"; +static char *server_bootstrap_name = LAUNCHD_ID_PREFIX".X11"; #define DEBUG 1 @@ -323,7 +327,7 @@ kern_return_t do_start_x11_server(mach_port_t port, string_array_t argv, char **_envp = alloca((envpCnt + 1) * sizeof(char *)); size_t i; - /* If we didn't get handed a launchd DISPLAY socket, we shoul + /* If we didn't get handed a launchd DISPLAY socket, we should * unset DISPLAY or we can run into problems with pbproxy */ if(!launchd_socket_handed_off) @@ -351,7 +355,7 @@ kern_return_t do_start_x11_server(mach_port_t port, string_array_t argv, return KERN_FAILURE; } -int startup_trigger(int argc, char **argv, char **envp) { +static int startup_trigger(int argc, char **argv, char **envp) { Display *display; const char *s; @@ -388,9 +392,9 @@ int startup_trigger(int argc, char **argv, char **envp) { kr = bootstrap_look_up(bootstrap_port, server_bootstrap_name, &mp); if (kr != KERN_SUCCESS) { #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050 - fprintf(stderr, "bootstrap_look_up(): %s\n", bootstrap_strerror(kr)); + fprintf(stderr, "bootstrap_look_up(%s): %s\n", server_bootstrap_name, bootstrap_strerror(kr)); #else - fprintf(stderr, "bootstrap_look_up(): %ul\n", (unsigned long)kr); + fprintf(stderr, "bootstrap_look_up(%s): %ul\n", server_bootstrap_name, (unsigned long)kr); #endif exit(EXIT_FAILURE); } @@ -445,9 +449,10 @@ static void ensure_path(const char *dir) { } } -static void setup_env() { +static void setup_env(void) { char *temp; const char *pds = NULL; + const char *disp = getenv("DISPLAY"); /* Pass on our prefs domain to startx and its inheritors (mainly for * quartz-wm and the Xquartz stub's MachIPC) @@ -464,12 +469,40 @@ static void setup_env() { } } } + /* We need to unset DISPLAY if it is not our socket */ + if(disp) { + if(!pds) { + /* If we can't detet our id, we are beyond hope and need to just + * revert to the non-launchd startup */ + unsetenv("DISPLAY"); + } else { + /* s = basename(disp) */ + const char *d, *s; + for(s = NULL, d = disp; *d; d++) { + if(*d == '/') + s = d + 1; + } - /* If we're not org.x.X11, we want to unset DISPLAY, so we don't - * use the launchd DISPLAY socket. - */ - if(pds == NULL || strcmp(pds, "org.x.X11") != 0) - unsetenv("DISPLAY"); + if(s && *s) { + size_t pds_len = strlen(pds); + temp = (char *)malloc(sizeof(char) * pds_len); + if(!temp) { + fprintf(stderr, "Memory allocation error creating space for socket name test.\n"); + } + strlcpy(temp, pds, pds_len - 3); + strlcat(temp, ":0", pds_len); + + if(strcmp(temp, s) != 0) { + /* If we don't have a match, unset it. */ + unsetenv("DISPLAY"); + } + free(temp); + } else { + /* The DISPLAY environment variable is not formatted like a launchd socket, so reset. */ + unsetenv("DISPLAY"); + } + } + } /* Make sure PATH is right */ ensure_path(X11BINDIR); @@ -559,7 +592,7 @@ int main(int argc, char **argv, char **envp) { fprintf(stderr, "Waiting for startup parameters via Mach IPC.\n"); kr = mach_msg_server(mach_startup_server, mxmsgsz, mp, 0); if (kr != KERN_SUCCESS) { - fprintf(stderr, "org.x.X11(mp): %s\n", mach_error_string(kr)); + fprintf(stderr, "%s.X11(mp): %s\n", LAUNCHD_ID_PREFIX, mach_error_string(kr)); return EXIT_FAILURE; } diff --git a/xorg-server/hw/xquartz/mach-startup/launchd_fd.c b/xorg-server/hw/xquartz/mach-startup/launchd_fd.c index 44a243a58..fa623ea12 100644 --- a/xorg-server/hw/xquartz/mach-startup/launchd_fd.c +++ b/xorg-server/hw/xquartz/mach-startup/launchd_fd.c @@ -26,6 +26,10 @@ * prior written authorization. */ +#ifdef HAVE_DIX_CONFIG_H +#include <dix-config.h> +#endif + #include <launch.h> #include <stdio.h> #include <errno.h> @@ -65,10 +69,13 @@ int launchd_display_fd() { return ERROR_FD; } - listening_fd_array = launch_data_dict_lookup(sockets_dict, ":0"); + listening_fd_array = launch_data_dict_lookup(sockets_dict, LAUNCHD_ID_PREFIX":0"); if (NULL == listening_fd_array) { - fprintf(stderr,"launchd check-in: No known sockets found to answer requests on!\n"); - return ERROR_FD; + listening_fd_array = launch_data_dict_lookup(sockets_dict, ":0"); + if (NULL == listening_fd_array) { + fprintf(stderr,"launchd check-in: No known sockets found to answer requests on! \"%s:0\" and \":0\" failed.\n", LAUNCHD_ID_PREFIX); + return ERROR_FD; + } } if (launch_data_array_get_count(listening_fd_array)!=1) { diff --git a/xorg-server/hw/xquartz/mach-startup/stub.c b/xorg-server/hw/xquartz/mach-startup/stub.c index cee811695..7a557bd3f 100644 --- a/xorg-server/hw/xquartz/mach-startup/stub.c +++ b/xorg-server/hw/xquartz/mach-startup/stub.c @@ -40,15 +40,11 @@ #include <sys/socket.h> #include <sys/un.h> -static char *server_bootstrap_name = "org.x.X11"; - -/* The launchd startup is only designed for the primary X11.app that is - * org.x.X11... server_bootstrap_name might be differnet if we were triggered to - * start by another X11.app. - */ -#define kX11AppBundleId "org.x.X11" +#define kX11AppBundleId LAUNCHD_ID_PREFIX".X11" #define kX11AppBundlePath "/Contents/MacOS/X11" +static char *server_bootstrap_name = kX11AppBundleId; + #include <mach/mach.h> #include <mach/mach_error.h> #include <servers/bootstrap.h> |