[9] RFR of 8074821: Resolve disabled warnings for libnio

Brian Burkhalter brian.burkhalter at oracle.com
Thu May 7 18:15:20 UTC 2015


On May 7, 2015, at 12:48 AM, Alan Bateman <Alan.Bateman at oracle.com> wrote:

> The warning related to checking rlim_max has annoyed me too and I've always meant to spend time on it. The background to this is platforms (Solaris mostly) where the limit is set to RLIM_INFINITY (-3). We had signed/unsigned issues in past releases that had to be worked around. With the patch then it is still compared an unsigned to a signed. It would good to check this and see if you need the cast the RHS to rlim_t.

Would something like this make more sense?

--- a/src/java.base/unix/native/libnio/ch/IOUtil.c
+++ b/src/java.base/unix/native/libnio/ch/IOUtil.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2015, 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
@@ -129,7 +129,8 @@
         JNU_ThrowIOExceptionWithLastError(env, "getrlimit failed");
         return -1;
     }
-    if (rlp.rlim_max < 0 || rlp.rlim_max > java_lang_Integer_MAX_VALUE) {
+    if (rlp.rlim_max == RLIM_INFINITY ||
+        rlp.rlim_max > (rlim_t)java_lang_Integer_MAX_VALUE) {
         return java_lang_Integer_MAX_VALUE;
     } else {
         return (jint)rlp.rlim_max;


> The other changes in the patch look okay to me.
> 
> The issue of GerVersionEx being deprecated is a general issue for the JDK. There is a new helper API that I suspect we need to transition to at some point. The Microsoft folks on this mailing list might be able to advise on this.

Based on my investigation one needs Visual Studio 2013 for the replacement function IsWindowsVistaOrGreater().

Thanks,

Brian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/nio-dev/attachments/20150507/53704731/attachment-0001.html>


More information about the nio-dev mailing list