Add mutex support to the pps_ioctl() API in the kernel.

Bump kernel version to reflect structure change.

PR:		196897
MFC after:	1 week
This commit is contained in:
hselasky 2015-03-07 18:23:32 +00:00
parent 5ffbd45332
commit f8d33b7a49
3 changed files with 10 additions and 4 deletions

View File

@ -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, struct pps_state *pps)
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) {

View File

@ -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,

View File

@ -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;