summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorin2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2003-04-11 02:05:45 +0800
committerin2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2003-04-11 02:05:45 +0800
commit751c6f89a466a830c78c6cbee032b2fe1cdd34c9 (patch)
treee599936c5c8cbd1bd0773a152b238bc8260cf6d0
parent744278308f5c23b65b081011b37740e316d78109 (diff)
downloadpttbbs-751c6f89a466a830c78c6cbee032b2fe1cdd34c9.tar
pttbbs-751c6f89a466a830c78c6cbee032b2fe1cdd34c9.tar.gz
pttbbs-751c6f89a466a830c78c6cbee032b2fe1cdd34c9.tar.bz2
pttbbs-751c6f89a466a830c78c6cbee032b2fe1cdd34c9.tar.lz
pttbbs-751c6f89a466a830c78c6cbee032b2fe1cdd34c9.tar.xz
pttbbs-751c6f89a466a830c78c6cbee032b2fe1cdd34c9.tar.zst
pttbbs-751c6f89a466a830c78c6cbee032b2fe1cdd34c9.zip
sleep interval in argv[1]
git-svn-id: http://opensvn.csie.org/pttbbs/pttbbs/trunk/pttbbs@787 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--util/shmctl.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/util/shmctl.c b/util/shmctl.c
index 89c9069a..04f5b112 100644
--- a/util/shmctl.c
+++ b/util/shmctl.c
@@ -1,4 +1,4 @@
-/* $Id: shmctl.c,v 1.38 2003/04/08 09:53:21 in2 Exp $ */
+/* $Id: shmctl.c,v 1.39 2003/04/10 18:05:45 in2 Exp $ */
#include "bbs.h"
#include <sys/wait.h>
@@ -257,11 +257,16 @@ inline void utmpsort(void)
int utmpsortd(int argc, char **argv)
{
pid_t pid;
+ int interval; // sleep interval in microsecond(1/10**6)
+
if( fork() > 0 ){
puts("sortutmpd daemonized...");
return 0;
}
+ if( argc != 2 || (interval = atoi(argv[1])) < 500000 )
+ interval = 1000000; // default to 1 sec
+
while( 1 ){
if( (pid = fork()) != 0 ){
int s;
@@ -276,7 +281,7 @@ int utmpsortd(int argc, char **argv)
if( SHM->UTMPneedsort )
utmpsort();
- sleep(1);
+ usleep(interval);
}
}
}