[Vm-dev] [commit] r2363 - Merge Levente's linux UUIDPlugin fix. Fix
tickerSleepCycle decl in heartbeat.
commits at squeakvm.org
commits at squeakvm.org
Wed Mar 2 17:29:55 UTC 2011
Author: eliot
Date: 2011-03-02 09:29:55 -0800 (Wed, 02 Mar 2011)
New Revision: 2363
Modified:
branches/Cog/platforms/unix/plugins/UUIDPlugin/sqUnixUUID.c
branches/Cog/platforms/unix/vm/Makefile.in
branches/Cog/platforms/unix/vm/sqUnixHeartbeat.c
Log:
Merge Levente's linux UUIDPlugin fix. Fix tickerSleepCycle decl in heartbeat.
Restore -O2 optimization for the interpreter.
Modified: branches/Cog/platforms/unix/plugins/UUIDPlugin/sqUnixUUID.c
===================================================================
--- branches/Cog/platforms/unix/plugins/UUIDPlugin/sqUnixUUID.c 2011-02-16 05:52:50 UTC (rev 2362)
+++ branches/Cog/platforms/unix/plugins/UUIDPlugin/sqUnixUUID.c 2011-03-02 17:29:55 UTC (rev 2363)
@@ -1,18 +1,80 @@
-#include <uuid/uuid.h>
+#include "config.h"
+
+#if defined(HAVE_SYS_UUID_H)
+# include <sys/types.h>
+# include <sys/uuid.h>
+#endif
+#if defined(HAVE_UUID_H)
+ #include <uuid.h>
+#endif
+
#include "sq.h"
-int sqUUIDInit(void) { return 1; }
-int sqUUIDShutdown(void) { return 1; }
-
int MakeUUID(char *location)
{
uuid_t uuid;
-#if defined(__NetBSD__)
+
+#if defined(HAVE_UUIDGEN)
uuidgen(&uuid, 1);
-#else
+#elif defined(HAVE_UUID_GENERATE)
uuid_generate(uuid);
#endif
+
memcpy((void *)location, (void *)&uuid, sizeof(uuid));
return 1;
}
+
+
+#if defined(__linux__)
+
+# include <setjmp.h>
+# include <signal.h>
+
+static sigjmp_buf env;
+
+static void sigsegvHandler(int signal)
+{
+ siglongjmp(env, 1);
+}
+
+int sqUUIDInit(void)
+{
+ /* check if we get a segmentation fault when using libuuid */
+ int pluginAvailable= 0;
+ struct sigaction originalAction;
+ uuid_t uuid;
+
+ if (!sigsetjmp(env, 1))
+ {
+ struct sigaction newAction;
+ newAction.sa_handler= sigsegvHandler;
+ newAction.sa_flags= 0;
+ sigemptyset(&newAction.sa_mask);
+
+ if (sigaction(SIGSEGV, &newAction, &originalAction))
+ /* couldn't change the signal handler: give up now */
+ return 0;
+ else
+ pluginAvailable= MakeUUID((char *)&uuid);
+ }
+
+ sigaction(SIGSEGV, &originalAction, NULL);
+
+ return pluginAvailable;
+}
+
+#else /* !__linux__ */
+
+int sqUUIDInit(void)
+{
+ return 1;
+}
+
+#endif /* !__linux__ */
+
+
+int sqUUIDShutdown(void)
+{
+ return 1;
+}
Modified: branches/Cog/platforms/unix/vm/Makefile.in
===================================================================
--- branches/Cog/platforms/unix/vm/Makefile.in 2011-02-16 05:52:50 UTC (rev 2362)
+++ branches/Cog/platforms/unix/vm/Makefile.in 2011-03-02 17:29:55 UTC (rev 2363)
@@ -71,13 +71,13 @@
# Ensure the heartbeat is compiled with less aggressive optimization. At
# least with gcc 4.1.2 compiling with -O2 results in an apparently flakey VM;
# so flakey the Squeak4.2-10856-beta.image image won't even start-up.
-sqUnixHeartbeat$o : $(topdir)/platforms/unix/vm/sqUnixHeartbeat.c
- $(COMPILE) sqUnixHeartbeat$o -O1 -fno-omit-frame-pointer -mno-rtd -mno-accumulate-outgoing-args $(topdir)/platforms/unix/vm/sqUnixHeartbeat.c
+#sqUnixHeartbeat$o : $(topdir)/platforms/unix/vm/sqUnixHeartbeat.c
+# $(COMPILE) sqUnixHeartbeat$o -O1 -fno-omit-frame-pointer -mno-rtd -mno-accumulate-outgoing-args $(topdir)/platforms/unix/vm/sqUnixHeartbeat.c
# Ensure the cointerpreter is compiled with less aggressive optimization. At
# least with gcc 4.1.2 compiling with -O2 results in an apparently flakey VM.
-gcc3x-cointerp$o : $(srcdir)/vm/gcc3x-cointerp.c
- $(COMPILE) gcc3x-cointerp$o -O1 -fno-omit-frame-pointer -momit-leaf-frame-pointer -mno-rtd -mno-accumulate-outgoing-args $(srcdir)/vm/gcc3x-cointerp.c
+#gcc3x-cointerp$o : $(srcdir)/vm/gcc3x-cointerp.c
+# $(COMPILE) gcc3x-cointerp$o -O1 -fno-omit-frame-pointer -momit-leaf-frame-pointer -mno-rtd -mno-accumulate-outgoing-args $(srcdir)/vm/gcc3x-cointerp.c
# Ensure the cogit is compiled with less aggressive optimization. The cogit
# contains a function that does two alloca's which is miscompiled by a number of
Modified: branches/Cog/platforms/unix/vm/sqUnixHeartbeat.c
===================================================================
--- branches/Cog/platforms/unix/vm/sqUnixHeartbeat.c 2011-02-16 05:52:50 UTC (rev 2362)
+++ branches/Cog/platforms/unix/vm/sqUnixHeartbeat.c 2011-03-02 17:29:55 UTC (rev 2363)
@@ -377,7 +377,7 @@
tickCheckInProgress = 0;
}
-static void
+static void *
tickerSleepCycle(void *ignored)
{
struct timespec naptime;
@@ -387,6 +387,7 @@
while (1)
(void)nanosleep(&naptime, 0);
+ return 0;
}
/* We require the error check because we're lazy in preventing multiple
More information about the Vm-dev
mailing list