return 0;
}
+
+void
+virProcessActivateMaxFiles(void)
+{
+ struct rlimit maxfiles = {0};
+
+ /*
+ * Ignore errors since we might be inside a container with seccomp
+ * filters and limits preset to suitable values.
+ */
+ if (getrlimit(RLIMIT_NOFILE, &maxfiles) < 0) {
+ VIR_DEBUG("Unable to fetch process max files limit: %s",
+ g_strerror(errno));
+ return;
+ }
+
+ VIR_DEBUG("Initial max files was %llu", (unsigned long long)maxfiles.rlim_cur);
+
+ maxfiles.rlim_cur = maxfiles.rlim_max;
+
+ if (setrlimit(RLIMIT_NOFILE, &maxfiles) < 0) {
+ VIR_DEBUG("Unable to set process max files limit to %llu: %s",
+ (unsigned long long)maxfiles.rlim_cur, g_strerror(errno));
+ return;
+ }
+
+ VIR_DEBUG("Raised max files to %llu", (unsigned long long)maxfiles.rlim_cur);
+}
+
#else /* ! (WITH_SETRLIMIT && defined(RLIMIT_NOFILE)) */
int
virProcessSetMaxFiles(pid_t pid G_GNUC_UNUSED,
virReportSystemError(ENOSYS, "%s", _("Not supported on this platform"));
return -1;
}
+
+void
+virProcessActivateMaxFiles(void)
+{
+}
#endif /* ! (WITH_SETRLIMIT && defined(RLIMIT_NOFILE)) */
#if WITH_SETRLIMIT && defined(RLIMIT_CORE)
int virProcessSetMaxProcesses(pid_t pid, unsigned int procs);
int virProcessSetMaxFiles(pid_t pid, unsigned int files);
int virProcessSetMaxCoreSize(pid_t pid, unsigned long long bytes);
+void virProcessActivateMaxFiles(void);
int virProcessGetMaxMemLock(pid_t pid, unsigned long long *bytes) G_NO_INLINE;