mirror of
https://gitlab.freedesktop.org/xorg/xserver.git
synced 2025-12-30 06:10:08 +01:00
XQuartz: Fixed first-client-can't-connect bug
Readded the old exec() server startup path for regression testing.
Don't use the dynamic fd addition code since it's not quite working correctly.
(cherry picked from commit 08f3fe153e)
This commit is contained in:
parent
e5d4970d4d
commit
29bce2bb59
6 changed files with 47 additions and 13 deletions
|
|
@ -1754,7 +1754,7 @@ if test "x$XQUARTZ" = xyes; then
|
|||
|
||||
AC_CHECK_LIB([Xplugin],[xp_init],[:])
|
||||
|
||||
CFLAGS="${CFLAGS} -DROOTLESS_WORKAROUND -DNO_ALLOCA"
|
||||
CFLAGS="${CFLAGS} -DROOTLESS_WORKAROUND -DNO_ALLOCA -DXQUARTZ_EXPORTS_LAUNCHD_FD"
|
||||
fi
|
||||
|
||||
# Support for objc in autotools is minimal and not documented.
|
||||
|
|
|
|||
|
|
@ -202,12 +202,6 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
|
|||
for_appkit = YES;
|
||||
for_x = YES;
|
||||
|
||||
// fprintf(stderr, "fd_add_count: %d\n", fd_add_count);
|
||||
if(fd_add_count) {
|
||||
DarwinProcessFDAdditionQueue();
|
||||
fprintf(stderr, "ran it - fd_add_count: %d\n", fd_add_count);
|
||||
}
|
||||
|
||||
switch (type) {
|
||||
case NSLeftMouseDown: case NSRightMouseDown: case NSOtherMouseDown:
|
||||
case NSLeftMouseUp: case NSRightMouseUp: case NSOtherMouseUp:
|
||||
|
|
|
|||
|
|
@ -327,9 +327,12 @@ static void DarwinEventHandler(int screenNum, xEventPtr xe, DeviceIntPtr dev, in
|
|||
}
|
||||
}
|
||||
|
||||
int xquartz_launchd_fd = -1;
|
||||
|
||||
void DarwinListenOnOpenFD(int fd) {
|
||||
ErrorF("DarwinListenOnOpenFD: %d\n", fd);
|
||||
|
||||
#if 0
|
||||
pthread_mutex_lock(&fd_add_lock);
|
||||
if(fd_add_count < FD_ADD_MAX)
|
||||
fd_add[fd_add_count++] = fd;
|
||||
|
|
@ -337,6 +340,9 @@ void DarwinListenOnOpenFD(int fd) {
|
|||
ErrorF("FD Addition buffer at max. Dropping fd addition request.\n");
|
||||
|
||||
pthread_mutex_unlock(&fd_add_lock);
|
||||
#else
|
||||
xquartz_launchd_fd = fd;
|
||||
#endif
|
||||
}
|
||||
|
||||
void DarwinProcessFDAdditionQueue() {
|
||||
|
|
|
|||
|
|
@ -1,12 +1,13 @@
|
|||
AM_CPPFLAGS = \
|
||||
-DBUILD_DATE=\"$(BUILD_DATE)\" \
|
||||
-DXSERVER_VERSION=\"$(VERSION)\"
|
||||
-DXSERVER_VERSION=\"$(VERSION)\" \
|
||||
-DMACHO_STARTUP
|
||||
|
||||
x11appdir = $(APPLE_APPLICATIONS_DIR)/X11.app/Contents/MacOS
|
||||
x11app_PROGRAMS = X11
|
||||
|
||||
dist_X11_SOURCES = \
|
||||
bundle-main.c
|
||||
bundle-main.c
|
||||
# launchd_fd.c
|
||||
|
||||
nodist_X11_SOURCES = \
|
||||
|
|
|
|||
|
|
@ -82,6 +82,7 @@ static pthread_t create_thread(void *func, void *arg) {
|
|||
return tid;
|
||||
}
|
||||
|
||||
#ifdef MACHO_STARTUP
|
||||
/*** Mach-O IPC Stuffs ***/
|
||||
|
||||
union MaxMsgSize {
|
||||
|
|
@ -259,13 +260,18 @@ kern_return_t do_start_x11_server(mach_port_t port, string_array_t argv,
|
|||
}
|
||||
|
||||
int startup_trigger(int argc, char **argv, char **envp) {
|
||||
#else
|
||||
void *add_launchd_display_thread(void *data);
|
||||
|
||||
int main(int argc, char **argv, char **envp) {
|
||||
#endif
|
||||
Display *display;
|
||||
const char *s;
|
||||
|
||||
size_t i;
|
||||
|
||||
/* Take care of the case where we're called like a normal DDX */
|
||||
if(argc > 1 && argv[1][0] == ':') {
|
||||
#ifdef MACHO_STARTUP
|
||||
size_t i;
|
||||
kern_return_t kr;
|
||||
mach_port_t mp;
|
||||
string_array_t newenvp;
|
||||
|
|
@ -305,6 +311,10 @@ int startup_trigger(int argc, char **argv, char **envp) {
|
|||
exit(EXIT_FAILURE);
|
||||
}
|
||||
exit(EXIT_SUCCESS);
|
||||
#else
|
||||
create_thread(add_launchd_display_thread, NULL);
|
||||
return server_main(argc, argv, envp);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* If we have a process serial number and it's our only arg, act as if
|
||||
|
|
@ -334,6 +344,7 @@ int startup_trigger(int argc, char **argv, char **envp) {
|
|||
return execute(command_from_prefs("startx_script", DEFAULT_STARTX));
|
||||
}
|
||||
|
||||
#ifdef MACHO_STARTUP
|
||||
/*** Main ***/
|
||||
int main(int argc, char **argv, char **envp) {
|
||||
Bool listenOnly = FALSE;
|
||||
|
|
@ -378,6 +389,17 @@ int main(int argc, char **argv, char **envp) {
|
|||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
#else
|
||||
|
||||
void *add_launchd_display_thread(void *data) {
|
||||
/* Start listening on the launchd fd */
|
||||
int launchd_fd = launchd_display_fd();
|
||||
if(launchd_fd != -1) {
|
||||
DarwinListenOnOpenFD(launchd_fd);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
static int execute(const char *command) {
|
||||
const char *newargv[7];
|
||||
|
|
@ -393,7 +415,7 @@ static int execute(const char *command) {
|
|||
|
||||
fprintf(stderr, "X11.app: Launching %s:\n", command);
|
||||
for(s=newargv; *s; s++) {
|
||||
fprintf(stderr, "\targv[%ld] = %s\n", s - newargv, *s);
|
||||
fprintf(stderr, "\targv[%ld] = %s\n", (long int)(s - newargv), *s);
|
||||
}
|
||||
|
||||
execvp (newargv[0], (char * const *) newargv);
|
||||
|
|
|
|||
|
|
@ -115,6 +115,7 @@ static void set_x11_path() {
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef MACHO_STARTUP
|
||||
static int create_socket(char *filename_out) {
|
||||
struct sockaddr_un servaddr_un;
|
||||
struct sockaddr *servaddr;
|
||||
|
|
@ -218,7 +219,10 @@ static void send_fd_handoff(int handoff_fd, int launchd_fd) {
|
|||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
int main(int argc, char **argv, char **envp) {
|
||||
#ifdef MACHO_STARTUP
|
||||
int envpc;
|
||||
kern_return_t kr;
|
||||
mach_port_t mp;
|
||||
|
|
@ -227,6 +231,7 @@ int main(int argc, char **argv, char **envp) {
|
|||
size_t i;
|
||||
int launchd_fd;
|
||||
string_t handoff_socket_filename;
|
||||
#endif
|
||||
sig_t handler;
|
||||
|
||||
if(argc == 2 && !strcmp(argv[1], "-version")) {
|
||||
|
|
@ -244,7 +249,8 @@ int main(int argc, char **argv, char **envp) {
|
|||
if(handler == SIG_IGN)
|
||||
kill(getppid(), SIGUSR1);
|
||||
signal(SIGUSR1, handler);
|
||||
|
||||
|
||||
#ifdef MACHO_STARTUP
|
||||
/* Get the $DISPLAY FD */
|
||||
launchd_fd = launchd_display_fd();
|
||||
|
||||
|
|
@ -325,4 +331,9 @@ int main(int argc, char **argv, char **envp) {
|
|||
return EXIT_FAILURE;
|
||||
}
|
||||
return EXIT_SUCCESS;
|
||||
#else
|
||||
set_x11_path();
|
||||
argv[0] = x11_path;
|
||||
return execvp(x11_path, argv);
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue