Skip to contentSkip to conversation

openposix: update invalid clock id to accomodate new auxiliary clock ids

PATCH Superseded Avinesh Kumar 4 participants 16 messages Oct 3, 2025 – Oct 13, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 openposix: update invalid clock id to accomodate new auxiliary clock ids

There can be 8 more clock ids reserved on systems with CONFIG_POSIX_AUX_CLOCK=y [1]
consequently clock 17 no longer remains an invalid id.

[1] https://lkml.org/lkml/2025/5/19/341

---
 .../conformance/interfaces/clock_getres/6-2.c                 | 4 ++--
 .../conformance/interfaces/clock_gettime/8-2.c                | 4 ++--
 .../conformance/interfaces/clock_settime/17-2.c               | 4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)
testcases/open_posix_testsuite/conformance/interfaces/clock_getres/6-2.c +2 -2
index c44809012..62de33c4f 100644
@@ -17,7 +17,7 @@
  *   unassigned value = -1073743192 (ex. of what gcc will set to)
  *   unassigned value = 1073743192 (ex. of what gcc will set to)
  *   -1
- *   17 (currently not = to any clock)
+ *   25 (not associated to any clock, considering posix auxiliary clocks also)
  *
  */
 #include <stdio.h>
@@ -33,7 +33,7 @@ int main(void)
 	struct timespec res;
 	int invalid_tests[NUMINVALIDTESTS] = {
 		INT32_MIN, INT32_MAX, 2147483647, -2147483647, -1073743192,
-		1073743192, -1, 17
+		1073743192, -1, 25
 	};
 	int i;
 	int failure = 0;
testcases/open_posix_testsuite/conformance/interfaces/clock_gettime/8-2.c +2 -2
index ed4cd4078..66bed9332 100644
@@ -15,7 +15,7 @@
  *   unassigned value = -1073743192 (ex. of what gcc will set to)
  *   unassigned value = 1073743192 (ex. of what gcc will set to)
  *   -1
- *   17 (currently not = to any clock)
+ *   25 (not associated to any clock, considering posix auxiliary clocks also)
  */
 #include <stdio.h>
 #include <time.h>
@@ -27,7 +27,7 @@
 
 static int invalid_tests[NUMINVALIDTESTS] = {
 	INT32_MIN, INT32_MAX, 2147483647, -2147483647, -1073743192,
-	1073743192, -1, 17
+	1073743192, -1, 25
 };
 
 int main(void)
testcases/open_posix_testsuite/conformance/interfaces/clock_settime/17-2.c +2 -2
index 990e41470..3580ade5b 100644
@@ -16,7 +16,7 @@
  *   unassigned value = -1073743192 (ex. of what gcc will set to)
  *   unassigned value = 1073743192 (ex. of what gcc will set to)
  *   -1
- *   17 (currently not = to any clock)
+ *   25 (not associated to any clock, considering posix auxiliary clocks also)
  *
  * The date chosen is Nov 12, 2002 ~11:13am (date when test was first
  * written).
@@ -34,7 +34,7 @@
 
 static int invalid_tests[NUMINVALIDTESTS] = {
 	INT32_MIN, INT32_MAX, 2147483647, -2147483647, -1073743192,
-	1073743192, -1, 17
+	1073743192, -1, 25
 };
 
 int main(void)
Signature · 5 lines
2.51.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
Reviewed-by on v1 1/1
#1 lore raw

Hi Avinesh,

Quoted 3 lines

There can be 8 more clock ids reserved on systems with CONFIG_POSIX_AUX_CLOCK=y [1]
consequently clock 17 no longer remains an invalid id.

Thanks for fixing this! Because we don't have infrastructure to check kconfig in open POSIX tests I agree to just bump the value.

Kind regards,
Petr

Quoted 1 line

[1] https://lkml.org/lkml/2025/5/19/341

nit: FYI I've noticed several times people suggesting to use for links lore.kernel.org, see kernel commit 05a5f51ca5666 ("Documentation: Replace lkml.org links with lore"):

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=05a5f51ca566

