svn commit: r279728 - in head/sys: kern sys

Hans Petter Selasky hselasky at FreeBSD.org
Sat Mar 7 18:23:34 UTC 2015


Author: hselasky
Date: Sat Mar  7 18:23:32 2015
New Revision: 279728
URL: https://svnweb.freebsd.org/changeset/base/279728

Log:
  Add mutex support to the pps_ioctl() API in the kernel.
  Bump kernel version to reflect structure change.
  
  PR:		196897
  MFC after:	1 week

Modified:
  head/sys/kern/kern_tc.c
  head/sys/sys/param.h
  head/sys/sys/timepps.h

Modified: head/sys/kern/kern_tc.c
==============================================================================
--- head/sys/kern/kern_tc.c	Sat Mar  7 18:17:15 2015	(r279727)
+++ head/sys/kern/kern_tc.c	Sat Mar  7 18:23:32 2015	(r279728)
@@ -23,10 +23,8 @@ __FBSDID("$FreeBSD$");
 #include <sys/param.h>
 #include <sys/kernel.h>
 #include <sys/limits.h>
-#ifdef FFCLOCK
 #include <sys/lock.h>
 #include <sys/mutex.h>
-#endif
 #include <sys/sysctl.h>
 #include <sys/syslog.h>
 #include <sys/systm.h>
@@ -1498,7 +1496,10 @@ pps_fetch(struct pps_fetch_args *fapi, s
 		cseq = pps->ppsinfo.clear_sequence;
 		while (aseq == pps->ppsinfo.assert_sequence &&
 		    cseq == pps->ppsinfo.clear_sequence) {
-			err = tsleep(pps, PCATCH, "ppsfch", timo);
+			if (pps->mtx != NULL)
+				err = msleep(pps, pps->mtx, PCATCH, "ppsfch", timo);
+			else
+				err = tsleep(pps, PCATCH, "ppsfch", timo);
 			if (err == EWOULDBLOCK && fapi->timeout.tv_sec == -1) {
 				continue;
 			} else if (err != 0) {

Modified: head/sys/sys/param.h
==============================================================================
--- head/sys/sys/param.h	Sat Mar  7 18:17:15 2015	(r279727)
+++ head/sys/sys/param.h	Sat Mar  7 18:23:32 2015	(r279728)
@@ -58,7 +58,7 @@
  *		in the range 5 to 9.
  */
 #undef __FreeBSD_version
-#define __FreeBSD_version 1100062	/* Master, propagated to newvers */
+#define __FreeBSD_version 1100063	/* Master, propagated to newvers */
 
 /*
  * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,

Modified: head/sys/sys/timepps.h
==============================================================================
--- head/sys/sys/timepps.h	Sat Mar  7 18:17:15 2015	(r279727)
+++ head/sys/sys/timepps.h	Sat Mar  7 18:23:32 2015	(r279728)
@@ -133,6 +133,8 @@ struct pps_kcbind_args {
 
 #ifdef _KERNEL
 
+struct mtx;
+
 struct pps_state {
 	/* Capture information. */
 	struct timehands *capth;
@@ -140,6 +142,9 @@ struct pps_state {
 	unsigned	capgen;
 	unsigned	capcount;
 
+	/* pointer to mutex protecting this state, if any */
+	struct mtx	*mtx;
+
 	/* State information. */
 	pps_params_t	ppsparam;
 	pps_info_t	ppsinfo;


More information about the svn-src-all mailing list