dragonpilot - 基於 openpilot 的開源駕駛輔助系統
				
			 
			
		 
		
		
		
		
		
		
			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.
		
		
		
	
	
		
		
			
	
	
		
			
				
					
						
							|  |  |  | #include "selfdrive/common/watchdog.h"
 | 
					
						
							|  |  |  | #include "selfdrive/common/timing.h"
 | 
					
						
							|  |  |  | #include "selfdrive/common/util.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | const std::string watchdog_fn_prefix = "/dev/shm/wd_";  // + <pid>
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | bool watchdog_kick() {
 | 
					
						
							|  |  |  |   static std::string fn = watchdog_fn_prefix + std::to_string(getpid());
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   uint64_t ts = nanos_since_boot();
 | 
					
						
							|  |  |  |   return util::write_file(fn.c_str(), &ts, sizeof(ts), O_WRONLY | O_CREAT) > 0;
 | 
					
						
							|  |  |  | }
 |