summaryrefslogtreecommitdiff
path: root/hw/xquartz/mach-startup/bundle-main.c
diff options
context:
space:
mode:
authorJeremy Huddleston <jeremyhu@freedesktop.org>2008-06-04 11:18:52 -0700
committerJeremy Huddleston <jeremyhu@freedesktop.org>2008-06-04 12:24:06 -0700
commitea40fcf4344c6e918d3be34354528940b05a70f3 (patch)
tree77b93e6b70d7cdbcb5fc00f19b9b37ea677af306 /hw/xquartz/mach-startup/bundle-main.c
parent2393dae6ffff7db8281a7977039450e8754cc19f (diff)
XQuartz: Fork for trigger
(cherry picked from commit dd0f8a0f59593d7831fe09a2a086fcd57c84910e)
Diffstat (limited to 'hw/xquartz/mach-startup/bundle-main.c')
-rw-r--r--hw/xquartz/mach-startup/bundle-main.c26
1 files changed, 3 insertions, 23 deletions
diff --git a/hw/xquartz/mach-startup/bundle-main.c b/hw/xquartz/mach-startup/bundle-main.c
index 943ec5454..67c338f21 100644
--- a/hw/xquartz/mach-startup/bundle-main.c
+++ b/hw/xquartz/mach-startup/bundle-main.c
@@ -79,12 +79,6 @@ static pthread_t create_thread(void *func, void *arg) {
}
#ifdef NEW_LAUNCH_METHOD
-struct arg {
- int argc;
- char **argv;
- char **envp;
-};
-
/*** Mach-O IPC Stuffs ***/
union MaxMsgSize {
@@ -368,12 +362,6 @@ int main(int argc, char **argv, char **envp) {
}
#ifdef NEW_LAUNCH_METHOD
-static void startup_trigger_thread(void *arg) {
- struct arg args = *((struct arg *)arg);
- free(arg);
- startup_trigger(args.argc, args.argv, args.envp);
-}
-
/*** Main ***/
int main(int argc, char **argv, char **envp) {
Bool listenOnly = FALSE;
@@ -400,21 +388,13 @@ int main(int argc, char **argv, char **envp) {
* thread handle it.
*/
if(!listenOnly) {
- struct arg *args = (struct arg*)malloc(sizeof(struct arg));
- if(!args) {
- fprintf(stderr, "Memory allocation error.\n");
- return EXIT_FAILURE;
+ if(fork() == 0) {
+ return startup_trigger(argc, argv, envp);
}
-
- args->argc = argc;
- args->argv = argv;
- args->envp = envp;
-
- create_thread(startup_trigger_thread, args);
}
/* Main event loop */
- fprintf(stderr, "Statrup coming...\n");
+ 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));