diff options
author | Flavio Cruz <flaviocruz@gmail.com> | 2023-01-03 00:41:42 +0100 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2023-01-03 00:43:04 +0100 |
commit | d7348c94453d2662affecbb7605047044898ed19 (patch) | |
tree | bde2413d0cfb14962f8f543ad96765a445920908 /i386 | |
parent | 276f997fd7a51385829fec6d460d0a588b0bad7c (diff) | |
download | gnumach-d7348c94453d2662affecbb7605047044898ed19.tar.gz gnumach-d7348c94453d2662affecbb7605047044898ed19.tar.bz2 gnumach-d7348c94453d2662affecbb7605047044898ed19.zip |
Introduce time_value64_t to keep track of real time in the kernel
time_value64_t uses int64_t to track seconds and nanoseconds and hence
is Y2038 proof. It does not have nano second resolution but it could
be provided in the future.
Removed include/sys/time.h as it remaps time_value_t into timeval which
can create confusion.
The timestamp from keyboard and mouse events is no longer set and
replaced with rpc_time_value for better compatibility.
Diffstat (limited to 'i386')
-rw-r--r-- | i386/i386at/com.c | 1 | ||||
-rw-r--r-- | i386/i386at/kd.h | 8 | ||||
-rw-r--r-- | i386/i386at/kd_event.c | 4 | ||||
-rw-r--r-- | i386/i386at/kd_mouse.c | 8 | ||||
-rw-r--r-- | i386/i386at/kd_queue.c | 2 | ||||
-rw-r--r-- | i386/i386at/lpr.c | 1 | ||||
-rw-r--r-- | i386/i386at/model_dep.c | 5 | ||||
-rw-r--r-- | i386/i386at/rtc.c | 7 |
8 files changed, 20 insertions, 16 deletions
diff --git a/i386/i386at/com.c b/i386/i386at/com.c index c63c30a4..a6d6f701 100644 --- a/i386/i386at/com.c +++ b/i386/i386at/com.c @@ -33,7 +33,6 @@ #include <sys/types.h> #include <kern/printf.h> #include <kern/mach_clock.h> -#include <sys/time.h> #include <device/conf.h> #include <device/device_types.h> #include <device/tty.h> diff --git a/i386/i386at/kd.h b/i386/i386at/kd.h index 6f425ae9..cfa7819e 100644 --- a/i386/i386at/kd.h +++ b/i386/i386at/kd.h @@ -74,7 +74,6 @@ WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include <sys/ioctl.h> #include <mach/boolean.h> #include <sys/types.h> -#include <sys/time.h> #include <device/cons.h> #include <device/io_req.h> #include <device/buf.h> @@ -672,7 +671,12 @@ struct mouse_motion { typedef struct { kev_type type; /* see below */ - struct timeval time; /* timestamp */ + /* + * This is not used anymore but is kept for backwards compatibility. + * Note the use of rpc_time_value to ensure compatibility for a 64 bit kernel and + * 32 bit user land. + */ + struct rpc_time_value unused_time; /* timestamp*/ union { /* value associated with event */ boolean_t up; /* MOUSE_LEFT .. MOUSE_RIGHT */ Scancode sc; /* KEYBD_EVENT */ diff --git a/i386/i386at/kd_event.c b/i386/i386at/kd_event.c index 5b1f7098..25a0ef35 100644 --- a/i386/i386at/kd_event.c +++ b/i386/i386at/kd_event.c @@ -275,7 +275,9 @@ kd_enqsc(Scancode sc) kd_event ev; ev.type = KEYBD_EVENT; - ev.time = time; + /* Not used but we set it to avoid garbage */ + ev.unused_time.seconds = 0; + ev.unused_time.microseconds = 0; ev.value.sc = sc; kbd_enqueue(&ev); } diff --git a/i386/i386at/kd_mouse.c b/i386/i386at/kd_mouse.c index 3af21273..906c1d37 100644 --- a/i386/i386at/kd_mouse.c +++ b/i386/i386at/kd_mouse.c @@ -751,7 +751,9 @@ mouse_moved(struct mouse_motion where) kd_event ev; ev.type = MOUSE_MOTION; - ev.time = time; + /* Not used but we set it to avoid garbage */ + ev.unused_time.seconds = 0; + ev.unused_time.microseconds = 0; ev.value.mmotion = where; mouse_enqueue(&ev); } @@ -767,8 +769,10 @@ mouse_button( kd_event ev; ev.type = which; - ev.time = time; ev.value.up = (direction == MOUSE_UP) ? TRUE : FALSE; + /* Not used but we set it to avoid garbage */ + ev.unused_time.seconds = 0; + ev.unused_time.microseconds = 0; mouse_enqueue(&ev); } diff --git a/i386/i386at/kd_queue.c b/i386/i386at/kd_queue.c index 78035b18..ab399cd8 100644 --- a/i386/i386at/kd_queue.c +++ b/i386/i386at/kd_queue.c @@ -88,7 +88,7 @@ kdq_put(kd_event_queue *q, kd_event *ev) kd_event *qp = q->events + q->firstfree; qp->type = ev->type; - qp->time = ev->time; + qp->unused_time = ev->unused_time; qp->value = ev->value; q->firstfree = q_next(q->firstfree); } diff --git a/i386/i386at/lpr.c b/i386/i386at/lpr.c index 7cef127c..3939af54 100644 --- a/i386/i386at/lpr.c +++ b/i386/i386at/lpr.c @@ -34,7 +34,6 @@ #include <sys/types.h> #include <kern/printf.h> #include <kern/mach_clock.h> -#include <sys/time.h> #include <device/conf.h> #include <device/device_types.h> #include <device/tty.h> diff --git a/i386/i386at/model_dep.c b/i386/i386at/model_dep.c index f677e134..9ccc7551 100644 --- a/i386/i386at/model_dep.c +++ b/i386/i386at/model_dep.c @@ -51,7 +51,6 @@ #include <kern/printf.h> #include <kern/startup.h> #include <kern/smp.h> -#include <sys/time.h> #include <sys/types.h> #include <vm/vm_page.h> #include <i386/fpu.h> @@ -705,12 +704,12 @@ startrtclock(void) void inittodr(void) { - time_value_t new_time; + time_value64_t new_time; uint64_t newsecs; (void) readtodc(&newsecs); new_time.seconds = newsecs; - new_time.microseconds = 0; + new_time.nanoseconds = 0; { spl_t s = splhigh(); diff --git a/i386/i386at/rtc.c b/i386/i386at/rtc.c index b2068416..1930beb0 100644 --- a/i386/i386at/rtc.c +++ b/i386/i386at/rtc.c @@ -47,7 +47,6 @@ WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #include <sys/types.h> -#include <sys/time.h> #include <kern/mach_clock.h> #include <kern/printf.h> #include <i386/machspl.h> @@ -107,8 +106,6 @@ rtcput(struct rtc_st *st) } -extern struct timeval time; - static int month[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; static int @@ -213,13 +210,13 @@ writetodc(void) splx(ospl); diff = 0; - n = (time.tv_sec - diff) % (3600 * 24); /* hrs+mins+secs */ + n = (time.seconds - diff) % (3600 * 24); /* hrs+mins+secs */ rtclk.rtc_sec = dectohexdec(n%60); n /= 60; rtclk.rtc_min = dectohexdec(n%60); rtclk.rtc_hr = dectohexdec(n/60); - n = (time.tv_sec - diff) / (3600 * 24); /* days */ + n = (time.seconds - diff) / (3600 * 24); /* days */ rtclk.rtc_dow = (n + 4) % 7; /* 1/1/70 is Thursday */ /* Epoch shall be 1970 January 1st */ |