diff options
author | in2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2003-01-19 09:44:35 +0800 |
---|---|---|
committer | in2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2003-01-19 09:44:35 +0800 |
commit | 928b4d39426ca37b40a3502b6bff0e7b6402b71f (patch) | |
tree | ae43761ef095dc91fb20bbb76885219ea4ce6988 | |
parent | 28760d3b4c23271cf530cacc32d5b108a6c4ca0c (diff) | |
download | pttbbs-928b4d39426ca37b40a3502b6bff0e7b6402b71f.tar pttbbs-928b4d39426ca37b40a3502b6bff0e7b6402b71f.tar.gz pttbbs-928b4d39426ca37b40a3502b6bff0e7b6402b71f.tar.bz2 pttbbs-928b4d39426ca37b40a3502b6bff0e7b6402b71f.tar.lz pttbbs-928b4d39426ca37b40a3502b6bff0e7b6402b71f.tar.xz pttbbs-928b4d39426ca37b40a3502b6bff0e7b6402b71f.tar.zst pttbbs-928b4d39426ca37b40a3502b6bff0e7b6402b71f.zip |
critical memory clean
git-svn-id: http://opensvn.csie.org/pttbbs/pttbbs/trunk/pttbbs@633 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r-- | util/shmctl.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/util/shmctl.c b/util/shmctl.c index 72b7174b..5e58654e 100644 --- a/util/shmctl.c +++ b/util/shmctl.c @@ -1,4 +1,4 @@ -/* $Id: shmctl.c,v 1.29 2002/11/05 14:18:47 in2 Exp $ */ +/* $Id: shmctl.c,v 1.30 2003/01/19 01:44:35 in2 Exp $ */ #include "bbs.h" extern SHM_t *SHM; @@ -317,6 +317,22 @@ int listpid(int argc, char **argv) return 0; } +#ifdef CRITICAL_MEMORY +int cmsignal(int argc, char **argv) +{ + int i; + time_t timebound = time(NULL) - 1200; + char buf[32]; + for( i = 0 ; i < USHM_SIZE ; ++i ) + if( SHM->uinfo[i].pid > 0 && SHM->uinfo[i].lastact < timebound ){ + printf("CMSIGNAL: pid: %6d, lastact: %s\n", + SHM->uinfo[i].pid, CTIMEx(buf, SHM->uinfo[i].lastact)); + kill(SHM->uinfo[i].pid, CMSIGNAL); + } + return 0; +} +#endif + struct { int (*func)(int, char **); char *cmd, *descript; @@ -330,6 +346,9 @@ struct { {showglobal, "showglobal", "show GLOBALVAR[]"}, {setglobal, "setglobal", "set GLOBALVAR[]"}, {listpid, "listpid", "list all pids of mbbsd"}, +#ifdef CRITICAL_MEMORY + {cmsignal, "cmsignal", "send cmsignal"}, +#endif {NULL, NULL, NULL} }; int main(int argc, char **argv) |