Changeset 5619:16fe78ec277c in roaraudio for roard


Ignore:
Timestamp:
08/09/12 00:01:15 (7 years ago)
Author:
phi
Branch:
default
Message:

Implemented watchdog (Closes: #291)

Location:
roard
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • roard/lib.c

    r5586 r5619  
    3434 ROAR_WARN("lib_run_bg(cmd='%s', ...): This function should never be called. Contact devels."); 
    3535 
    36  child = fork(); 
     36 child = roar_fork(NULL); 
    3737 
    3838 if ( child == -1 ) { 
     
    4747 
    4848 // we are the child. 
    49  // first we need to close a lot of open files! 
     49 
     50 // first stop the watchdog. 
     51 roar_watchdog_stop(); 
     52 
     53 // then we need to close a lot of open files! 
    5054 
    5155 // before we do this we need to keep backups of our handles: 
  • roard/loop.c

    r5586 r5619  
    6262 
    6363  ROAR_DBG("main_loop(*): looping..."); 
     64 
     65  roar_watchdog_trigger(); 
    6466 
    6567#ifdef ROAR_SUPPORT_LISTEN 
  • roard/roard.c

    r5592 r5619  
    224224        "                         give multible times for being more realtime\n" 
    225225        " --memlock LEVEL       - Set default memory locking level to LEVEL\n" 
     226        " --watchdog            - Enable watchdog\n" 
     227        " --watchdog-time TIME  - Set watchdog time to TIME (in ms)\n" 
    226228#ifdef ROAR_HAVE_CHROOT 
    227229        " --chroot DIR          - chroots to the given dir\n" 
     
    14281430 int    daemon       = 0; 
    14291431#endif 
     1432 int_least32_t watchdog_time = 0; // -1: default, 0: disabled, > 0: user set time. 
    14301433 int    realtime     = 0; 
    14311434 int    sysclocksync = 0; 
     
    17001703   _CKHAVEARGS(1); 
    17011704   g_config->memlock_level = memlock_str2level(argv[++i]); 
     1705  } else if ( strcmp(k, "--watchdog") == 0 ) { 
     1706   if ( watchdog_time == 0 ) 
     1707    watchdog_time = -1; 
     1708  } else if ( strcmp(k, "--watchdog-time") == 0 ) { 
     1709   _CKHAVEARGS(1); 
     1710    watchdog_time = atoi(argv[++i]); 
    17021711  } else if ( strcmp(k, "--chroot") == 0 ) { 
    17031712   _CKHAVEARGS(1); 
     
    25812590  close(ROAR_STDERR); 
    25822591 
    2583   if ( fork() ) 
     2592  if ( roar_fork(NULL) ) 
    25842593   ROAR_U_EXIT(0); 
    25852594 
     
    25912600 } 
    25922601#endif 
     2602 
     2603 if ( watchdog_time ) { 
     2604  if ( watchdog_time == -1 ) 
     2605   watchdog_time = 5000; 
     2606  roar_watchdog_start(ROAR_WATCHDOG_CONF_DEFAULTS, watchdog_time, NULL); 
     2607 } 
    25932608 
    25942609#if defined(ROAR_HAVE_SETUID) && defined(ROAR_HAVE_IO_POSIX) 
Note: See TracChangeset for help on using the changeset viewer.