On 04/02/2022 09:12, gabriel.moy...@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".

--
embedded brains GmbH
Herr Sebastian HUBER
Dornierstr. 4
82178 Puchheim
Germany
email: sebastian.hu...@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/
_______________________________________________
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Reply via email to