diff options
author | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2009-10-29 10:49:39 +0800 |
---|---|---|
committer | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2009-10-29 10:49:39 +0800 |
commit | 5120c64156adeaeb18538aafda8c913c96a9ba11 (patch) | |
tree | ddbba59c17e2098f9993790a77bbdc3d7cbd1fe8 | |
parent | 29d22d3038e932f1bd623a211846d5af58cbbd73 (diff) | |
download | pttbbs-5120c64156adeaeb18538aafda8c913c96a9ba11.tar pttbbs-5120c64156adeaeb18538aafda8c913c96a9ba11.tar.gz pttbbs-5120c64156adeaeb18538aafda8c913c96a9ba11.tar.bz2 pttbbs-5120c64156adeaeb18538aafda8c913c96a9ba11.tar.lz pttbbs-5120c64156adeaeb18538aafda8c913c96a9ba11.tar.xz pttbbs-5120c64156adeaeb18538aafda8c913c96a9ba11.tar.zst pttbbs-5120c64156adeaeb18538aafda8c913c96a9ba11.zip |
* enable adjusting cpu/core limits
git-svn-id: http://opensvn.csie.org/pttbbs/trunk@5009 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r-- | pttbbs/util/xchatd.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/pttbbs/util/xchatd.c b/pttbbs/util/xchatd.c index 219421ff..3f419f1d 100644 --- a/pttbbs/util/xchatd.c +++ b/pttbbs/util/xchatd.c @@ -2648,6 +2648,22 @@ start_daemon() limit.rlim_cur = limit.rlim_max; setrlimit(RLIMIT_NOFILE, &limit); +#ifndef NO_ADJUST_CPU_LIMITS + // because xchatd may be started by BBS process, + // its cpu resource may be limited and cause regular restart. + // to workaround this, let's enlarge CPU limit here. + getrlimit(RLIMIT_CPU, &limit); + limit.rlim_cur = limit.rlim_max; + setrlimit(RLIMIT_CPU, &limit); +#endif + +#ifdef USE_XCHATD_COREDUMP + getrlimit(RLIMIT_CORE, &limit); + limit.rlim_cur = limit.rlim_max; + setrlimit(RLIMIT_CORE, &limit); +#endif + + fd = open(CHAT_PIDFILE, O_WRONLY | O_CREAT | O_TRUNC, 0600); if (fd >= 0) { |