diff options
author | kib <kib@FreeBSD.org> | 2016-08-26 10:04:10 +0000 |
---|---|---|
committer | kib <kib@FreeBSD.org> | 2016-08-26 10:04:10 +0000 |
commit | 5eaf5813abcaf71c35e1006aab0a861cd104f3aa (patch) | |
tree | bca93d9d17af3deb43eea20809b800e90e4e9643 /sys/fs | |
parent | e78ab6e5643ca053c8b55a26b13329fb1d4afd3e (diff) | |
download | FreeBSD-src-5eaf5813abcaf71c35e1006aab0a861cd104f3aa.zip FreeBSD-src-5eaf5813abcaf71c35e1006aab0a861cd104f3aa.tar.gz |
MFC r303382:
Provide the getboottime(9) and getboottimebin(9) KPI.
MFC r303387:
Prevent parallel tc_windup() calls. Keep boottime in timehands,
and adjust it from tc_windup().
MFC notes:
The boottime and boottimebin globals are still exported from
the kernel dyn symbol table in stable/11, but their declarations are
removed from sys/time.h. This preserves KBI but not KPI, while all
in-tree consumers are converted to getboottime().
The variables are updated after tc_setclock_mtx is dropped, which gives
approximately same unlocked bugs as before.
The boottime and boottimebin locals in several sys/kern_tc.c functions
were renamed by adding the '_x' suffix to avoid name conficts.
Diffstat (limited to 'sys/fs')
-rw-r--r-- | sys/fs/devfs/devfs_vnops.c | 4 | ||||
-rw-r--r-- | sys/fs/fdescfs/fdesc_vnops.c | 2 | ||||
-rw-r--r-- | sys/fs/nfs/nfsport.h | 2 | ||||
-rw-r--r-- | sys/fs/procfs/procfs_status.c | 2 |
4 files changed, 8 insertions, 2 deletions
diff --git a/sys/fs/devfs/devfs_vnops.c b/sys/fs/devfs/devfs_vnops.c index 7cc0f9e..afa3da4 100644 --- a/sys/fs/devfs/devfs_vnops.c +++ b/sys/fs/devfs/devfs_vnops.c @@ -707,10 +707,11 @@ devfs_getattr(struct vop_getattr_args *ap) { struct vnode *vp = ap->a_vp; struct vattr *vap = ap->a_vap; - int error; struct devfs_dirent *de; struct devfs_mount *dmp; struct cdev *dev; + struct timeval boottime; + int error; error = devfs_populate_vp(vp); if (error != 0) @@ -740,6 +741,7 @@ devfs_getattr(struct vop_getattr_args *ap) vap->va_blocksize = DEV_BSIZE; vap->va_type = vp->v_type; + getboottime(&boottime); #define fix(aa) \ do { \ if ((aa).tv_sec <= 3600) { \ diff --git a/sys/fs/fdescfs/fdesc_vnops.c b/sys/fs/fdescfs/fdesc_vnops.c index 4f6e1b9..65b8a54 100644 --- a/sys/fs/fdescfs/fdesc_vnops.c +++ b/sys/fs/fdescfs/fdesc_vnops.c @@ -394,7 +394,9 @@ fdesc_getattr(struct vop_getattr_args *ap) { struct vnode *vp = ap->a_vp; struct vattr *vap = ap->a_vap; + struct timeval boottime; + getboottime(&boottime); vap->va_mode = S_IRUSR|S_IXUSR|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH; vap->va_fileid = VTOFDESC(vp)->fd_ix; vap->va_uid = 0; diff --git a/sys/fs/nfs/nfsport.h b/sys/fs/nfs/nfsport.h index 921df2d..6b41e2f 100644 --- a/sys/fs/nfs/nfsport.h +++ b/sys/fs/nfs/nfsport.h @@ -872,7 +872,7 @@ int newnfs_realign(struct mbuf **, int); /* * Set boottime. */ -#define NFSSETBOOTTIME(b) ((b) = boottime) +#define NFSSETBOOTTIME(b) (getboottime(&b)) /* * The size of directory blocks in the buffer cache. diff --git a/sys/fs/procfs/procfs_status.c b/sys/fs/procfs/procfs_status.c index 5a00ee1..defdec3 100644 --- a/sys/fs/procfs/procfs_status.c +++ b/sys/fs/procfs/procfs_status.c @@ -70,6 +70,7 @@ procfs_doprocstatus(PFS_FILL_ARGS) const char *wmesg; char *pc; char *sep; + struct timeval boottime; int pid, ppid, pgid, sid; int i; @@ -129,6 +130,7 @@ procfs_doprocstatus(PFS_FILL_ARGS) calcru(p, &ut, &st); PROC_STATUNLOCK(p); start = p->p_stats->p_start; + getboottime(&boottime); timevaladd(&start, &boottime); sbuf_printf(sb, " %jd,%ld %jd,%ld %jd,%ld", (intmax_t)start.tv_sec, start.tv_usec, |