changeset 4519:83add4632b49

7060790: (fs) FileSystem.newWatchService error message confusing when maximum inotify descriptors reached Reviewed-by: forax
author alanb
date Sat, 27 Aug 2011 15:40:45 +0100
parents e4729ad0d7b5
children 02c2d38f4271 fe205518c3a7
files src/solaris/classes/sun/nio/fs/LinuxWatchService.java src/solaris/native/sun/nio/fs/genUnixConstants.c
diffstat 2 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/solaris/classes/sun/nio/fs/LinuxWatchService.java	Sat Aug 27 02:17:33 2011 -0700
+++ b/src/solaris/classes/sun/nio/fs/LinuxWatchService.java	Sat Aug 27 15:40:45 2011 +0100
@@ -58,7 +58,10 @@
         try {
             ifd = inotifyInit();
         } catch (UnixException x) {
-            throw new IOException(x.errorString());
+            String msg = (x.errno() == EMFILE) ?
+                "User limit of inotify instances reached or too many open files" :
+                x.errorString();
+            throw new IOException(msg);
         }
 
         // configure inotify to be non-blocking
--- a/src/solaris/native/sun/nio/fs/genUnixConstants.c	Sat Aug 27 02:17:33 2011 -0700
+++ b/src/solaris/native/sun/nio/fs/genUnixConstants.c	Sat Aug 27 15:40:45 2011 +0100
@@ -108,6 +108,7 @@
     DEF(EROFS);
     DEF(ENODATA);
     DEF(ERANGE);
+    DEF(EMFILE);
 
     // flags used with openat/unlinkat/etc.
 #if defined(AT_SYMLINK_NOFOLLOW) && defined(AT_REMOVEDIR)