/* ******************************************************************************* * Copyright (c) 1997 Martin Poole * ******************************************************************************* ** ** WARNING !! WARNING !! WARNING !! WARNING !! WARNING !! WARNING !! ** ** Any changes to be made to this file should first be checked with ** mplib1 source control for library integrity. ** ** mplib1 source control can be reached at mplib1@quatermass.co.uk ** * * $Source: /home/cvs/cvsroot/onelan/onelan/src/mplib1/util/watchdog_fake.c,v $ * $Author: mpoole $ * $Date: 2002/10/07 09:37:30 $ * $Revision: 1.2 $ * Purpose : * ******************************************************************************* * * Change History * * $Log: watchdog_fake.c,v $ * Revision 1.2 2002/10/07 09:37:30 mpoole * Initial checkin of mplib1-3.1.0 * * Revision 1.1 2002/10/07 09:37:09 mpoole * Initial checkin of mplib1-3.1.0 * * ******************************************************************************* */ #ident "$Header: /home/cvs/cvsroot/onelan/onelan/src/mplib1/util/watchdog_fake.c,v 1.2 2002/10/07 09:37:30 mpoole Exp $" /* ------------------------------------------------------------------ Include files ------------------------------------------------------------------ */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include /* ------------------------------------------------------------------ structures / defines ------------------------------------------------------------------ */ /* ------------------------------------------------------------------ Code starts here ------------------------------------------------------------------ */ static void usage ( const char *progname, const char *errstr ) { if (errstr) fprintf( stderr, "Error: %s\n", errstr ); fprintf(stderr, "\nUsage: %s -f filename\n", progname ); exit(1); return; } int main ( int argc, char *argv[] ) { int optc,verbose =0,rv; int cfg_read=0; char *pid_name=NULL; void *vp; while ((optc = getopt(argc, argv, "f:p:")) != EOF) switch (optc) { case 'f': read_config_file( optarg ); cfg_read=1; break; case 'p' : pid_name = optarg; break; case 'v': verbose = 1; break; default: usage( argv[0], "Invalid argument supplied" ); break; } if (!cfg_read) { usage( argv[0], "Config file not specified\n" ); } leavehome(); if (getenv("PROGRAM_NAME")==NULL) Set_My_Proc_Details( NULL, mpbasename(argv[0]), NULL, NULL, 0600, 0 ); if (pid_name) { if (lock_file(pid_name)==0) { fprintfile( stderr, "Unable to lock file %s\n", pid_name ); return(1); } }else { vp = comms_shm_attach( eval_config_default( "SHM_CONFIG", "$HOME/config/shm.cfg" ), SODB_READ_CONFIG ); if (vp==NULL) { fprintfile( stderr, "comms_shm_attach: failed\n" ); return(1); } Register_Process_Details( vp ); } fprintfile( stderr,"Starting\n" ); rv = get_config_int( "POLL_PERIOD" ); if (rv<=0) rv = 45; while(1) { sleep((unsigned int)rv); }; return(0); } /* -- End of File -- */