<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    u_long* and int (for size_t) are the types used by the windows API.
    So they have kept the posix function names but have slightly
    different types.<br>
    <br>
    So the stack is:<br>
    <br>
    winsock.h ::ioctlsocket(int s, ..., u_long *pbytes)<br>
    os.cpp: os::socket_available(int fd, jint *pbytes)<br>
    prims.cpp: JVM_SocketAvailable(jint fd, jint *pbytes)<br>
    <br>
    So the JNI layer always uses signed value, the os-interface and the
    posix OSes uses some unsigneds, and windows uses some of both. So
    regardless of what we do - there will be casts. <br>
    <br>
    //N<br>
    <br>
    David Holmes skrev 2012-04-17 04:57:
    <blockquote cite="mid:4F8CDC04.3070407@oracle.com" type="cite">Hi
      Nils,
      <br>
      <br>
      I'm very suspicious of the cast from jint* to u_long*, and also
      from size_t to int. In both cases we would seem to have potential
      problems on 64-bit systems.
      <br>
      <br>
      What are the actual types expected by the underlying system calls?
      <br>
      <br>
      David
      <br>
      -----
      <br>
      <br>
      On 13/04/2012 6:21 PM, Nils Eliasson wrote:
      <br>
      <blockquote type="cite">Can only find julong. u_long is defined in
        winsock.h that this is a call to.
        <br>
        <br>
        Changed the pointer cast to a correct construct.
        <br>
        <br>
        <a class="moz-txt-link-freetext" href="http://cr.openjdk.java.net/~neliasso/7157695/webrev.04/">http://cr.openjdk.java.net/~neliasso/7157695/webrev.04/</a>
        <br>
<a class="moz-txt-link-rfc2396E" href="http://cr.openjdk.java.net/%7Eneliasso/7157695/webrev.04/">&lt;http://cr.openjdk.java.net/%7Eneliasso/7157695/webrev.04/&gt;</a>
        <br>
        <br>
        Otherwise the same.
        <br>
        <br>
        Thanks,
        <br>
        //Nils
        <br>
        <br>
        <br>
        Vladimir Kozlov skrev 2012-04-10 17:08:
        <br>
        <blockquote type="cite">+ int ret = ::ioctlsocket(fd, FIONREAD,
          (u_long*)pbytes);
          <br>
          <br>
          What type is u_long? VM has defined type 'ulong' not 'u_long'.
          <br>
          <br>
          Otherwise looks good.
          <br>
          <br>
          Vladimir
          <br>
          <br>
          On 4/10/12 6:45 AM, Nils Eliasson wrote:
          <br>
          <blockquote type="cite">Any comments on the latest rev?
            <br>
            <br>
            //Nils
            <br>
            <br>
            Nils Eliasson skrev 2012-03-30 10:40:
            <br>
            <blockquote type="cite">ok,
              <br>
              <br>
              New webrev here:
              <br>
              <a class="moz-txt-link-freetext" href="http://cr.openjdk.java.net/~neliasso/7157695/webrev.03/">http://cr.openjdk.java.net/~neliasso/7157695/webrev.03/</a>
              <br>
