mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 10:02:43 +00:00 
			
		
		
		
	 77cf607cda
			
		
	
	
		77cf607cda
		
	
	
	
	
		
			
			This patch adds a single "kernel info page" that is mappable read-only by any process and contains the current time of day. This is then used to implement a version of gettimeofday() that doesn't have to make a syscall. To protect against race condition issues, the info page also has a serial number which is incremented whenever the kernel updates the contents of the page. Make sure to verify that the serial number is the same before and after reading the information you want from the page.
		
			
				
	
	
		
			14 lines
		
	
	
	
		
			210 B
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			14 lines
		
	
	
	
		
			210 B
		
	
	
	
		
			C
		
	
	
	
	
	
| #pragma once
 | |
| 
 | |
| #include <AK/Types.h>
 | |
| 
 | |
| #ifdef KERNEL
 | |
| #    include <Kernel/UnixTypes.h>
 | |
| #else
 | |
| #    include <sys/time.h>
 | |
| #endif
 | |
| 
 | |
| struct KernelInfoPage {
 | |
|     volatile u32 serial;
 | |
|     volatile struct timeval now;
 | |
| };
 |