Date: Thu, 17 Oct 1996 02:59:26 +1000 From: Bruce Evans <bde@zeta.org.au> To: current@FreeBSD.org, james@miller.cs.uwm.edu Subject: Re: Devfs update time Message-ID: <199610161659.CAA25825@godzilla.zeta.org.au>
next in thread | raw e-mail | index | archive | help
>When using the devfs filesystem, the times for the inode don't >get updated. I beleive atime, ctime, and mtime need to be >enabled for things in the devfs. > >The following example illustrates the problem: > % touch `tty` > touch: /dev/ttyp0: Inappropriate file type or format There are several problems: utimes() (which is used by `touch') doesn't work, i/o timestamps don't work, and inode change timestamps (e.g. for link and unlink) don't work. The enclosed patch is supposed to fix utimes(). The utimes(path, NULL) case is broken by an earlier check for (cred->cr_uid != file_node->uid). Write permission is supposed to be sufficient in this case. Hmm, the suser() check seems to be too early here, as it is in ufs where this patch was mostly copied from. I think the VA_UTIMES_NULL check should be before the suser() check. Bruce diff -c2 devfs_vnops.c~ devfs_vnops.c *** devfs_vnops.c~ Sun Oct 13 04:40:25 1996 --- devfs_vnops.c Sun Oct 13 04:41:45 1996 *************** *** 603,606 **** --- 600,604 ---- int error = 0; dn_p file_node; + struct timeval tv; if (error = devfs_vntodn(vp,&file_node)) *************** *** 617,622 **** (vap->va_rdev != VNOVAL) || (vap->va_bytes != VNOVAL) || ! (vap->va_gen != VNOVAL) || ! (vap->va_atime.tv_sec != VNOVAL)) { return EINVAL; --- 615,619 ---- (vap->va_rdev != VNOVAL) || (vap->va_bytes != VNOVAL) || ! (vap->va_gen != VNOVAL)) { return EINVAL; *************** *** 632,648 **** return error; /*XXX (?) */ } - if (vap->va_atime.tv_sec != VNOVAL) - { - file_node->atime = vap->va_atime; - } ! if (vap->va_mtime.tv_sec != VNOVAL) ! { file_node->mtime = vap->va_mtime; ! } ! ! if (vap->va_ctime.tv_sec != VNOVAL) ! { ! file_node->ctime = vap->va_ctime; } --- 629,646 ---- return error; /*XXX (?) */ } ! if (vap->va_atime.tv_sec != VNOVAL || vap->va_mtime.tv_sec != VNOVAL) { ! if (vp->v_mount->mnt_flag & MNT_RDONLY) ! return (EROFS); ! if (cred->cr_uid != file_node->uid && ! (error = suser(cred, &p->p_acflag)) && ! ((vap->va_vaflags & VA_UTIMES_NULL) == 0 || ! (error = VOP_ACCESS(vp, VWRITE, cred, p)))) ! return (error); ! file_node->atime = vap->va_atime; file_node->mtime = vap->va_mtime; ! microtime(&tv); ! TIMEVAL_TO_TIMESPEC(&tv, &file_node->ctime); ! return (0); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199610161659.CAA25825>