Re: [hatari-devel] Windows build currently broken?

[ Thread Index | Date Index | More lists.tuxfamily.org/hatari-devel Archives ]


Hi,

On 12/28/18 1:59 PM, Christian Zietz wrote:
after Eero reported an issue with the Falcon SCC under Hatari and
EmuTOS, I wanted to investigate a bit. I'm using Windows and I rely on
Christer's "nightly" builds on
<http://antarctica.no/~hatari/latest/windows/>. However, the build is
unavailable because it failed with errors in scc.c:
<http://antarctica.no/~hatari/latest/windows/make-win64-release.commit-r7282.log>,
presumably because it uses functions or defines that do not exist under
Windows.

I think it would be better to test it under Linux (either in VM
under Windows or native), as there are several file handling
operations that aren't supported by Windows APIs.

Attached is a patch that tries to work around the Windows API
issues.  Thomas, how does it look like?


	- Eero

PS. There were also several compiler format conversion warnings
from softfloat code.

diff -r 3931da35016f src/scc.c
--- a/src/scc.c	Fri Dec 28 10:38:33 2018 +0100
+++ b/src/scc.c	Fri Dec 28 17:20:48 2018 +0200
@@ -83,7 +83,11 @@
 	}
 
 	handle = open(ConfigureParams.RS232.sSccBFileName,
+#if !defined(WIN32)
 	              O_RDWR | O_NDELAY | O_NONBLOCK);      /* Raw mode */
+#else // MinGW misses non-blocking mode
+	              O_RDWR | O_NDELAY);
+#endif
 	if (handle >= 0)
 	{
 #if HAVE_TERMIOS_H
@@ -104,7 +108,10 @@
 	D(bug("SCC: interface destroyed\n"));
 	if (handle >= 0)
 	{
+// MinGW has fcntl.h, but no fcntl() / F_SETFL?
+#if !defined(WIN32)
 		fcntl(handle, F_SETFL, 0);  // back to (almost...) normal
+#endif
 		close(handle);
 		handle = -1;
 	}
@@ -271,11 +278,12 @@
 static uint16_t SCC_serial_getStatus(void)
 {
 	uint16_t value = 0;
+	uint16_t diff;
+
+#if defined(HAVE_SYS_IOCTL_H) && defined(TIOCMGET)
 	int status = 0;
-	uint16_t diff;
 	int nbchar = 0;
 
-#if defined(HAVE_SYS_IOCTL_H) && defined(TIOCMGET)
 	if (handle >= 0 && bFileHandleIsATTY)
 	{
 		if (ioctl(handle, FIONREAD, &nbchar) < 0)


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/