Network Services | Add ntpd sys var query and sync status calls (!28)

Chris Johns (@chris) gitlab at rtems.org
Fri May 16 05:58:38 UTC 2025



Chris Johns created a merge request: https://gitlab.rtems.org/rtems/pkg/rtems-net-services/-/merge_requests/28

Project:Branches: chris/rtems-net-services:16-ntp-client-peer-status to rtems/pkg/rtems-net-services:main
Author:   Chris Johns
Assignee: Chris Johns



Add `ntpd` system variable query and sync status calls.

- Provide calls to get the NTP status without using `ntpq`. The data returned is the same.
- Add a command `ntpsv` to print the status without using `ntpq`.

The patch leaves the `ntpd` lock held when `ntpd` is running unlocking the lock when system calls are made. The function to get the system variables and status obtains the lock before access the global `ntpd` data. The `ntp_io.c` code has paired unlock/lock calls around the IO calls `ntpd` makes. The thread support in `libntp` is not touch because it must work already and if not that is an upstream issue.

The interface add:

* `void rtems_ntpd_get_sys_vars(ntp_sys_var_data* sv);`
* `int rtems_ntpd_is_synchronized(ntp_sys_var_data* sv);`
* `int rtems_ntpd_leap_warning(ntp_sys_var_data* sv);`
* `int rtems_ntpd_leap_alarm(ntp_sys_var_data* sv);`

Use the `rtems_ntpd_get_sys_vars` call to capture the system variables and status. The synchronized and leap calls test part of the status value for specific states.

Closes #16

-- 
View it on GitLab: https://gitlab.rtems.org/rtems/pkg/rtems-net-services/-/merge_requests/28
You're receiving this email because of your account on gitlab.rtems.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/bugs/attachments/20250516/04cf52c7/attachment.htm>


More information about the bugs mailing list