hg: jdk8/tl/jdk: 7102704: test/java/net/DatagramSocket/ChangingAddress.java failing

2011-10-20 Thread chris . hegarty
Changeset: 634cd6f050ba
Author:chegar
Date:  2011-10-20 09:08 +0100
URL:   http://hg.openjdk.java.net/jdk8/tl/jdk/rev/634cd6f050ba

7102704: test/java/net/DatagramSocket/ChangingAddress.java failing
Reviewed-by: chegar
Contributed-by: kurchi.subhra.ha...@oracle.com

- test/java/net/DatagramSocket/ChangingAddress.java



hg: jdk8/tl/jdk: 2 new changesets

2011-10-20 Thread michael . x . mcmahon
Changeset: 2d89c3f74aa5
Author:michaelm
Date:  2011-10-20 09:21 +0100
URL:   http://hg.openjdk.java.net/jdk8/tl/jdk/rev/2d89c3f74aa5

7102665: Move tests to Problemlist
Reviewed-by: chegar, alanb

! test/ProblemList.txt

Changeset: 52c2dd336207
Author:michaelm
Date:  2011-10-20 09:26 +0100
URL:   http://hg.openjdk.java.net/jdk8/tl/jdk/rev/52c2dd336207

Merge

- test/java/net/DatagramSocket/ChangingAddress.java



Re: java.net.NetworkInterface.getNetworkInterfaces does not work properly on AIX with IPv6

2011-10-20 Thread Jonathan Lu

On 10/20/2011 02:35 PM, Steve Poole wrote:

On Thu, 2011-10-20 at 13:24 +0800, Jonathan Lu wrote:

On 10/19/2011 06:03 PM, Steve Poole wrote:

On Mon, 2011-10-17 at 15:14 +0800, Jonathan Lu wrote:

Hi net-devs,

I've got a problem on AIX operating system when IPv6 is enabled,which
can be easily reproduced by attached test case NetworkInterfaceTest.java.
On AIX paltform, the /proc file system behaves differently from Linux,
so we cannot just read required lines from /proc/net/if_inet6 but to
call ioctl to get needed information. A patch is available for OpenJDK8
code base, see attachment patch.diff.

Is anybody interested in this topic?

I'm quite aware of the fact that so far there's no publicly available
building scripts for OpenJDK8 on AIX operating system, but before
everything settles down, is anybody willing to review the patch? any
ideas about how to integrate it?

Best regards!

Hi Jonathan -  can you add a copyright header to the testcase and see if
you can make the testcase fit into a jtreg test format?


Hi Steve,
Thanks for your suggestion.
I've updated the test case to fit into a jtreg format, see the
attachment NetworkInterfaceTest.java.

Cool - at a quick glance it looks fine - except your're missing the IBM
attribution comment.  I'll send you the details.


- Jonathan

Thanks Steve, I've updated the test case and patch, see the attachments.
I've added IBM portions copyright comment to both headers.

- Jonathan
/*
 * Copyright (c) 2011 Oracle and/or its affiliates. All rights reserved.
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * This code is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License version 2 only, as
 * published by the Free Software Foundation.
 *
 * This code is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 * version 2 for more details (a copy is included in the LICENSE file that
 * accompanied this code).
 *
 * You should have received a copy of the GNU General Public License version
 * 2 along with this work; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 * or visit www.oracle.com if you need additional information or have any
 * questions.
 */

/*
 * Portions Copyright (c) 2011 IBM Corporation
 */

import java.net.*;
import java.util.*;

/* @test NetworkInterfaceTest
 * @summary java.net.NetworkInterface.getNetworkInterfaces() does not work properly on AIX with IPv6
 */

public class NetworkInterfaceTest {
java.net.NetworkInterface pnics;
java.util.Enumeration nics1;

NetworkInterfaceTest() throws Exception{
java.net.NetworkInterface jnic;
java.util.Enumeration nics;
List lst = new ArrayList();
List lst1 = new ArrayList();

try {
nics = java.net.NetworkInterface.getNetworkInterfaces();
while (nics.hasMoreElements()) {
jnic = (java.net.NetworkInterface) nics.nextElement();
lst = jnic.getInterfaceAddresses();
nics1 = jnic.getInetAddresses();
while (nics1.hasMoreElements()) {
InetAddress addr1 = (InetAddress) nics1.nextElement();
if (!(lst1.contains(addr1))) {
lst1.add(addr1);
}
}

if(lst.size() != lst1.size()){
throw new Exception("NetworkInterfaceTest Failed");
}

lst1.clear();
}
} catch (java.lang.Exception e) {
e.printStackTrace();
}
}

public static void main(String[] args) throws Exception{
new NetworkInterfaceTest();
}
}
diff -r 4788745572ef -r d7cd8c7c05af src/solaris/native/java/net/NetworkInterface.c
--- a/src/solaris/native/java/net/NetworkInterface.c	Mon Oct 17 19:06:53 2011 -0700
+++ b/src/solaris/native/java/net/NetworkInterface.c	Thu Oct 20 16:54:37 2011 +0800
@@ -23,6 +23,13 @@
  * questions.
  */
 
