HAVE_GETCWD fails to include io.h

Tom Tromey tromey@redhat.com
Mon Aug 26 11:32:00 GMT 2002


>>>>> "Adam" == Adam Megacz <gcj@lists.megacz.com> writes:

Adam> Ah, I see. I haven't been following java-patches very closely.
Adam> Do we have an ETA on getting it committed so that mingw32 is no
Adam> longer broken?

Try the appended.  If it works for you I will check it in.
Unfortunately I don't have a way to make sure patches don't break the
Windows build :-(

If you're interested I sent a patch to java-patches recently that adds
some more things to java.net (keepalive and shutdown support).  Could
you try building that patch on Windows?

Tom

Index: ChangeLog
from  Tom Tromey  <tromey@redhat.com>

	* java/net/natPlainDatagramSocketImpl.cc (NATIVE_CLOSE): New
	define.
	(::close): Removed.
	(PlainDatagramSocketImpl::close): Use NATIVE_CLOSE.
	* java/net/natPlainSocketImpl.cc (NATIVE_CLOSE): New define.
	(::close): Removed.
	(PlainSocketImpl::close): Use NATIVE_CLOSE.
	* include/win32.h (getcwd): Removed declaration.  Include io.h.

Index: include/win32.h
===================================================================
RCS file: /cvs/gcc/gcc/libjava/include/win32.h,v
retrieving revision 1.9
diff -u -r1.9 win32.h
--- include/win32.h 26 Aug 2002 05:29:59 -0000 1.9
+++ include/win32.h 26 Aug 2002 18:29:19 -0000
@@ -19,8 +19,7 @@
 #include <gcj/cni.h>
 #include <java/util/Properties.h>
 
-// FIXME: remove this once the io.h issue is resolved
-extern "C" char*   getcwd (char*, int);
+#include <io.h>
 
 extern void _Jv_platform_initialize (void);
 extern void _Jv_platform_initProperties (java::util::Properties*);
Index: java/net/natPlainDatagramSocketImpl.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/net/natPlainDatagramSocketImpl.cc,v
retrieving revision 1.39
diff -u -r1.39 natPlainDatagramSocketImpl.cc
--- java/net/natPlainDatagramSocketImpl.cc 25 Jun 2002 05:29:22 -0000 1.39
+++ java/net/natPlainDatagramSocketImpl.cc 26 Aug 2002 18:29:20 -0000
@@ -17,13 +17,10 @@
 #define ENOPROTOOPT 109
 #endif
 
-static inline int
-close(int s)
-{
-  return closesocket(s);
-}
+#define NATIVE_CLOSE(s) closesocket (s)
 
 #else /* WIN32 */
+
 #ifdef HAVE_SYS_SOCKET_H
 #include <sys/socket.h>
 #endif
@@ -35,6 +32,9 @@
 #endif
 #include <errno.h>
 #include <string.h>
+
+#define NATIVE_CLOSE(s) ::close (s)
+
 #endif /* WIN32 */
 
 #if HAVE_BSTRING_H
@@ -303,7 +303,7 @@
 
   // The method isn't declared to throw anything, so we disregard
   // the return value.
-  ::close (fnum);
+  NATIVE_CLOSE (fnum);
   fnum = -1;
   timeout = 0;
 }
Index: java/net/natPlainSocketImpl.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/net/natPlainSocketImpl.cc,v
retrieving revision 1.42
diff -u -r1.42 natPlainSocketImpl.cc
--- java/net/natPlainSocketImpl.cc 18 Jun 2002 16:25:00 -0000 1.42
+++ java/net/natPlainSocketImpl.cc 26 Aug 2002 18:29:20 -0000
@@ -20,13 +20,9 @@
 #undef MIN_PRIORITY
 #undef FIONREAD
 
-// These functions make the Win32 socket API look more POSIXy
-static inline int
-close(int s)
-{
-  return closesocket(s);
-}
+#define NATIVE_CLOSE(s) closesocket (s)
 
+// These functions make the Win32 socket API look more POSIXy
 static inline int
 write(int s, void *buf, int len)
 {
@@ -63,6 +59,8 @@
 #include <errno.h>
 #include <string.h>
 
+#define NATIVE_CLOSE(s) ::close (s)
+
 #endif /* WIN32 */
 #endif /* DISABLE_JAVA_NET */
 
@@ -429,7 +427,7 @@
   JvSynchronize sync (this);
 
   // should we use shutdown here? how would that effect so_linger?
-  int res = ::close (fnum);
+  int res = NATIVE_CLOSE (fnum);
 
   if (res == -1)
     {



More information about the Java mailing list