summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorin2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2003-05-15 14:48:46 +0800
committerin2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2003-05-15 14:48:46 +0800
commitb1575031b5c9da036d2f33053691d0fdc4ed43df (patch)
treeed68224f9ead14fb4341b841c1c068c2270e8c94
parentd5ca5ae17d82a49a0308931bf3440328f98b9f21 (diff)
downloadpttbbs-b1575031b5c9da036d2f33053691d0fdc4ed43df.tar
pttbbs-b1575031b5c9da036d2f33053691d0fdc4ed43df.tar.gz
pttbbs-b1575031b5c9da036d2f33053691d0fdc4ed43df.tar.bz2
pttbbs-b1575031b5c9da036d2f33053691d0fdc4ed43df.tar.lz
pttbbs-b1575031b5c9da036d2f33053691d0fdc4ed43df.tar.xz
pttbbs-b1575031b5c9da036d2f33053691d0fdc4ed43df.tar.zst
pttbbs-b1575031b5c9da036d2f33053691d0fdc4ed43df.zip
timed
git-svn-id: http://opensvn.csie.org/pttbbs/pttbbs/trunk/pttbbs@846 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--util/shmctl.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/util/shmctl.c b/util/shmctl.c
index ac9cb15b..0348c768 100644
--- a/util/shmctl.c
+++ b/util/shmctl.c
@@ -1,4 +1,4 @@
-/* $Id: shmctl.c,v 1.40 2003/05/07 03:35:07 bbs Exp $ */
+/* $Id: shmctl.c,v 1.41 2003/05/15 06:48:46 in2 Exp $ */
#include "bbs.h"
#include <sys/wait.h>
@@ -275,9 +275,6 @@ int utmpsortd(int argc, char **argv)
else{
while( 1 ){
int i;
-#ifdef OUTTA_TIMER
- SHM->GV2.e.now = time(NULL);
-#endif
for( i = 0 ; SHM->UTMPbusystate && i < 5 ; ++i )
usleep(300000);
@@ -394,6 +391,22 @@ int listpid(int argc, char **argv)
return 0;
}
+#ifdef OUTTA_TIMER
+int timed(int argc, char **argv)
+{
+ pid_t pid;
+ if( (pid = fork()) < 0 )
+ perror("fork()");
+ if( pid != 0 )
+ return 0;
+ while( 1 ){
+ SHM->GV2.e.now = time(NULL);
+ sleep(1);
+ }
+}
+#endif
+
+
struct {
int (*func)(int, char **);
char *cmd, *descript;
@@ -407,6 +420,9 @@ struct {
{showglobal, "showglobal", "show GLOBALVAR[]"},
{setglobal, "setglobal", "set GLOBALVAR[]"},
{listpid, "listpid", "list all pids of mbbsd"},
+#ifdef OUTTA_TIMER
+ {timed, "timed", "time daemon for OUTTA_TIMER"},
+#endif
{NULL, NULL, NULL} };
int main(int argc, char **argv)