From 54bab0a7a2901d70719715625150a95ef2ab7784 Mon Sep 17 00:00:00 2001 From: Eliot Miranda Date: Tue, 21 Mar 2017 08:44:09 -0700 Subject: [PATCH] Linux (& unix/Mac OS X): Fix the build of the XDisplayControlPlugin on linuxes where .so is not appended to shared objects. Fix the language in sqUnixHeartbeat.c and add more information. Make the code exclusive to linux, and use exeName instead of a hardwired name. --- .../XDisplayControlPlugin/Makefile.inc | 7 +--- platforms/unix/vm/sqUnixHeartbeat.c | 35 ++++++++++--------- 2 files changed, 20 insertions(+), 22 deletions(-) diff --git a/platforms/unix/plugins/XDisplayControlPlugin/Makefile.inc b/platforms/unix/plugins/XDisplayControlPlugin/Makefile.inc index e50d3761ad..3669ec390b 100644 --- a/platforms/unix/plugins/XDisplayControlPlugin/Makefile.inc +++ b/platforms/unix/plugins/XDisplayControlPlugin/Makefile.inc @@ -1,8 +1,3 @@ XCPPFLAGS= -I$(topdir)/platforms/Cross/plugins/FilePlugin -I$(topdir)/platforms/Cross/plugins/SocketPlugin XINCLUDES= $(X_INCLUDES) -XLDFLAGS= $(X_LIBS) -L. -lvm-display-X11 - -$(TARGET): libvm-display-X11.so - -libvm-display-X11.so: - ln -s ../vm-display-X11/.libs/vm-display-X11.so libvm-display-X11.so +XLDFLAGS= $(X_LIBS) -L ../vm-display-X11/.libs -lvm-display-X11 diff --git a/platforms/unix/vm/sqUnixHeartbeat.c b/platforms/unix/vm/sqUnixHeartbeat.c index 340ad833c8..01917a9372 100644 --- a/platforms/unix/vm/sqUnixHeartbeat.c +++ b/platforms/unix/vm/sqUnixHeartbeat.c @@ -297,6 +297,10 @@ static volatile machine_state beatState = nascent; static int beatMilliseconds = DEFAULT_BEAT_MS; static struct timespec beatperiod = { 0, DEFAULT_BEAT_MS * 1000 * 1000 }; +#if __linux__ +# include "sqUnixMain.h" +#endif + static void * beatStateMachine(void *careLess) { @@ -304,35 +308,34 @@ beatStateMachine(void *careLess) if ((er = pthread_setschedparam(pthread_self(), stateMachinePolicy, &stateMachinePriority))) { + extern char *revisionAsString(); + errno = er; + perror("pthread_setschedparam failed"); +#if __linux__ /* Linux pthreads as of 2009 does not support setting the priority of * threads other than with real-time scheduling policies. But such * policies are only available to processes with superuser privileges. * Linux kernels >= 2.6.13 support different thread priorities, but * require a suitable /etc/security/limits.d/VMNAME.conf. */ - extern char *revisionAsString(); - errno = er; - perror("pthread_setschedparam failed"); -#if PharoVM -# define VMNAME "pharo" -#elif NewspeakVM -# define VMNAME "nsvm" -#else -# define VMNAME "squeak" -#endif - fprintf(stderr, "This VM uses a thread heartbeat who requires a special configuration to work.\n"); - fprintf(stderr, "You need to allow it to run higher priority threads (real time), to allow clock to work properly\n"); - fprintf(stderr, "You need to add a conf file to /etc/security/limits.d, executing this:\n\n"); - fprintf(stderr, "sudo cat >/etc/security/limits.d/%s.conf </etc/security/limits.d/%s.conf <