diff options
author | Jeremy Huddleston <jeremyhu@freedesktop.org> | 2008-05-15 12:26:32 -0700 |
---|---|---|
committer | Jeremy Huddleston <jeremyhu@freedesktop.org> | 2008-05-18 22:45:19 -0700 |
commit | 4be2104c801340075e030d06d24ceb4d8a6d6549 (patch) | |
tree | d5700f2ecb5831fcb9361d1cd88dd84169392016 /hw/xquartz/mach-startup/stub.c | |
parent | 82c4075d4ba3bea03341c80b754b0f9d2f62a826 (diff) |
XQuartz: More work towards Mach-IPC startup... started working on FD passing
(cherry picked from commit 27fbfeacfa16d620801ac3492b25c1e50aec8588)
Diffstat (limited to 'hw/xquartz/mach-startup/stub.c')
-rw-r--r-- | hw/xquartz/mach-startup/stub.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/hw/xquartz/mach-startup/stub.c b/hw/xquartz/mach-startup/stub.c index c53ed5364..5fdbad882 100644 --- a/hw/xquartz/mach-startup/stub.c +++ b/hw/xquartz/mach-startup/stub.c @@ -45,6 +45,8 @@ #include <servers/bootstrap.h> #include "mach_startup.h" +#include "launchd_fd.h" + static char x11_path[PATH_MAX + 1]; static void set_x11_path() { @@ -109,13 +111,15 @@ static void set_x11_path() { #endif int main(int argc, char **argv, char **envp) { -#ifdef NEW_LAUNCH_METHOD_2 +#ifdef NEW_LAUNCH_METHOD int envpc; kern_return_t kr; mach_port_t mp; string_array_t newenvp; string_array_t newargv; size_t i; + int launchd_fd; + string_t handoff_socket; #endif if(argc == 2 && !strcmp(argv[1], "-version")) { @@ -125,7 +129,10 @@ int main(int argc, char **argv, char **envp) { return EXIT_SUCCESS; } -#ifdef NEW_LAUNCH_METHOD_2 +#ifdef NEW_LAUNCH_METHOD + /* Get the $DISPLAY FD */ + launchd_fd = launchd_display_fd(); + kr = bootstrap_look_up(bootstrap_port, SERVER_BOOTSTRAP_NAME, &mp); if(kr != KERN_SUCCESS) { set_x11_path(); @@ -147,7 +154,7 @@ int main(int argc, char **argv, char **envp) { } /* Try connecting for 10 seconds */ - for(i=0; i < 40; i++) { + for(i=0; i < 80; i++) { usleep(250000); kr = bootstrap_look_up(bootstrap_port, SERVER_BOOTSTRAP_NAME, &mp); if(kr == KERN_SUCCESS) @@ -159,6 +166,12 @@ int main(int argc, char **argv, char **envp) { return EXIT_FAILURE; } } + + /* Handoff the $DISPLAY FD */ + if(launchd_fd != -1) { + get_display_handoff_socket(mp, handoff_socket); + fprintf(stderr, "Handoff socket: %s %d\n", handoff_socket, launchd_fd); + } /* Count envp */ for(envpc=0; envp[envpc]; envpc++); |