Date: Wed, 28 Sep 2016 09:46:29 +0000 (UTC) From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r306403 - in stable/11/sys: kern sys Message-ID: <201609280946.u8S9kTHh081043@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kib Date: Wed Sep 28 09:46:29 2016 New Revision: 306403 URL: https://svnweb.freebsd.org/changeset/base/306403 Log: MFC r306089: Make resettodr_lock accessible outside subr_rtc.c. Protect CLOCK_GETTIME() with the lock. Modified: stable/11/sys/kern/subr_rtc.c stable/11/sys/sys/clock.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/subr_rtc.c ============================================================================== --- stable/11/sys/kern/subr_rtc.c Wed Sep 28 09:43:23 2016 (r306402) +++ stable/11/sys/kern/subr_rtc.c Wed Sep 28 09:46:29 2016 (r306403) @@ -75,7 +75,7 @@ __FBSDID("$FreeBSD$"); static device_t clock_dev = NULL; static long clock_res; static struct timespec clock_adj; -static struct mtx resettodr_lock; +struct mtx resettodr_lock; MTX_SYSINIT(resettodr_init, &resettodr_lock, "tod2rl", MTX_DEF); /* XXX: should be kern. now, it's no longer machdep. */ @@ -132,7 +132,9 @@ inittodr(time_t base) goto wrong_time; } /* XXX: We should poll all registered RTCs in case of failure */ + mtx_lock(&resettodr_lock); error = CLOCK_GETTIME(clock_dev, &ts); + mtx_unlock(&resettodr_lock); if (error != 0 && error != EINVAL) { printf("warning: clock_gettime failed (%d), the system time " "will not be set accurately\n", error); Modified: stable/11/sys/sys/clock.h ============================================================================== --- stable/11/sys/sys/clock.h Wed Sep 28 09:43:23 2016 (r306402) +++ stable/11/sys/sys/clock.h Wed Sep 28 09:46:29 2016 (r306403) @@ -54,6 +54,7 @@ */ extern int tz_minuteswest; extern int tz_dsttime; +extern struct mtx resettodr_lock; int utc_offset(void);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201609280946.u8S9kTHh081043>