Date: Mon, 7 Feb 2022 16:04:56 +0100 From: Sebastian Huber <sebastian.huber@embedded-brains.de> To: FreeBSD Hackers <freebsd-hackers@freebsd.org> Subject: ntp_init() looks like a nop Message-ID: <ac806cf6-a17f-77ba-5633-0c95eda1f8cf@embedded-brains.de>
next in thread | raw e-mail | index | archive | help
Hello, I review currently the kern_ntptime.c module since I would like to use=20 it in RTEMS. I have a question to ntp_init(): /* * ntp_init() - initialize variables and structures * * This routine must be called after the kernel variables hz and tick * are set or changed and before the next tick interrupt. In this * particular implementation, these values are assumed set elsewhere in * the kernel. The design allows the clock frequency and tick interval * to be changed while the system is running. So, this routine should * probably be integrated with the code that does that. */ static void ntp_init(void) { /* * The following variables are initialized only at startup. Only * those structures not cleared by the compiler need to be * initialized, and these only in the simulator. In the actual * kernel, any nonzero values here will quickly evaporate. */ L_CLR(time_offset); L_CLR(time_freq); #ifdef PPS_SYNC pps_tf[0].tv_sec =3D pps_tf[0].tv_nsec =3D 0; pps_tf[1].tv_sec =3D pps_tf[1].tv_nsec =3D 0; pps_tf[2].tv_sec =3D pps_tf[2].tv_nsec =3D 0; pps_fcount =3D 0; L_CLR(pps_freq); #endif /* PPS_SYNC */=09 } SYSINIT(ntpclocks, SI_SUB_CLOCKS, SI_ORDER_MIDDLE, ntp_init, NULL); The ntp_init() function sets a couple of global variables to zero. These=20 variables should be in the .bss section. Are they not already cleared=20 during the kernel loading? --=20 embedded brains GmbH Herr Sebastian HUBER Dornierstr. 4 82178 Puchheim Germany email: sebastian.huber@embedded-brains.de phone: +49-89-18 94 741 - 16 fax: +49-89-18 94 741 - 08 Registergericht: Amtsgericht M=C3=BCnchen Registernummer: HRB 157899 Vertretungsberechtigte Gesch=C3=A4ftsf=C3=BChrer: Peter Rasmussen, Thomas= D=C3=B6rfler Unsere Datenschutzerkl=C3=A4rung finden Sie hier: https://embedded-brains.de/datenschutzerklaerung/
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?ac806cf6-a17f-77ba-5633-0c95eda1f8cf>