You must be logged in to do that

Re: network sockets unusable?

  • From: Johannes Eickhold <jeick@so.in.tum.de>
  • To: users@maxine.kenai.com
  • Subject: Re: network sockets unusable?
  • Date: Tue, 02 Feb 2010 17:22:29 +0100

On Sun, 2010-01-31 at 18:13 -0800, Doug Simon wrote:

Hi Doug.

> If you decide to implement the missing functionality for the programs
> you are trying to run and run into problems, be sure to let me know.

I successfully modified jvm.c to get Jetty 6.1.22 [1] running on Maxine.
You find the hg changeset attached as a patch.

For testing I only started Jetty and called the build in example
servlets which was working fine.

I expect my changes will break compilation on other systems than Linux
because of the include of sys/ioctl.h. Not sure how to handle this
correctly.

Johannes

[1] http://jetty.codehaus.org/jetty/

PS: In Jetty's configuration I changed the default handler which would
have used NIO. Thus my Jetty was only using plain sockets. I doubt NIO
is currently working in Maxine, right?
# HG changeset patch
# User Johannes Eickhold <jeick@so.in.tum.de>
# Date 1265125731 -3600
# Node ID 44a79d4dc2f9506db673b944442a92be847bf52a
# Parent  cf1c5f6686d8125b9f8a0a3fa6dee707bdda68c4
Made plain sockets work (tested by running Jetty 6.1.22 without NIO sockets).
Took code from openjdk-6b17 to implement JVM_SocketAvailable.

diff -r cf1c5f6686d8 -r 44a79d4dc2f9 Native/substrate/jvm.c
--- a/Native/substrate/jvm.c	Wed Jan 27 17:16:42 2010 -0800
+++ b/Native/substrate/jvm.c	Tue Feb 02 16:48:51 2010 +0100
@@ -31,6 +31,7 @@
 #include <unistd.h>
 #include <fcntl.h>
 #include <string.h>
+#include <sys/ioctl.h>
 
 #include "jni.h"
 #include "log.h"
@@ -1883,7 +1884,7 @@
 
 jint
 JVM_Accept(jint fd, struct sockaddr *him, jint *len) {
-#if os_SOLARIS
+#if os_SOLARIS || os_LINUX
     if (fd < 0) {
         return -1;
     }
@@ -1933,6 +1934,13 @@
     // note ioctl can return 0 when successful, JVM_SocketAvailable
     // is expected to return 0 on failure and 1 on success to the jdk.
     return (ret == OS_ERR) ? 0 : 1;
+#elif os_LINUX
+    // Linux doc says EINTR not returned, unlike Solaris
+    int ret = ioctl(fd, FIONREAD, pbytes);
+
+    //%% note ioctl can return 0 when successful, JVM_SocketAvailable
+    // is expected to return 0 on failure and 1 on success to the jdk.
+    return (ret < 0) ? 0 : 1;
 #else
     c_UNIMPLEMENTED();
     return 0;
@@ -1942,7 +1950,7 @@
 
 jint
 JVM_GetSockName(jint fd, struct sockaddr *him, int *len) {
-#if os_SOLARIS
+#if os_SOLARIS|| os_LINUX
     return getsockname(fd, him, (socklen_t*) len);
 #else
     c_UNIMPLEMENTED();
@@ -1962,7 +1970,7 @@
 
 jint
 JVM_SetSockOpt(jint fd, int level, int optname, const char *optval, int optlen) {
-#if os_SOLARIS
+#if os_SOLARIS || os_LINUX
     return setsockopt(fd, level, optname, optval, optlen);
 #else
     c_UNIMPLEMENTED();


Re: network sockets unusable?

Doug Simon 02/01/2010

Re: network sockets unusable?

Johannes Eickhold 02/02/2010

Re: network sockets unusable?

Doug Simon 02/02/2010

Re: network sockets unusable?

Johannes Eickhold 02/02/2010
  • Mysql
  • Glassfish
  • Jruby
  • Rails
  • Nblogo
Terms of Use; Privacy Policy;
© 2010, Oracle Corporation and/or its affiliates
(revision 20100312.9442df5)
 
 
loading
Please Confirm