summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorin2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2002-03-23 17:04:54 +0800
committerin2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2002-03-23 17:04:54 +0800
commit43e01c2ef41c038be688be9eb6ee2e8e0bf6de24 (patch)
treec657cf71b98dece846432644676aa227b8eba124
parentf009a037e105e34728e743a01ffdf47f288ac73e (diff)
downloadpttbbs-43e01c2ef41c038be688be9eb6ee2e8e0bf6de24.tar
pttbbs-43e01c2ef41c038be688be9eb6ee2e8e0bf6de24.tar.gz
pttbbs-43e01c2ef41c038be688be9eb6ee2e8e0bf6de24.tar.bz2
pttbbs-43e01c2ef41c038be688be9eb6ee2e8e0bf6de24.tar.lz
pttbbs-43e01c2ef41c038be688be9eb6ee2e8e0bf6de24.tar.xz
pttbbs-43e01c2ef41c038be688be9eb6ee2e8e0bf6de24.tar.zst
pttbbs-43e01c2ef41c038be688be9eb6ee2e8e0bf6de24.zip
add CPULIMIT
git-svn-id: http://opensvn.csie.org/pttbbs/pttbbs/trunk/pttbbs@58 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--mbbsd/mbbsd.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/mbbsd/mbbsd.c b/mbbsd/mbbsd.c
index 9b223c23..2e910180 100644
--- a/mbbsd/mbbsd.c
+++ b/mbbsd/mbbsd.c
@@ -1,4 +1,4 @@
-/* $Id: mbbsd.c,v 1.14 2002/03/20 05:23:19 in2 Exp $ */
+/* $Id: mbbsd.c,v 1.15 2002/03/23 09:04:54 in2 Exp $ */
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
@@ -15,6 +15,7 @@
#include <sys/wait.h>
#include <sys/socket.h>
#include <sys/time.h>
+#include <sys/resource.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <arpa/telnet.h>
@@ -1004,6 +1005,12 @@ start_client ()
#if FORCE_PROCESS_REGISTER_FORM
int nreg;
#endif
+#ifdef CPULIMIT
+ struct rlimit rml;
+ rml.rlim_cur = CPULIMIT * 60;
+ rml.rlim_max = CPULIMIT * 60;
+ setrlimit(RLIMIT_CPU, &rml);
+#endif
/* system init */
nice (2); /* Ptt: lower priority */