/** * I'm not actually sure if mirror needs this check, because Watchman insinuates * it's likely to be low on Mac OS, but I don't use Mac OS, so I can't really say * how often/if this would happen. * * But it's easy enough to check for anyway, and really most developer machines * should have an increased ulimit anyway. */ private static boolean checkFileDescriptorLimit() { RLimit limit = posix.getrlimit(RLIMIT_NOFILE.intValue()); if (limit.rlimCur() < limit.rlimMax()) { log.info("Increasing file limit to {}", limit.rlimMax()); posix.setrlimit(RLIMIT_NOFILE.intValue(), limit.rlimMax(), limit.rlimMax()); limit = posix.getrlimit(RLIMIT_NOFILE.intValue()); } if (limit.rlimCur() < 10240) { log.error("Your file limit is {} and should probably be increased", limit); log.info(" See https://facebook.github.io/watchman/docs/install.html#system-specific-preparation"); log.info(" E.g. run: sudo sysctl -w kern.maxfiles=10485760 && sudo sysctl -w kern.maxfilesperproc=1048576"); log.info(" Or use --skip-limit-checks to ignore this"); return false; } return true; }
public static IRubyObject getrlimit(Ruby runtime, IRubyObject arg) { if (!runtime.getPosix().isNative() || Platform.IS_WINDOWS) { runtime.getWarnings().warn("Process#getrlimit not supported on this platform"); return runtime.newFixnum(Long.MAX_VALUE); } RLimit rlimit = runtime.getPosix().getrlimit(rlimitResourceType(runtime, arg)); return runtime.newArray(runtime.newFixnum(rlimit.rlimCur()), runtime.newFixnum(rlimit.rlimMax())); }
public static IRubyObject getrlimit(Ruby runtime, IRubyObject arg) { if (!runtime.getPosix().isNative() || Platform.IS_WINDOWS) { runtime.getWarnings().warn("Process#getrlimit not supported on this platform"); return runtime.newFixnum(Long.MAX_VALUE); } RLimit rlimit = runtime.getPosix().getrlimit(rlimitResourceType(runtime, arg)); return runtime.newArray(runtime.newFixnum(rlimit.rlimCur()), runtime.newFixnum(rlimit.rlimMax())); }