You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							19 lines
						
					
					
						
							497 B
						
					
					
				
			
		
		
	
	
							19 lines
						
					
					
						
							497 B
						
					
					
				#include "selfdrive/common/watchdog.h"
 | 
						|
 | 
						|
#include <unistd.h>
 | 
						|
 | 
						|
#include <cstdint>
 | 
						|
#include <string>
 | 
						|
 | 
						|
#include "selfdrive/common/timing.h"
 | 
						|
#include "selfdrive/common/util.h"
 | 
						|
 | 
						|
const std::string watchdog_fn_prefix = "/dev/shm/wd_";  // + <pid>
 | 
						|
 | 
						|
bool watchdog_kick() {
 | 
						|
  std::string fn = watchdog_fn_prefix + std::to_string(getpid());
 | 
						|
  std::string cur_t = std::to_string(nanos_since_boot());
 | 
						|
 | 
						|
  int r = util::write_file(fn.c_str(), cur_t.data(), cur_t.length(), O_WRONLY | O_CREAT);
 | 
						|
  return r == 0;
 | 
						|
}
 | 
						|
 |