+/*
+ * Portions Copyright (c) 2011 IBM Corporation
+ */
+
+#define MAX(x,y) ((x) > (y) ? (x) : (y))
+#define SIZE(p) MAX((p).sa_len, sizeof(p))
+
 
 #include 
 #include 
@@ -1095,12 +1102,96 @@
 return ifs;
 }
 
-
+#if defined(AF_INET6)   
+#if defined(AIX) 
+/*  
+ * Enumerates and returns all IPv6 interfaces on AIX  
+ */  
+static netif *enumIPv6Interfaces(JNIEnv *env, int sock, netif *ifs) { 
+struct ifconf ifc;  
+str

Re: java.net.NetworkInterface.getNetworkInterfaces does not work properly on AIX with IPv6

2011-10-20 Thread Neil Richards
On Thu, 2011-10-20 at 17:12 +0800, Jonathan Lu wrote:
> On 10/20/2011 02:35 PM, Steve Poole wrote:
> Thanks Steve, I've updated the test case and patch, see the attachments.
> I've added IBM portions copyright comment to both headers.
> 
> - Jonathan

For ease of review, I've uploaded the suggested fix as a webrev [1].

Whilst creating this, I stripped the (large amount of) extraneous
trailing whitespace characters from the lines added by the patch.
(It would be helpful to check for this when posting patches).


Looking at the change, I have some concerns.

Firstly, the added AIX-specific code (between lines 1102-1187) has been
placed in a block of code that looks to be Linux-specific (lines
1013-1365, protected by '#ifdef __linux__').

So it's unclear why any of this code will be used by AIX.


Secondly, if an exception occurs whilst the list of interfaces is being
compiled, both Linux and Solaris look to return the list compiled up to
the point of the exception (blocks starting at lines 1222 & 1505).

In the suggested AIX code, however, the compiled interface list is freed
up in this situation, and NULL returned (block starting at line 1174).

It seems to me that these routines should present similar semantics
(across the 3 platforms).
As the interface list returned is an augmentation of an interface list
that is originally given to the function (the original value of 'ifs'),
the suggested AIX code may free off entries in the list that it was not
responsible for allocating, which runs the risk of resulting in
duplicate calls to free().

Could you please investigate where the responsibilities properly lie for
allocation and deallocation of the entries in the interface list given
to the enumIPv6Interfaces() function, then update the proposal /
comments appropriately?


Also, I'm concerned that the name of the testcase provided is overly
vague (what _specifically_ about NetworkInterface does it test?), and
that the @summary description does not describe what the intention of
the test is.
In particular, there is nothing platform-specific about the testcase, so
I would not expect its description to be in terms of something
AIX-specific.


Hope this helps,
Regards, Neil

[1] http://cr.openjdk.java.net/~ngmr/ojdk-172/webrev.00/

-- 
Unless stated above:
IBM email: neil_richards at uk.ibm.com
IBM United Kingdom Limited - Registered in England and Wales with number 741598.
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU



hg: jdk8/tl/jdk: 7100054: (porting) Native code should include fcntl.h and unistd.h rather than sys/fcntl.h and sys/unistd.h

2011-10-20 Thread neil . richards
Changeset: c3da0672a882
Author:ngmr
Date:  2011-10-13 12:30 +0100
URL:   http://hg.openjdk.java.net/jdk8/tl/jdk/rev/c3da0672a882

7100054: (porting) Native code should include fcntl.h and unistd.h rather than 
sys/fcntl.h and sys/unistd.h
Summary: Use POSIX defined includes for unistd.h and fcntl.h
Reviewed-by: dholmes, alanb, chegar, ngmr
Contributed-by: Charles Lee 

! src/solaris/native/sun/nio/fs/genSolarisConstants.c
! src/solaris/native/sun/nio/fs/genUnixConstants.c