|  |  | @ -54,26 +54,25 @@ int set_core_affinity(int core) { | 
			
		
	
		
		
			
				
					
					|  |  |  | namespace util { |  |  |  | namespace util { | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | std::string read_file(const std::string& fn) { |  |  |  | std::string read_file(const std::string& fn) { | 
			
		
	
		
		
			
				
					
					|  |  |  |   std::ifstream ifs(fn, std::ios::binary | std::ios::ate); |  |  |  |   std::ifstream f(fn, std::ios::binary | std::ios::in); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |   if (ifs) { |  |  |  |   if (f) { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |     int pos = ifs.tellg(); |  |  |  |     f.seekg(0, std::ios::end); | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     int pos = f.tellg(); | 
			
		
	
		
		
			
				
					
					|  |  |  |     if (pos > 0) { |  |  |  |     if (pos > 0) { | 
			
		
	
		
		
			
				
					
					|  |  |  |       std::string result; |  |  |  |       std::string result; | 
			
		
	
		
		
			
				
					
					|  |  |  |       result.resize(pos); |  |  |  |       result.resize(pos); | 
			
		
	
		
		
			
				
					
					|  |  |  |       ifs.seekg(0, std::ios::beg); |  |  |  |       f.seekg(0, std::ios::beg); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |       ifs.read(result.data(), pos); |  |  |  |       if (f.read(result.data(), pos)) { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |       if (ifs) { |  |  |  |  | 
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |         return result; |  |  |  |         return result; | 
			
		
	
		
		
			
				
					
					|  |  |  |       } |  |  |  |       } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     } else { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       // fallback for files created on read, e.g. procfs
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       std::stringstream buffer; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       buffer << f.rdbuf(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       return buffer.str(); | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  |   } |  |  |  |   } | 
			
		
	
		
		
			
				
					
					|  |  |  |   ifs.close(); |  |  |  |   return std::string(); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |   // fallback for files created on read, e.g. procfs
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |   std::ifstream f(fn); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |   std::stringstream buffer; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |   buffer << f.rdbuf(); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |   return buffer.str(); |  |  |  |  | 
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | } |  |  |  | } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | int read_files_in_dir(const std::string &path, std::map<std::string, std::string> *contents) { |  |  |  | int read_files_in_dir(const std::string &path, std::map<std::string, std::string> *contents) { | 
			
		
	
	
		
		
			
				
					|  |  | 
 |