Replace the lkml.org links with lore to better use a single source that's more likely to stay available long-term.

Therefore link would be:

[1] https://lore.kernel.org/lkml/[email protected]/

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#2 lore raw

Hi,

Quoted 20 lines · CEST Petr Vorel

Hi Avinesh,

Quoted 3 lines

There can be 8 more clock ids reserved on systems with CONFIG_POSIX_AUX_CLOCK=y [1]
consequently clock 17 no longer remains an invalid id.

Thanks for fixing this! Because we don't have infrastructure to check kconfig in open POSIX tests I agree to just bump the value.

Kind regards,
Petr

Quoted 1 line

[1] https://lkml.org/lkml/2025/5/19/341

nit: FYI I've noticed several times people suggesting to use for links lore.kernel.org, see kernel commit 05a5f51ca5666 ("Documentation: Replace lkml.org links with lore"):

Quoted 9 lines

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=05a5f51ca566

Replace the lkml.org links with lore to better use a single source that's more likely to stay available long-term.

Therefore link would be:

[1] https://lore.kernel.org/lkml/[email protected]/

Thanks Petr, I will keep this in mind from now on.
And I hope this can be fixed during the merge if patch is good as is.

Regards,
Avinesh

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#3 lore raw

Hi Avinesh,
...

Quoted 11 lines
Quoted 10 lines
Quoted 1 line

[1] https://lkml.org/lkml/2025/5/19/341

nit: FYI I've noticed several times people suggesting to use for links lore.kernel.org, see kernel commit 05a5f51ca5666 ("Documentation: Replace lkml.org links with lore"):

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=05a5f51ca566

Replace the lkml.org links with lore to better use a single source that's more likely to stay available long-term.

Quoted 7 lines
Quoted 3 lines

Therefore link would be:

[1] https://lore.kernel.org/lkml/[email protected]/

Thanks Petr, I will keep this in mind from now on.
And I hope this can be fixed during the merge if patch is good as is.

Sure, of course. The code is what matters :).

Kind regards,
Petr

Quoted 2 lines

Regards,
Avinesh

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#4 lore raw
In reply to Avinesh Kumar

Hi!

Quoted 18 lines

There can be 8 more clock ids reserved on systems with CONFIG_POSIX_AUX_CLOCK=y [1]
consequently clock 17 no longer remains an invalid id.

[1] https://lkml.org/lkml/2025/5/19/341

---
 .../conformance/interfaces/clock_getres/6-2.c                 | 4 ++--
 .../conformance/interfaces/clock_gettime/8-2.c                | 4 ++--
 .../conformance/interfaces/clock_settime/17-2.c               | 4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)
testcases/open_posix_testsuite/conformance/interfaces/clock_getres/6-2.c +0 -0
index c44809012..62de33c4f 100644

testcases/open_posix_testsuite/conformance/interfaces/clock_getres/6-2.c line 20

Quoted 5 lines
testcases/open_posix_testsuite/conformance/interfaces/clock_getres/6-2.c +1 -1
@@ -17,7 +17,7 @@
  *   unassigned value = -1073743192 (ex. of what gcc will set to)
  *   unassigned value = 1073743192 (ex. of what gcc will set to)
  *   -1
- *   17 (currently not = to any clock)
+ *   25 (not associated to any clock, considering posix auxiliary clocks also)

Technically you can have any number of clocks defined by a system that implements POSIX. So the comment here should be:

"hopefully big enough not to be a valid clock value"

And we may possibly bump it to a larger value as well, e.g. 50

Signature · 5 lines
Cyril Hrubis
[email protected]

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#5 lore raw

Hi!

Quoted 6 lines

Technically you can have any number of clocks defined by a system that implements POSIX. So the comment here should be:

"hopefully big enough not to be a valid clock value"

And we may possibly bump it to a larger value as well, e.g. 50

