xserver: Branch 'xorg-server-1.4-apple' - 4 commits
Jeremy Huddleston
jeremyhu at kemper.freedesktop.org
Wed May 14 01:13:19 PDT 2008
hw/kdrive/src/kdrive.c | 6 ---
hw/xquartz/mach-startup/bundle-main.c | 45 ++++++++++++++++++++++++---
hw/xquartz/mach-startup/mach_startup_types.h | 4 +-
hw/xquartz/mach-startup/stub.c | 32 +++++++++++++++----
xkb/ddxLoad.c | 2 -
5 files changed, 71 insertions(+), 18 deletions(-)
New commits:
commit 49cd0b185fd6c99b07357a74734b6a4023faca84
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date: Wed May 14 01:13:15 2008 -0700
XQuartz: More work on the Mach-IPC startup path
diff --git a/hw/xquartz/mach-startup/bundle-main.c b/hw/xquartz/mach-startup/bundle-main.c
index a66afa8..cd64e42 100644
--- a/hw/xquartz/mach-startup/bundle-main.c
+++ b/hw/xquartz/mach-startup/bundle-main.c
@@ -73,7 +73,26 @@ kern_return_t do_start_x11_server(mach_port_t port, string_array_t argv,
mach_msg_type_number_t argvCnt,
string_array_t envp,
mach_msg_type_number_t envpCnt) {
- if(server_main(argvCnt - 1, argv, envp) == 0)
+ /* And now back to char ** */
+ char **_argv = alloca((argvCnt + 1) * sizeof(char *));
+ char **_envp = alloca((envpCnt + 1) * sizeof(char *));
+ size_t i;
+
+ if(!_argv || !_envp) {
+ return KERN_FAILURE;
+ }
+
+ for(i=0; i < argvCnt; i++) {
+ _argv[i] = argv[i];
+ }
+ _argv[argvCnt] = NULL;
+
+ for(i=0; i < envpCnt; i++) {
+ _envp[i] = envp[i];
+ }
+ _envp[envpCnt] = NULL;
+
+ if(server_main(argvCnt, _argv, _envp) == 0)
return KERN_SUCCESS;
else
return KERN_FAILURE;
@@ -212,20 +231,38 @@ int main(int argc, char **argv, char **envp) {
#ifdef NEW_LAUNCH_METHOD
kern_return_t kr;
mach_port_t mp;
-
- sleep(2);
+ string_array_t newenvp;
+ string_array_t newargv;
/* We need to count envp */
int envpc;
for(envpc=0; envp[envpc]; envpc++);
+ /* We have fixed-size string lengths due to limitations in IPC,
+ * so we need to copy our argv and envp.
+ */
+ newargv = (string_array_t)alloca(argc * sizeof(string_t));
+ newenvp = (string_array_t)alloca(envpc * sizeof(string_t));
+
+ if(!newargv || !newenvp) {
+ fprintf(stderr, "Memory allocation failure\n");
+ exit(EXIT_FAILURE);
+ }
+
+ for(i=0; i < argc; i++) {
+ strlcpy(newargv[i], argv[i], STRING_T_SIZE);
+ }
+ for(i=0; i < envpc; i++) {
+ strlcpy(newenvp[i], envp[i], STRING_T_SIZE);
+ }
+
kr = bootstrap_look_up(bootstrap_port, SERVER_BOOTSTRAP_NAME, &mp);
if (kr != KERN_SUCCESS) {
fprintf(stderr, "bootstrap_look_up(): %s\n", bootstrap_strerror(kr));
exit(EXIT_FAILURE);
}
- kr = start_x11_server(mp, argv, argc + 1, envp, envpc + 1);
+ kr = start_x11_server(mp, newargv, argc, newenvp, envpc);
if (kr != KERN_SUCCESS) {
fprintf(stderr, "start_x11_server: %s\n", mach_error_string(kr));
exit(EXIT_FAILURE);
diff --git a/hw/xquartz/mach-startup/mach_startup_types.h b/hw/xquartz/mach-startup/mach_startup_types.h
index 03939af..97ac147 100644
--- a/hw/xquartz/mach-startup/mach_startup_types.h
+++ b/hw/xquartz/mach-startup/mach_startup_types.h
@@ -2,7 +2,9 @@
#define _MACH_STARTUP_TYPES_H_
#define SERVER_BOOTSTRAP_NAME "org.x.X11"
+#define STRING_T_SIZE 1024
-typedef char ** string_array_t;
+typedef char string_t[STRING_T_SIZE];
+typedef string_t * string_array_t;
#endif
diff --git a/hw/xquartz/mach-startup/stub.c b/hw/xquartz/mach-startup/stub.c
index ed917cf..fae9720 100644
--- a/hw/xquartz/mach-startup/stub.c
+++ b/hw/xquartz/mach-startup/stub.c
@@ -111,9 +111,10 @@ static void set_x11_path() {
int main(int argc, char **argv, char **envp) {
#ifdef NEW_LAUNCH_METHOD_2
int envpc;
- char *newargv[3];
kern_return_t kr;
mach_port_t mp;
+ string_array_t newenvp;
+ string_array_t newargv;
#endif
if(argc == 2 && !strcmp(argv[1], "-version")) {
@@ -137,10 +138,11 @@ int main(int argc, char **argv, char **envp) {
}
if(child == 0) {
- newargv[0] = x11_path;
- newargv[1] = "--listenonly";
- newargv[2] = NULL;
- return execvp(x11_path, newargv);
+ char *_argv[3];
+ _argv[0] = x11_path;
+ _argv[1] = "--listenonly";
+ _argv[2] = NULL;
+ return execvp(x11_path, _argv);
}
/* Try connecting for 10 seconds */
@@ -160,7 +162,25 @@ int main(int argc, char **argv, char **envp) {
/* Count envp */
for(envpc=0; envp[envpc]; envpc++);
- kr = start_x11_server(mp, argv, argc + 1, envp, envpc + 1);
+ /* We have fixed-size string lengths due to limitations in IPC,
+ * so we need to copy our argv and envp.
+ */
+ newargv = (string_array_t)alloca(argc * sizeof(string_t));
+ newenvp = (string_array_t)alloca(envpc * sizeof(string_t));
+
+ if(!newargv || !newenvp) {
+ fprintf(stderr, "Memory allocation failure\n");
+ exit(EXIT_FAILURE);
+ }
+
+ for(i=0; i < argc; i++) {
+ strlcpy(newargv[i], argv[i], STRING_T_SIZE);
+ }
+ for(i=0; i < envpc; i++) {
+ strlcpy(newenvp[i], envp[i], STRING_T_SIZE);
+ }
+
+ kr = start_x11_server(mp, newargv, argc, newenvp, envpc);
if (kr != KERN_SUCCESS) {
fprintf(stderr, "start_x11_server: %s\n", mach_error_string(kr));
return EXIT_FAILURE;
commit 3251fb54cd02671cc6bfcdfb63a9b1e48f133da0
Merge: 6237acf... d0554a5...
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date: Wed May 14 00:33:17 2008 -0700
Merge branch 'server-1.4-branch' into xorg-server-1.4-apple
commit d0554a57489e272233bcb38cb453f2c0bc0b1729
Author: Alan Coopersmith <alan.coopersmith at sun.com>
Date: Tue May 13 16:39:30 2008 -0700
When XKB fails to open rules file, log the file name, not the NULL file pointer
(cherry picked from commit 7cdc19b29d93bf15cecfd6b69e269fab2501bca0)
diff --git a/xkb/ddxLoad.c b/xkb/ddxLoad.c
index ea9c3ff..eb03cde 100644
--- a/xkb/ddxLoad.c
+++ b/xkb/ddxLoad.c
@@ -525,7 +525,7 @@ XkbRF_RulesPtr rules;
file = fopen(buf, "r");
if (!file) {
- LogMessage(X_ERROR, "XKB: Couldn't open rules file %s\n", file);
+ LogMessage(X_ERROR, "XKB: Couldn't open rules file %s\n", buf);
return False;
}
commit 3f8ba890762513edc7eddbbbd4bb26f908540c8d
Author: Julien Cristau <jcristau at debian.org>
Date: Sun May 11 23:17:27 2008 +0200
kdrive: allow disabling Composite
KdInitOutput() used to enable Composite when it was disabled by default,
but now this hack prevents ``-extension Composite'' from working.
Remove it, as Composite is enabled by default anyway.
(cherry picked from commit 9dfb525f6c91acab5d1a65765a046bf9ee2aa082)
diff --git a/hw/kdrive/src/kdrive.c b/hw/kdrive/src/kdrive.c
index 2bb7b53..cd4ea7d 100644
--- a/hw/kdrive/src/kdrive.c
+++ b/hw/kdrive/src/kdrive.c
@@ -1387,12 +1387,6 @@ KdInitOutput (ScreenInfo *pScreenInfo,
KdCardInfo *card;
KdScreenInfo *screen;
-#ifdef COMPOSITE
- /* kind of a hack: we want Composite enabled, but it's disabled per
- * default. */
- noCompositeExtension = FALSE;
-#endif
-
if (!kdCardInfo)
{
InitCard (0);
More information about the xorg-commit
mailing list