tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

linux clock compat



Hi,

the linux clock compatibility code in
sys/compat/linux/common/linux_time.c
seems to be outdated:

- we do have CLOCK_PROCESS_CPUTIME_ID under that name,
  so there is no need to map it
- we do have CLOCK_THREAD_CPUTIME_ID, so recognize that
- CLOCK_VIRTUAL is not CLOCK_PROCESS_CPUTIME_ID

diff below.

What are the bits that should be tested for this? That is to say,
what would be a good example of a linux program that needs
to run on NetBSD, using NetBSD's clocks as if on linux?

	Jan




Index: sys/compat/linux/common/linux_time.c
===================================================================
RCS file: /pub/NetBSD-CVS/src/sys/compat/linux/common/linux_time.c,v
retrieving revision 1.42
diff -u -p -r1.42 linux_time.c
--- sys/compat/linux/common/linux_time.c	19 Sep 2021 23:51:37 -0000	1.42
+++ sys/compat/linux/common/linux_time.c	25 Jun 2026 13:40:59 -0000
@@ -334,19 +334,13 @@ linux_to_native_timer_create_clockid(clo
 		/*
 		 * We can't create a timer with every sort of clock ID
 		 * that the system understands, so filter them out.
-		 *
-		 * Map CLOCK_PROCESS_CPUTIME_ID to CLOCK_VIRTUAL.
-		 * We can't handle CLOCK_THREAD_CPUTIME_ID.
 		 */
 		switch (id) {
 		case CLOCK_REALTIME:
 		case CLOCK_MONOTONIC:
-			break;
-
 		case CLOCK_PROCESS_CPUTIME_ID:
-			id = CLOCK_VIRTUAL;
+		case CLOCK_THREAD_CPUTIME_ID:
 			break;
-
 		default:
 			return ENOTSUP;
 		}



Home | Main Index | Thread Index | Old Index