Or we may be a bit smarter, for clock_gettime() or clock_getres() we can loop starting at 0 until we get EINVAL or cross sufficiently large value.

Signature · 5 lines
Cyril Hrubis
[email protected]

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#7 lore raw
In reply to Cyril Hrubis

Hi Cyril, Avinesh,

Quoted 28 lines

Hi!

Quoted 18 lines

There can be 8 more clock ids reserved on systems with CONFIG_POSIX_AUX_CLOCK=y [1]
consequently clock 17 no longer remains an invalid id.

[1] https://lkml.org/lkml/2025/5/19/341

---
 .../conformance/interfaces/clock_getres/6-2.c                 | 4 ++--
 .../conformance/interfaces/clock_gettime/8-2.c                | 4 ++--
 .../conformance/interfaces/clock_settime/17-2.c               | 4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)
testcases/open_posix_testsuite/conformance/interfaces/clock_getres/6-2.c +0 -0
index c44809012..62de33c4f 100644

testcases/open_posix_testsuite/conformance/interfaces/clock_getres/6-2.c line 20

Quoted 5 lines
testcases/open_posix_testsuite/conformance/interfaces/clock_getres/6-2.c +1 -1
@@ -17,7 +17,7 @@
  *   unassigned value = -1073743192 (ex. of what gcc will set to)
  *   unassigned value = 1073743192 (ex. of what gcc will set to)
  *   -1
- *   17 (currently not = to any clock)
+ *   25 (not associated to any clock, considering posix auxiliary clocks also)

Technically you can have any number of clocks defined by a system that implements POSIX. So the comment here should be:

Quoted 3 lines

"hopefully big enough not to be a valid clock value"

And we may possibly bump it to a larger value as well, e.g. 50

Thanks for info. Out of curiosity: I suppose the different approach from the exact value for LTP Linux tests fixed in 5c0e414511 (which use lib/tst_clocks.c) is because POSIX tests can be tested for other Unix like tests? Is the POSIX testsuite intended for BSD or any unix like kernels/OS? If yes, I wonder if anybody does (and if it even compiles).

Kind regards,
Petr

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#8 lore raw

Hi!

Quoted 5 lines

Thanks for info. Out of curiosity: I suppose the different approach from the exact value for LTP Linux tests fixed in 5c0e414511 (which use lib/tst_clocks.c) is because POSIX tests can be tested for other Unix like tests? Is the POSIX testsuite intended for BSD or any unix like kernels/OS? If yes, I wonder if anybody does (and if it even compiles).

If I remmeber correctly we got some feedback from Haiku OS devs and BSD uses LTP as well, even the Linux part to test their Linux compatibility layer.

Signature · 5 lines
Cyril Hrubis
[email protected]

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#9 lore raw

PATCH v2 1/1 openposix: update invalid clock id to accomodate new auxiliary clock ids

In reply to Cyril Hrubis

Starting kernel v6.17, there are 8 more auxiliary clock ids reserved on systems with CONFIG_POSIX_AUX_CLOCK=y [1] and moreover posix systems can define and support any number of clocks beyond the mandatory ones.

[1] https://lore.kernel.org/lkml/[email protected]/

---
 .../conformance/interfaces/clock_getres/6-2.c                | 5 ++---
 .../conformance/interfaces/clock_gettime/8-2.c               | 4 ++--
 .../conformance/interfaces/clock_settime/17-2.c              | 4 ++--
 3 files changed, 6 insertions(+), 7 deletions(-)
testcases/open_posix_testsuite/conformance/interfaces/clock_getres/6-2.c +2 -3
index c44809012..af45e27c9 100644
@@ -17,8 +17,7 @@
  *   unassigned value = -1073743192 (ex. of what gcc will set to)
  *   unassigned value = 1073743192 (ex. of what gcc will set to)
  *   -1
- *   17 (currently not = to any clock)
- *
+ *   50 (hopefully big enough value not to be a valid clock id)
  */
 #include <stdio.h>
 #include <time.h>
