7060790: (fs) FileSystem.newWatchService error message confusing when maximum inotify descriptors reached
Reviewed-by: forax
--- a/jdk/src/solaris/classes/sun/nio/fs/LinuxWatchService.java Sat Aug 27 02:17:33 2011 -0700
+++ b/jdk/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/jdk/src/solaris/native/sun/nio/fs/genUnixConstants.c Sat Aug 27 02:17:33 2011 -0700
+++ b/jdk/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)