Hello,

Michael Kelly, le dim. 12 avril 2026 17:49:34 +0100, a ecrit:
> 1) Changes to gnumach:
> 
> 1a) Addition of a constant MACH_ADJTIME_SECS_MAX. This value is close
> to the largest number of seconds that can be managed with
> host_adjust_time64(). (2145 is (was?) supported on Linux so I
> specified that rather than a theoretical 2146).

This looks odd. Better just define MACH_ADJTIME_SECS_OMIT ((long_integer_t)-1)

> 1b) Alteration to host_adjust_time64() to disregard the new delta when
> it is outside the permitted range but still return KERN_SUCCESS so
> that the old delta can be retrieved.

Letting bogus parameters go unnoticed is also not a good thing. Really
better return KERN_INVALID_ARGUMENT when the argument is invalid (not
valid value and not MACH_ADJTIME_SECS_OMIT).

> 2) Change to glibc __adjtime:
> 
> 2a) The current code casts 'struct timeval' to 'struct time_value'
> claiming that they are identical. They possibly were in 32 bit but are
> not in 64 bit since the microseconds type differs between int and long
> int.

Indeed, thanks for this.


+      /* Handle overflow if microsecond types differ. */
+      rpc_delta.microseconds = (delta->tv_usec % TIME_MICROS_MAX);
+      rpc_delta.seconds += (delta->tv_usec / TIME_MICROS_MAX);

I actually believe we are supposed to return EINVAL
if delta->tv_usec >= TIME_MICROS_MAX

Samuel

Reply via email to