@@ -33,7 +32,7 @@ int main(void)
 	struct timespec res;
 	int invalid_tests[NUMINVALIDTESTS] = {
 		INT32_MIN, INT32_MAX, 2147483647, -2147483647, -1073743192,
-		1073743192, -1, 17
+		1073743192, -1, 50
 	};
 	int i;
 	int failure = 0;
testcases/open_posix_testsuite/conformance/interfaces/clock_gettime/8-2.c +2 -2
index ed4cd4078..92263ce87 100644
@@ -15,7 +15,7 @@
  *   unassigned value = -1073743192 (ex. of what gcc will set to)
  *   unassigned value = 1073743192 (ex. of what gcc will set to)
  *   -1
- *   17 (currently not = to any clock)
+  *   50 (hopefully big enough value not to be a valid clock id)
  */
 #include <stdio.h>
 #include <time.h>
@@ -27,7 +27,7 @@
 
 static int invalid_tests[NUMINVALIDTESTS] = {
 	INT32_MIN, INT32_MAX, 2147483647, -2147483647, -1073743192,
-	1073743192, -1, 17
+	1073743192, -1, 50
 };
 
 int main(void)
testcases/open_posix_testsuite/conformance/interfaces/clock_settime/17-2.c +2 -2
index 990e41470..7504b7692 100644
@@ -16,7 +16,7 @@
  *   unassigned value = -1073743192 (ex. of what gcc will set to)
  *   unassigned value = 1073743192 (ex. of what gcc will set to)
  *   -1
- *   17 (currently not = to any clock)
+ *   50 (hopefully big enough value not to be a valid clock id)
  *
  * The date chosen is Nov 12, 2002 ~11:13am (date when test was first
  * written).
@@ -34,7 +34,7 @@
 
 static int invalid_tests[NUMINVALIDTESTS] = {
 	INT32_MIN, INT32_MAX, 2147483647, -2147483647, -1073743192,
-	1073743192, -1, 17
+	1073743192, -1, 50
 };
 
 int main(void)
Signature · 5 lines
2.51.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#10 lore raw
Quoted 41 lines · CEST Avinesh Kumar

Starting kernel v6.17, there are 8 more auxiliary clock ids reserved on systems with CONFIG_POSIX_AUX_CLOCK=y [1] and moreover posix systems can define and support any number of clocks beyond the mandatory ones.

[1] https://lore.kernel.org/lkml/[email protected]/

---
 .../conformance/interfaces/clock_getres/6-2.c                | 5 ++---
 .../conformance/interfaces/clock_gettime/8-2.c               | 4 ++--
 .../conformance/interfaces/clock_settime/17-2.c              | 4 ++--
 3 files changed, 6 insertions(+), 7 deletions(-)
testcases/open_posix_testsuite/conformance/interfaces/clock_getres/6-2.c +2 -3
index c44809012..af45e27c9 100644
@@ -17,8 +17,7 @@
  *   unassigned value = -1073743192 (ex. of what gcc will set to)
  *   unassigned value = 1073743192 (ex. of what gcc will set to)
  *   -1
- *   17 (currently not = to any clock)
- *
+ *   50 (hopefully big enough value not to be a valid clock id)
  */
 #include <stdio.h>
 #include <time.h>
@@ -33,7 +32,7 @@ int main(void)
 	struct timespec res;
 	int invalid_tests[NUMINVALIDTESTS] = {
 		INT32_MIN, INT32_MAX, 2147483647, -2147483647, -1073743192,
-		1073743192, -1, 17
+		1073743192, -1, 50
 	};
 	int i;
 	int failure = 0;
testcases/open_posix_testsuite/conformance/interfaces/clock_gettime/8-2.c +0 -0
index ed4cd4078..92263ce87 100644

testcases/open_posix_testsuite/conformance/interfaces/clock_gettime/8-2.c line 18

