]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Made setrlimit a commandline option
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>
Mon, 11 Apr 2005 12:36:37 +0000 (12:36 +0000)
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>
Mon, 11 Apr 2005 12:36:37 +0000 (12:36 +0000)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@1042 e03df62e-2008-0410-955e-edbf42e46eb7

src/inspircd.cpp
src/inspircd_io.cpp

index d69aa6a1e1e332818a396e9e3a7acb7a45a29f9e..d784c0925127e22c0d6c24b628efd356c2169591 100644 (file)
@@ -103,6 +103,7 @@ std::vector<int> fd_reap;
 extern int MODCOUNT;
 int openSockfd[MAXSOCKS];
 bool nofork = false;
+bool unlimitcore = false;
 
 time_t TIME = time(NULL);
 
@@ -2181,6 +2182,9 @@ int main(int argc, char **argv)
                        if (!strcmp(argv[i],"-wait")) {
                                sleep(6);
                        }
+                       if (!strcmp(argv[i],"-nolimit")) {
+                               unlimitcore = true;
+                       }
                }
        }
        strlcpy(MyExecutable,argv[0],MAXBUF);
index fca22e3bed64095133987734b038d2382de77fa8..00842b697d0d6f098857f18d7d9c7b39bd6b07d1 100644 (file)
@@ -33,6 +33,7 @@ extern FILE *log_file;
 extern int boundPortCount;
 extern int openSockfd[MAXSOCKS];
 extern time_t TIME;
+extern bool unlimitcore;
 
 void WriteOpers(char* text, ...);
 
@@ -126,17 +127,20 @@ int DaemonSeed (void)
        
        setpriority(PRIO_PROCESS,(int)getpid(),15); /* ircd sets to low process priority so it doesnt hog the box */
 
-       rlimit rl;
-       if (getrlimit(RLIMIT_CORE, &rl) == -1)
+       if (unlimitcore)
        {
-               log(DEFAULT,"Failed to getrlimit()!");
-               return(FALSE);
-       }
-       else
-       {
-               rl.rlim_cur = rl.rlim_max;
-               if (setrlimit(RLIMIT_CORE, &rl) == -1)
-                       log(DEFAULT,"setrlimit() failed, cannot increase coredump size.");
+               rlimit rl;
+               if (getrlimit(RLIMIT_CORE, &rl) == -1)
+               {
+                       log(DEFAULT,"Failed to getrlimit()!");
+                       return(FALSE);
+               }
+               else
+               {
+                       rl.rlim_cur = rl.rlim_max;
+                       if (setrlimit(RLIMIT_CORE, &rl) == -1)
+                               log(DEFAULT,"setrlimit() failed, cannot increase coredump size.");
+               }
        }
   
        return (TRUE);