blow up rlimit of process

NOFILE: 1000000:1000000
NPROC: 30604:30604
SIGPENGING: 30604:30604

Signed-off-by: Gao feng <omarapazanadi@gmail.com>
This commit is contained in:
Gao feng
2016-08-29 16:05:15 +08:00
parent c72276b004
commit cb71f43ed1
+22
View File
@@ -6,6 +6,7 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include <sys/resource.h>
#include <fcntl.h>
#include <dirent.h>
#include <sched.h>
@@ -1144,6 +1145,7 @@ static int hyper_loop(void)
struct epoll_event *events;
struct hyper_pod *pod = &global_pod;
sigset_t mask, omask;
struct rlimit limit;
sigemptyset(&mask);
sigaddset(&mask, SIGCHLD);
@@ -1162,6 +1164,26 @@ static int hyper_loop(void)
sigdelset(&omask, SIGCHLD);
signal(SIGCHLD, hyper_init_sigchld);
// setup open file limit
limit.rlim_cur = limit.rlim_max = 1000000;
if (setrlimit(RLIMIT_NOFILE, &limit) < 0) {
perror("set rlimit for NOFILE failed");
return -1;
}
// setup process num limit
limit.rlim_cur = limit.rlim_max = 30604;
if (setrlimit(RLIMIT_NPROC, &limit) < 0) {
perror("set rlimit for NPROC failed");
return -1;
}
// setup pending signal limit, same with NRPROC
if (setrlimit(RLIMIT_SIGPENDING, &limit) < 0) {
perror("set rlimit for SIGPENDING failed");
return -1;
}
ctl.efd = epoll_create1(EPOLL_CLOEXEC);
if (ctl.efd < 0) {
perror("epoll_create failed");