Quoted 5 lines
testcases/open_posix_testsuite/conformance/interfaces/clock_gettime/8-2.c +1 -1
@@ -15,7 +15,7 @@
  *   unassigned value = -1073743192 (ex. of what gcc will set to)
  *   unassigned value = 1073743192 (ex. of what gcc will set to)
  *   -1
- *   17 (currently not = to any clock)
+  *   50 (hopefully big enough value not to be a valid clock id)

I see I added extra space in this one, please fix while merging if patch is fine.

Thanks,
Avinesh

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#6 lore raw
In reply to Cyril Hrubis

Hi Cyril,

Quoted 5 lines · CEST you

Hi!

Quoted 3 lines

Technically you can have any number of clocks defined by a system that implements POSIX. So the comment here should be:

Quoted 8 lines
Quoted 3 lines

"hopefully big enough not to be a valid clock value"

And we may possibly bump it to a larger value as well, e.g. 50

Or we may be a bit smarter, for clock_gettime() or clock_getres() we can loop starting at 0 until we get EINVAL or cross sufficiently large value.

I thought of implementing something like this. But we get EINVAL for smaller values also for which clocks are not defined.

./clock_getres_6-2.run-test
clock_getres(-2147483648, &res);
clock_getres(2147483647, &res);
clock_getres(2147483647, &res);
clock_getres(-2147483647, &res);
clock_getres(-1073743192, &res);
clock_getres(1073743192, &res);
clock_getres(-1, &res);
clock_getres(10, &res);
clock_getres(11, &res);
clock_getres() != -1
clock_getres(12, &res);
clock_getres(13, &res);
clock_getres(14, &res);
clock_getres(15, &res);
clock_getres(16, &res);
clock_getres() != -1
clock_getres(17, &res);
clock_getres() != -1
clock_getres(18, &res);
clock_getres() != -1
clock_getres(19, &res);
clock_getres() != -1
clock_getres(20, &res);
clock_getres() != -1
clock_getres(21, &res);
clock_getres() != -1
clock_getres(22, &res);
clock_getres() != -1
clock_getres(23, &res);
clock_getres() != -1
clock_getres(24, &res);
clock_getres(25, &res);
clock_getres(26, &res);
At least one test FAILED -- see above

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Reviewed-by
#11 lore raw
In reply to Avinesh Kumar
Quoted 40 lines · CEST Avinesh Kumar
Quoted 39 lines

Starting kernel v6.17, there are 8 more auxiliary clock ids reserved on systems with CONFIG_POSIX_AUX_CLOCK=y [1] and moreover posix systems can define and support any number of clocks beyond the mandatory ones.

[1] https://lore.kernel.org/lkml/[email protected]/

---
 .../conformance/interfaces/clock_getres/6-2.c                | 5 ++---
 .../conformance/interfaces/clock_gettime/8-2.c               | 4 ++--
 .../conformance/interfaces/clock_settime/17-2.c              | 4 ++--
 3 files changed, 6 insertions(+), 7 deletions(-)
testcases/open_posix_testsuite/conformance/interfaces/clock_getres/6-2.c +2 -3
index c44809012..af45e27c9 100644
@@ -17,8 +17,7 @@
  *   unassigned value = -1073743192 (ex. of what gcc will set to)
  *   unassigned value = 1073743192 (ex. of what gcc will set to)
  *   -1
- *   17 (currently not = to any clock)
- *
+ *   50 (hopefully big enough value not to be a valid clock id)
  */
 #include <stdio.h>
 #include <time.h>
@@ -33,7 +32,7 @@ int main(void)
 	struct timespec res;
 	int invalid_tests[NUMINVALIDTESTS] = {
 		INT32_MIN, INT32_MAX, 2147483647, -2147483647, -1073743192,
-		1073743192, -1, 17
+		1073743192, -1, 50
 	};
 	int i;
 	int failure = 0;
testcases/open_posix_testsuite/conformance/interfaces/clock_gettime/8-2.c +0 -1
index ed4cd4078..92263ce87 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/clock_gettime/8-2.c
Quoted 8 lines

