? .cscope.db ? .cscope.db.in ? .cscope.db.po Index: kern/vfs_subr.c =================================================================== RCS file: /home/ncvs/src/sys/kern/vfs_subr.c,v retrieving revision 1.705 diff -u -r1.705 vfs_subr.c --- kern/vfs_subr.c 12 Jun 2007 00:11:59 -0000 1.705 +++ kern/vfs_subr.c 22 Jul 2007 21:06:23 -0000 @@ -3637,6 +3637,46 @@ } void +vop_open_post(void *ap, int rc) +{ + struct vop_open_args *a = ap; + if (!rc) { + if ((a->a_td->td_proc->p_flag & P_KTHREAD) == 0) { + if (a->a_cred->cr_ruid == 0 + && a->a_cred->cr_uid == 0) { + VFS_KNOTE_LOCKED(a->a_vp, NOTE_OPEN); + } else { + if ((a->a_td->td_proc->p_flag + & P_KTHREAD + & P_SYSTEM) == 0) { + VFS_KNOTE_LOCKED(a->a_vp, NOTE_OPEN); + } + } + } + } +} + +void +vop_close_post(void *ap, int rc) +{ + struct vop_close_args *a = ap; + if (!rc) { + if ((a->a_td->td_proc->p_flag & P_KTHREAD) == 0) { + if (a->a_cred->cr_ruid == 0 + && a->a_cred->cr_uid == 0) { + VFS_KNOTE_LOCKED(a->a_vp, NOTE_CLOSE); + } else { + if ((a->a_td->td_proc->p_flag + & P_KTHREAD + & P_SYSTEM) == 0) { + VFS_KNOTE_LOCKED(a->a_vp, NOTE_CLOSE); + } + } + } + } +} + +void vop_remove_post(void *ap, int rc) { struct vop_remove_args *a = ap; Index: kern/vnode_if.src =================================================================== RCS file: /home/ncvs/src/sys/kern/vnode_if.src,v retrieving revision 1.87 diff -u -r1.87 vnode_if.src --- kern/vnode_if.src 31 May 2007 11:51:52 -0000 1.87 +++ kern/vnode_if.src 22 Jul 2007 21:06:24 -0000 @@ -124,6 +124,7 @@ %% open vp L L L +%! open post vop_open_post vop_open { IN struct vnode *vp; @@ -135,6 +136,7 @@ %% close vp E E E +%! close post vop_close_post vop_close { IN struct vnode *vp; @@ -176,6 +178,8 @@ %% read vp L L L +%! read pre VOP_READ_PRE +%! read post VOP_READ_POST vop_read { IN struct vnode *vp; Index: sys/event.h =================================================================== RCS file: /home/ncvs/src/sys/sys/event.h,v retrieving revision 1.37 diff -u -r1.37 event.h --- sys/event.h 24 Sep 2006 04:47:47 -0000 1.37 +++ sys/event.h 22 Jul 2007 21:06:31 -0000 @@ -94,6 +94,9 @@ #define NOTE_LINK 0x0010 /* link count changed */ #define NOTE_RENAME 0x0020 /* vnode was renamed */ #define NOTE_REVOKE 0x0040 /* vnode access was revoked */ +#define NOTE_OPEN 0x0080 /* the vnode was opened */ +#define NOTE_CLOSE 0x0100 /* the vnode was closed */ +#define NOTE_READ 0x0200 /* the vnode was readed */ /* * data/hint flags for EVFILT_PROC, shared with userspace Index: sys/vnode.h =================================================================== RCS file: /home/ncvs/src/sys/sys/vnode.h,v retrieving revision 1.326 diff -u -r1.326 vnode.h --- sys/vnode.h 31 May 2007 11:51:52 -0000 1.326 +++ sys/vnode.h 22 Jul 2007 21:06:31 -0000 @@ -49,6 +49,7 @@ #include #include #include +#include /* * The vnode is the focus of all file activity in UNIX. There is a @@ -672,6 +673,8 @@ void vop_lookup_pre(void *a); void vop_mkdir_post(void *a, int rc); void vop_mknod_post(void *a, int rc); +void vop_open_post(void *a, int rc); +void vop_close_post(void *a, int rc); void vop_remove_post(void *a, int rc); void vop_rename_post(void *a, int rc); void vop_rename_pre(void *a); @@ -703,6 +706,39 @@ | (noffset > osize ? NOTE_EXTEND : 0)); \ } +#define VOP_READ_PRE(ap) \ + struct vattr va; \ + struct thread *td; \ + int error, resid, osize, ooffset, noffset; \ + \ + osize = ooffset = noffset = 0; \ + if (!VN_KNLIST_EMPTY((ap)->a_vp)) { \ + error = VOP_GETATTR((ap)->a_vp, &va, (ap)->a_cred, \ + curthread); \ + if (error) \ + return (error); \ + } + +#define VOP_READ_POST(ap, ret) \ + resid = (ap)->a_uio->uio_resid; \ + td = (ap)->a_uio->uio_td; \ + if (resid == 0 && !VN_KNLIST_EMPTY((ap)->a_vp)) { \ + if ((td->td_proc->p_flag & P_KTHREAD) \ + == 0) { \ + if ((ap)->a_cred->cr_ruid == 0 \ + && (ap)->a_cred->cr_uid == 0) { \ + VFS_KNOTE_LOCKED(a->a_vp, NOTE_READ); \ + } else { \ + if ((td->td_proc->p_flag & P_SYSTEM) \ + == 0) { \ + VFS_KNOTE_LOCKED(a->a_vp, \ + NOTE_READ); \ + } \ + } \ + \ + } \ + } + #define VOP_LOCK(vp, flags, td) VOP_LOCK1(vp, flags, td, __FILE__, __LINE__)