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.
		
		
		
		
			
				
					13 lines
				
				365 B
			
		
		
			
		
	
	
					13 lines
				
				365 B
			| 
											4 years ago
										 | #include "common/watchdog.h"
 | ||
|  | #include "common/timing.h"
 | ||
|  | #include "common/util.h"
 | ||
| 
											5 years ago
										 | 
 | ||
|  | const std::string watchdog_fn_prefix = "/dev/shm/wd_";  // + <pid>
 | ||
|  | 
 | ||
| 
											4 years ago
										 | bool watchdog_kick() {
 | ||
| 
											4 years ago
										 |   static std::string fn = watchdog_fn_prefix + std::to_string(getpid());
 | ||
| 
											5 years ago
										 | 
 | ||
| 
											4 years ago
										 |   uint64_t ts = nanos_since_boot();
 | ||
|  |   return util::write_file(fn.c_str(), &ts, sizeof(ts), O_WRONLY | O_CREAT) > 0;
 | ||
| 
											5 years ago
										 | }
 |