ladybird/Kernel/KernelInfoPage.h
Andreas Kling 77cf607cda Kernel+LibC: Publish a "kernel info page" and use it for gettimeofday()
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.
2019-12-15 21:29:26 +01:00

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;
};