testcases/open_posix_testsuite/conformance/interfaces/clock_gettime/8-2.c line 18

Quoted 7 lines

+++ b/testcases/open_posix_testsuite/conformance/interfaces/clock_gettime/8-2.c

testcases/open_posix_testsuite/conformance/interfaces/clock_gettime/8-2.c +1 -1
@@ -15,7 +15,7 @@
  *   unassigned value = -1073743192 (ex. of what gcc will set to)
  *   unassigned value = 1073743192 (ex. of what gcc will set to)
  *   -1
- *   17 (currently not = to any clock)
+  *   50 (hopefully big enough value not to be a valid clock id)

I see I added extra space in this one, please fix while merging if patch is fine.

Sure, np.

Kind regards,
Petr

Quoted 2 lines

Thanks,
Avinesh

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Acked-by Andrea Cervesato
#12 lore raw

Hi!

Quoted 49 lines · Petr Vorel
Quoted 40 lines · CEST Avinesh Kumar
Quoted 39 lines

Starting kernel v6.17, there are 8 more auxiliary clock ids reserved on systems with CONFIG_POSIX_AUX_CLOCK=y [1] and moreover posix systems can define and support any number of clocks beyond the mandatory ones.

[1] https://lore.kernel.org/lkml/[email protected]/

---
 .../conformance/interfaces/clock_getres/6-2.c                | 5 ++---
 .../conformance/interfaces/clock_gettime/8-2.c               | 4 ++--
 .../conformance/interfaces/clock_settime/17-2.c              | 4 ++--
 3 files changed, 6 insertions(+), 7 deletions(-)
testcases/open_posix_testsuite/conformance/interfaces/clock_getres/6-2.c +2 -3
index c44809012..af45e27c9 100644
@@ -17,8 +17,7 @@
  *   unassigned value = -1073743192 (ex. of what gcc will set to)
  *   unassigned value = 1073743192 (ex. of what gcc will set to)
  *   -1
- *   17 (currently not = to any clock)
- *
+ *   50 (hopefully big enough value not to be a valid clock id)
  */
 #include <stdio.h>
 #include <time.h>
@@ -33,7 +32,7 @@ int main(void)
 	struct timespec res;
 	int invalid_tests[NUMINVALIDTESTS] = {
 		INT32_MIN, INT32_MAX, 2147483647, -2147483647, -1073743192,
-		1073743192, -1, 17
+		1073743192, -1, 50
 	};
 	int i;
 	int failure = 0;
testcases/open_posix_testsuite/conformance/interfaces/clock_gettime/8-2.c +0 -1
index ed4cd4078..92263ce87 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/clock_gettime/8-2.c
Quoted 8 lines

testcases/open_posix_testsuite/conformance/interfaces/clock_gettime/8-2.c line 18

Quoted 7 lines

+++ b/testcases/open_posix_testsuite/conformance/interfaces/clock_gettime/8-2.c

testcases/open_posix_testsuite/conformance/interfaces/clock_gettime/8-2.c +1 -1
@@ -15,7 +15,7 @@
  *   unassigned value = -1073743192 (ex. of what gcc will set to)
  *   unassigned value = 1073743192 (ex. of what gcc will set to)
  *   -1
- *   17 (currently not = to any clock)
+  *   50 (hopefully big enough value not to be a valid clock id)

I see I added extra space in this one, please fix while merging if patch is fine.

Quoted 9 lines

Sure, np.

Kind regards,
Petr

Quoted 2 lines

Thanks,
Avinesh

Maybe we should merge this patch, WDYT?

Signature · 7 lines
Andrea Cervesato
SUSE QE Automation Engineer Linux
[email protected]


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#13 lore raw

Hi

...

Quoted 3 lines

Maybe we should merge this patch, WDYT?

FYI I'm waiting for Cyril's ack (he did the review of v1, all the changes are based on his comment). I suppose he will do it today.

Kind regards,
Petr

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp