From 7bf58d611c172a81c6dbd595157fb6d226a72ae5 Mon Sep 17 00:00:00 2001 From: in2 Date: Mon, 25 Mar 2002 16:20:20 +0000 Subject: add utmpwatch git-svn-id: http://opensvn.csie.org/pttbbs/pttbbs/trunk/pttbbs@67 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- util/shmctl.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'util') diff --git a/util/shmctl.c b/util/shmctl.c index f8698398..5932fdf3 100644 --- a/util/shmctl.c +++ b/util/shmctl.c @@ -165,6 +165,24 @@ int utmpsort(int argc, char **argv) } /* end of ulistsort */ +int utmpwatch(int argc, char **argv) +{ + int i; + while( 1 ){ + for( i = 0 ; i < 4 ; ++i ){ + usleep(300); + if( !utmpshm->busystate ) + break; + puts("busying..."); + } + if( i == 4 ){ + puts("reset!"); + utmpshm->busystate = 0; + } + } + return 0; +} + struct { int (*func)(int, char **); char *cmd, *descript; @@ -173,6 +191,7 @@ struct { {utmpstate, "utmpstate", "list utmpstate"}, {utmpreset, "utmpreset", "utmpshm->busystate=0"}, {utmpsort, "utmpsort", "sort ulist"}, + {utmpwatch, "utmpwatch", "to see if busystate is always 1 then fix it"}, {NULL, NULL, NULL} }; int main(int argc, char **argv) -- cgit v1.2.3