Fix the clock_gettime() handler for pthread_getcpuclockid() to
authorclaudio <claudio@openbsd.org>
Thu, 3 Oct 2024 10:18:29 +0000 (10:18 +0000)
committerclaudio <claudio@openbsd.org>
Thu, 3 Oct 2024 10:18:29 +0000 (10:18 +0000)
use the proper way to read tu_runtime.
OK mpi@

sys/kern/kern_time.c

index 5997861..cfca2fa 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: kern_time.c,v 1.169 2024/07/26 19:16:31 guenther Exp $        */
+/*     $OpenBSD: kern_time.c,v 1.170 2024/10/03 10:18:29 claudio Exp $ */
 /*     $NetBSD: kern_time.c,v 1.20 1996/02/18 11:57:06 fvdl Exp $      */
 
 /*
@@ -147,8 +147,10 @@ clock_gettime(struct proc *p, clockid_t clock_id, struct timespec *tp)
                        q = tfind_user(__CLOCK_PTID(clock_id), p->p_p);
                        if (q == NULL)
                                error = ESRCH;
-                       else
-                               *tp = q->p_tu.tu_runtime;
+                       else {
+                               tuagg_get_proc(&tu, q);
+                               *tp = tu.tu_runtime;
+                       }
                        KERNEL_UNLOCK();
                } else
                        error = EINVAL;