<a class="moz-txt-link-rfc2396E" href="http://cr.openjdk.java.net/%7Eneliasso/7157695/webrev.03/">&lt;http://cr.openjdk.java.net/%7Eneliasso/7157695/webrev.03/&gt;</a>
              <br>
              <br>
              Defining socklen_t as int on windows makes a much better
              impl.
              <br>
              <br>
              Remains some casts from size_t to int on windows. So we
              have jni
              <br>
              call in jvm.h with jint/int -&gt; os.hpp with size_t -&gt;
              <br>
              os_windows.hpp with int. But we don't expect any negative
              lenghts so
              <br>
              it should work.
              <br>
              <br>
              Thanks for the feedback,
              <br>
              Nils E
              <br>
              <br>
              David Holmes skrev 2012-03-29 23:20:
              <br>
              <blockquote type="cite">On 30/03/2012 4:36 AM, Dean Long
                wrote:
                <br>
                <blockquote type="cite">Isn't this webrev reversing the
                  recent changes for 7091417?
                  <br>
                </blockquote>
                <br>
                Yes - and it shouldn't be. size_t's and socklen_t's are
                the correct
                <br>
                types to use.
                <br>
                <br>
                David
                <br>
                <br>
                <blockquote type="cite">dl
                  <br>
                  <br>
                  On 3/29/2012 10:42 AM, Christian Thalinger wrote:
                  <br>
                  <blockquote type="cite">I'm pretty sure this gets us
                    into trouble with some compiler
                    <br>
                    somewhere
                    <br>
                    (I'd guess GCC on Linux). On Mac OS X send is
                    declared as:
                    <br>
                    <br>
                    ssize_t
                    <br>
                    send(int socket, const void *buffer, size_t length,
                    int flags);
                    <br>
                    <br>
                    but length is now passed as int:
                    <br>
                    <br>
                    -inline int os::send(int fd, char* buf, size_t
                    nBytes, uint flags) {
                    <br>
                    +inline int os::send(int fd, char* buf, int nBytes,
                    int flags) {
                    <br>
                    RESTARTABLE_RETURN_INT(::send(fd, buf, nBytes,
                    flags));
                    <br>
                    }
                    <br>
                    <br>
                    I think your changes are good but we might need some
                    casts down
                    <br>
                    in the
                    <br>
                    OS files eventually.
                    <br>
                    <br>
                    -- Chris
                    <br>
                    <br>
                    On Mar 29, 2012, at 3:00 PM, Nils Eliasson wrote:
                    <br>
                    <br>
                    <blockquote type="cite"><a class="moz-txt-link-freetext" href="http://cr.openjdk.java.net/~neliasso/7157695/webrev.01/">http://cr.openjdk.java.net/~neliasso/7157695/webrev.01/</a><a class="moz-txt-link-rfc2396E" href="http://cr.openjdk.java.net/%7Eneliasso/7157695/webrev.01/">&lt;http://cr.openjdk.java.net/%7Eneliasso/7157695/webrev.01/&gt;</a>
                      <br>
                      <br>
                      <br>
                      <br>
                      7157695 - Add windows implementation of socket
                      interface
                      <br>
                      <br>
                      Using winsock api which is almost posix
                      compatible. Also changing
                      <br>
                      some argument types for the socket interface calls
                      in os.hpp to
                      <br>
                      make
                      <br>
                      the platform independent code more platform
                      independent. This made
                      <br>
                      the win implementation possible without casts, and
                      allowed me to
                      <br>
                      remove a lot of redundant casts from the jni
                      exports in jvm.cpp.
                      <br>
                    </blockquote>
                  </blockquote>
                </blockquote>
              </blockquote>
              <br>
            </blockquote>
            <br>
            <br>
            --
            <br>
            Oracle <a class="moz-txt-link-rfc2396E" href="http://www.oracle.com">&lt;http://www.oracle.com&gt;</a>
            <br>
            Nils Eliasson | Senior Member of Technical Staff
            <br>
            Oracle Java Platform Group, JVM Engineering
            <br>
            ORACLE Sweden
            <br>
            <br>
          </blockquote>
        </blockquote>
        <br>
        <br>
        --
        <br>
        Oracle <a class="moz-txt-link-rfc2396E" href="http://www.oracle.com">&lt;http://www.oracle.com&gt;</a>
        <br>
        Nils Eliasson | Senior Member of Technical Staff
        <br>
        Oracle Java Platform Group, JVM Engineering
        <br>
        ORACLE Sweden
        <br>
        <br>
      </blockquote>
    </blockquote>
    <br>
    <br>
    <div class="moz-signature">-- <br>
      <a href="http://www.oracle.com" target="_blank"><img
          src="cid:part1.05060309.09050301@oracle.com" alt="Oracle"
          border="0" height="26" width="114"></a><br>
      <font color="#666666" face="Verdana, Arial, Helvetica, sans-serif"
        size="1">Nils Eliasson | Senior Member of Technical Staff<br>
        <font color="#ff0000">Oracle</font> Java Platform Group, JVM
        Engineering<br>
        ORACLE Sweden </font><br>
      <br>
      <!-- This signature was generated by the MyDesktop Oracle Business Signature utility version 3.8.8 -->
    </div>
  </body>
</html>