AW: AW: [PATCH 4/4] kern_ntptime: sys_ntp_adjtime() does not return error when modes is 0 or MOD_TAI
Sebastian Huber
sebastian.huber at embedded-brains.de
Tue Feb 8 07:15:17 UTC 2022
On 08/02/2022 08:13, Gabriel.Moyano at dlr.de wrote:
>>>> 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().
>>
>> In libbsd, copyout() is just a memcpy() which returns 0.
>>
>>> Under some situations, ntp_adjtime() is called with modes = 0 just for retrieving some values (for example
>> herehttps://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.
>> I don't think the changes make sense. The td->td_retval[0] is the return value of the system call if it is successful. The "error" indicates
>> if the system call was successful (== 0), otherwise it returns -1 with errno set to "error".
>>
> So, do you also propose to remove the line "error = retval;" ? I think it is better keeping the return value meaning of sys_ntp_adjtime(), i.e. just returning 0 (successful) or -1 (in case of error)
The return values should match with the documentation in the man page.
I will send a patch to import kern_ntptime.c to RTEMS shortly.
--
embedded brains GmbH
Herr Sebastian HUBER
Dornierstr. 4
82178 Puchheim
Germany
email: sebastian.huber at embedded-brains.de
phone: +49-89-18 94 741 - 16
fax: +49-89-18 94 741 - 08
Registergericht: Amtsgericht München
Registernummer: HRB 157899
Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler
Unsere Datenschutzerklärung finden Sie hier:
https://embedded-brains.de/datenschutzerklaerung/
More information about the devel
mailing list