[LTP] clock_settime/4-1: CLOCK_MONOTONIC for timer validation

linuxtestproject.agent@gmail.com linuxtestproject.agent@gmail.com
Tue Jun 16 12:09:44 CEST 2026


Hi Andrea,

On Tue, 16 Jun 2026 10:57:22 +0200, Andrea Cervesato wrote:
> clock_settime/4-1: CLOCK_MONOTONIC for timer validation

> During test execution, any service which is operating on clock might
> interfere with the final result. For this reason, we use CLOCK_MONOTONIC
> (when available) in order to the compute the right delta between

Typo: "in order to the compute" should be "in order to compute".

> +		if (use_mono)
> +			clock_gettime(CLOCK_MONOTONIC, &mono_before);

> +		if (use_mono)
> +			clock_gettime(CLOCK_MONOTONIC, &mono_after);

Both clock_gettime(CLOCK_MONOTONIC) calls are missing return-value
checks. Every other POSIX call in this test checks for errors and
returns PTS_UNRESOLVED on failure.

If clock_gettime() were to fail, mono_before / mono_after would
remain uninitialized and the delta computation would use garbage
values silently.

Verdict - Needs revision

Pre-existing: timer_create() allocates tid but timer_delete(tid)
is never called on any exit path.

---
Note:

The agent can sometimes produce false positives although often its
findings are genuine. If you find issues with the review, please
comment this email or ignore the suggestions.

Regards,
LTP AI Reviewer


More information about the ltp mailing list