Using this combination of arguments currently crashes. This set of patches supports the port of openntpd to GNU/Hurd. The openntpd code specifies an adjustment to the system time once it has determined an initial deviation from true time. At some point later it checks the remaining time adjustment in the kernel to see how it differs from what was expected.
__adjtime (const struct timeval *delta, struct timeval *olddelta) openntpd calls adjtime with delta as NULL and a non-NULL olddelta. GNU/Hurd does not support this combination currently. 1) Changes to gnumach: 1a) Addition of new constants MACH_ADJTIME_USECS_OMIT and MACH_ADJTIME_NSECS_OMIT. These values can be specified as the sub-second component in calls to host_adjust_time and host_adjust_time64. 1b) Alteration to host_adjust_time64() to disregard the new adjustment when the sub-second component is precisely MACH_ADJTIME_NSECS_OMIT. It will still return KERN_SUCCESS together with the pending old_adjustment. 2) Change to glibc __adjtime: 2a) The current code casts 'struct timeval' to 'struct time_value' claiming that they are identical. This is not true in 64 bit since the microseconds type differs between int and long int. When the microseconds value is negative the representation of the two type values differ and an incorrect value results to callers. 2b) Use MACH_ADJTIME_USECS_OMIT so that callers can pass NULL for the new delta. This allows the existing time adjustment to be determined. Changes from v2: *) Return EINVAL from adjtime() when the microseconds are not within the range of 1 second. *) Use the constants specified by Samuel to determine the 'special' case for host_adjust_time64. I've tested the above with openntpd and my own test code. If there are minor adjustments necessary to accept this patch set then please feel free to make local edits yourself. I can't face a v4 unless there is something major to alter! Regards, Mike.
