[Vm-dev] version and sigaction in SqueakVM classic 4.16.7

stes stes at telenet.be
Tue Apr 7 16:32:32 UTC 2020


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256


Hi,

To come back to my previous post on __VERSION__ in SqueakVM classic 4.16.7
(from the "subversion" repository).

Reminder: __VERSION__ is not working for me, but CMAKE has
 ${CMAKE_C_COMPILER_VERSION}
which is a good alternative.

I don't know whether patches are still being accepted for SqueakVM classic,
but here below are my patches
  
  - __VERSION__ made conditional at CMAKE level via ifdef SunPro 
  - use sigaction() instead of signal() in aio.c 
    this is the case in SqueakVM 5.3 (4.3 is using sigaction )
    and that is better to avoid the SIGIO handler being reset to the default
  - vm-sound-pulse compilation fix

David Stes

Here's the diff:

Index: unix/vm/aio.c
===================================================================
- --- unix/vm/aio.c	(revision 3775)
+++ unix/vm/aio.c	(working copy)
@@ -82,7 +82,7 @@
 #   define FASYNC O_ASYNC
 # endif
 
- -#else /* !HAVE_CONFIG_H -- assume lowest common demoninator */
+#else /* !HAVE_CONFIG_H -- assume lowest common denominator */
 
 # include <stdio.h>
 # include <stdlib.h>
@@ -95,9 +95,13 @@
 # include <sys/ioctl.h>
 # include <fcntl.h>
 
+#ifdef __sun
+#include <sys/file.h>  /* include FASYNC so that code defined(FASYNC) works
*/
 #endif
 
+#endif
 
+
 #undef	DEBUG
 #undef	DEBUG_TICKER
 
@@ -162,6 +166,10 @@
 
 void aioInit(void)
 {
+#ifdef __sun__
+  struct sigaction sigio_action;
+#endif
+
   extern void forceInterruptCheck(int);	/* not really, but hey */
 
   FD_ZERO(&fdMask);
@@ -171,7 +179,18 @@
   FD_ZERO(&xdMask);
   maxFd= 0;
   signal(SIGPIPE, SIG_IGN);
+
+#ifdef __sun__
+  sigio_action.sa_sigaction = forceInterruptCheck;
+  sigio_action.sa_flags = SA_RESTART | SA_SIGINFO;
+  sigemptyset(&sigio_action.sa_mask);
+  if (sigaction(SIGIO, &sigio_action, 0)) {
+    perror("aioInit sigaction SIGIO");
+    exit(1);
+  }
+#else
   signal(SIGIO,   forceInterruptCheck);
+#endif
 }
 
 
Index: unix/vm/config.cmake
===================================================================
- --- unix/vm/config.cmake	(revision 3775)
+++ unix/vm/config.cmake	(working copy)
@@ -202,7 +202,11 @@
 
 # sqUnixMain.c
 
- -SET (VM_BUILD_STRING "\"Unix built on \"__DATE__ \" \"__TIME__\"
Compiler: \"
__VERSION__")
+IF (CMAKE_C_COMPILER_ID MATCHES "SunPro") 
+  SET (VM_BUILD_STRING "\"Unix built on \"__DATE__ \" \"__TIME__\"
Compiler: ${
CMAKE_C_COMPILER_VERSION}\"") 
+ELSE ()
+  SET (VM_BUILD_STRING "\"Unix built on \"__DATE__ \" \"__TIME__\"
Compiler: \"
__VERSION__")
+ENDIF (CMAKE_C_COMPILER_ID MATHCES "SunPro")
 
 CONFIG_DEFINE (VM_BUILD_STRING)
 
Index: unix/vm-sound-Sun/sqUnixSoundSun.c
===================================================================
- --- unix/vm-sound-Sun/sqUnixSoundSun.c	(revision 3775)
+++ unix/vm-sound-Sun/sqUnixSoundSun.c	(working copy)
@@ -72,7 +72,7 @@
 #endif
 
 static sqInt sound_Stop(void);
- -static int sound_AvailableSpace(void);
+static sqInt sound_AvailableSpace(void);
 
 static int auFd=	       -1;   /* open on /dev/audio */
 static int auCtlFd=	       -1;   /* open on /dev/audioctl */
Index: unix/vm-sound-pulse/sqUnixSoundPulseAudio.c
===================================================================
- --- unix/vm-sound-pulse/sqUnixSoundPulseAudio.c	(revision 3775)
+++ unix/vm-sound-pulse/sqUnixSoundPulseAudio.c	(working copy)
@@ -276,6 +276,12 @@
 
 /* ================================== UTILS */
 
+#ifdef __SUNPRO_C
+/* MIN is not C stdlib - perhaps <sys/param.h> is defining it on Linux */
+static int MIN(int a,int b) { return (a<b)?a:b; }
+static int MAX(int a,int b) { return (a<b)?b:a; }
+#endif
+
 /* RATE CONVERSION: from dsp code but not used (yet). Maybe not needed at
all w
ith AlSA */
 /* RATE CONVERSION: fixed preset rates are used. TBD: choose nearest to
request
ed */
 /*


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQEcBAEBCAAGBQJejKrKAAoJEAwpOKXMq1MaGNcH/0g8kk+GVHIdZW48nT2EbAJf
z8HjIc520LPdtn/U1qBcO/L21dchKZQV1t/gUacDnXFA4W2CC5q52eWMBfaWecmn
BOdiKTGovzVTCAGL5CHlKZdJA0oqJKDVMuaiDp6kP28mNFZiRynwXSGledC0qpq2
0/eAtNxpOFP6HCjl7INdm5F5ghArhYrTzpaAJfze8CZlHREls2g+2Ct0tUY1gllJ
SVCtnyhPCWD7Tmbvs+xElfj8GVfRKvPX+mWrq0TkWk6Be+NHM0b/7Z5y4y7SpTrY
qko5iRq+LUelgMtlnpUnh8kmyqbVlYT5d3XL4Qrozg7oFVUcBb7uNukNySE696k=
=9GTB
-----END PGP SIGNATURE-----




--
Sent from: http://forum.world.st/Squeak-VM-f104410.html


More information about the Vm-dev mailing list