AW: [PATCH 4/4] kern_ntptime: sys_ntp_adjtime() does not return error when modes is 0 or MOD_TAI

Gabriel.Moyano at dlr.de Gabriel.Moyano at dlr.de
Fri Feb 4 08:12:32 UTC 2022


> 
> What is the reason for this patch?
> 
This change is something I would like to have a second opinion. So, thanks for the question.

Originally at the end of sys_ntp_adjtime(), if the function copyout() doesn't return an error, the value returned by ntp_is_time_error(), which variable name is retval, is saved in td->td_retval[0]. Chris modified this, being retval saved in the variable error, which is the one returned by sys_ntp_adjtime().

Under some situations, ntp_adjtime() is called with modes = 0 just for retrieving some values (for example here https://github.com/ptpd/ptpd/blob/master/src/dep/sys.c#L2036, please notice that here adjtimex() is ntp_adjtime()). In those cases, returning retval may not be meaningful. Other similar situation happens when mode is MOD_TAI (https://github.com/ptpd/ptpd/blob/master/src/dep/sys.c#L2070). 

This is more or less the reason. If there is better way to solve this, is welcome.


More information about the devel mailing list