[OpenAFS-port-darwin] Building on rc9 on intel...
Chaskiel M Grundman
cg2v@andrew.cmu.edu
Tue, 07 Mar 2006 19:15:34 -0500
The following patch (based on comments relayed to me from Ed by a third
party, but I was closing in on the problem...) fixes the crash that occurs
in all LWP-using programs on 10.4.4 on X86.
Ed's patch is likely to be different, since his patchset appears to include
support for building universal binaries.
Index: src/lwp/lwp.c
===================================================================
RCS file: /cvs/openafs/src/lwp/lwp.c,v
retrieving revision 1.27.2.6
diff -u -r1.27.2.6 lwp.c
--- src/lwp/lwp.c 11 Jul 2005 18:59:55 -0000 1.27.2.6
+++ src/lwp/lwp.c 8 Mar 2006 00:12:07 -0000
@@ -342,6 +342,13 @@
stackptr -= stacksize;
stackmemory = stackptr;
#else
+#ifdef sys_x86_darwin_80
+ if ((stackmemory = (char *)malloc(stacksize + 16)) == NULL) {
+ Set_LWP_RC();
+ return LWP_ENOMEM;
+ }
+ stackptr = (char *)((16 * (((long)stackmemory + 15) / 16)) + 12);
+#else
if ((stackmemory = (char *)malloc(stacksize + 7)) == NULL) {
Set_LWP_RC();
return LWP_ENOMEM;
@@ -349,6 +356,7 @@
/* Round stack pointer to byte boundary */
stackptr = (char *)(8 * (((long)stackmemory + 7) / 8));
#endif
+#endif
if (priority < 0 || priority >= MAX_PRIORITIES) {
Set_LWP_RC();
return LWP_EBADPRI;