Replace the POLLEXTEND extensions with the kqueue() mechanism.
This commit is contained in:
parent
cb679c385e
commit
7dffee4116
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=59289
@ -47,7 +47,10 @@
|
||||
#include <vm/vm_pager.h>
|
||||
#include <vm/vm_map.h>
|
||||
#include <vm/vnode_pager.h>
|
||||
#include <sys/poll.h>
|
||||
#include <sys/event.h>
|
||||
|
||||
#define VN_KNOTE(vp, b) \
|
||||
KNOTE((struct klist *)&vp->v_pollinfo.vpi_selinfo.si_note, (caddr_t)(b))
|
||||
|
||||
/*
|
||||
* Vnode op for reading.
|
||||
@ -513,6 +516,8 @@ WRITE(ap)
|
||||
*/
|
||||
if (resid > uio->uio_resid && ap->a_cred && ap->a_cred->cr_uid != 0)
|
||||
ip->i_mode &= ~(ISUID | ISGID);
|
||||
if (resid > uio->uio_resid)
|
||||
VN_KNOTE(vp, NOTE_WRITE | (extended ? NOTE_EXTEND : 0));
|
||||
if (error) {
|
||||
if (ioflag & IO_UNIT) {
|
||||
(void)UFS_TRUNCATE(vp, osize,
|
||||
@ -522,8 +527,6 @@ WRITE(ap)
|
||||
}
|
||||
} else if (resid > uio->uio_resid && (ioflag & IO_SYNC))
|
||||
error = UFS_UPDATE(vp, 1);
|
||||
if (!error)
|
||||
VN_POLLEVENT(vp, POLLWRITE | (extended ? POLLEXTEND : 0));
|
||||
|
||||
if (object)
|
||||
vm_object_vndeallocate(object);
|
||||
|
@ -56,7 +56,7 @@
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/dirent.h>
|
||||
#include <sys/lockf.h>
|
||||
#include <sys/poll.h>
|
||||
#include <sys/event.h>
|
||||
#include <sys/conf.h>
|
||||
|
||||
#include <vm/vm_zone.h>
|
||||
@ -120,6 +120,8 @@ union _qcvt {
|
||||
tmp.val[_QUAD_LOWWORD] = (l); \
|
||||
(q) = tmp.qcvt; \
|
||||
}
|
||||
#define VN_KNOTE(vp, b) \
|
||||
KNOTE(&vp->v_pollinfo.vpi_selinfo.si_note, (b))
|
||||
|
||||
/*
|
||||
* A virgin directory (no blushing please).
|
||||
@ -186,7 +188,7 @@ ufs_create(ap)
|
||||
ap->a_dvp, ap->a_vpp, ap->a_cnp);
|
||||
if (error)
|
||||
return (error);
|
||||
VN_POLLEVENT(ap->a_dvp, POLLWRITE);
|
||||
VN_KNOTE(ap->a_dvp, NOTE_WRITE);
|
||||
return (0);
|
||||
}
|
||||
|
||||
@ -212,7 +214,7 @@ ufs_mknod(ap)
|
||||
ap->a_dvp, vpp, ap->a_cnp);
|
||||
if (error)
|
||||
return (error);
|
||||
VN_POLLEVENT(ap->a_dvp, POLLWRITE);
|
||||
VN_KNOTE(ap->a_dvp, NOTE_WRITE);
|
||||
ip = VTOI(*vpp);
|
||||
ip->i_flag |= IN_ACCESS | IN_CHANGE | IN_UPDATE;
|
||||
if (vap->va_rdev != VNOVAL) {
|
||||
@ -528,7 +530,7 @@ ufs_setattr(ap)
|
||||
return (EROFS);
|
||||
error = ufs_chmod(vp, (int)vap->va_mode, cred, p);
|
||||
}
|
||||
VN_POLLEVENT(vp, POLLATTRIB);
|
||||
VN_KNOTE(vp, NOTE_ATTRIB);
|
||||
return (error);
|
||||
}
|
||||
|
||||
@ -706,8 +708,8 @@ ufs_remove(ap)
|
||||
goto out;
|
||||
}
|
||||
error = ufs_dirremove(dvp, ip, ap->a_cnp->cn_flags, 0);
|
||||
VN_POLLEVENT(vp, POLLNLINK);
|
||||
VN_POLLEVENT(dvp, POLLWRITE);
|
||||
VN_KNOTE(vp, NOTE_DELETE);
|
||||
VN_KNOTE(dvp, NOTE_WRITE);
|
||||
out:
|
||||
return (error);
|
||||
}
|
||||
@ -773,8 +775,8 @@ ufs_link(ap)
|
||||
if (tdvp != vp)
|
||||
VOP_UNLOCK(vp, 0, p);
|
||||
out2:
|
||||
VN_POLLEVENT(vp, POLLNLINK);
|
||||
VN_POLLEVENT(tdvp, POLLWRITE);
|
||||
VN_KNOTE(vp, NOTE_LINK);
|
||||
VN_KNOTE(tdvp, NOTE_WRITE);
|
||||
return (error);
|
||||
}
|
||||
|
||||
@ -995,7 +997,7 @@ ufs_rename(ap)
|
||||
oldparent = dp->i_number;
|
||||
doingdirectory = 1;
|
||||
}
|
||||
VN_POLLEVENT(fdvp, POLLWRITE);
|
||||
VN_KNOTE(fdvp, NOTE_WRITE); /* XXX right place? */
|
||||
vrele(fdvp);
|
||||
|
||||
/*
|
||||
@ -1101,7 +1103,7 @@ ufs_rename(ap)
|
||||
}
|
||||
goto bad;
|
||||
}
|
||||
VN_POLLEVENT(tdvp, POLLWRITE);
|
||||
VN_KNOTE(tdvp, NOTE_WRITE);
|
||||
vput(tdvp);
|
||||
} else {
|
||||
if (xp->i_dev != dp->i_dev || xp->i_dev != ip->i_dev)
|
||||
@ -1158,7 +1160,6 @@ ufs_rename(ap)
|
||||
if (DOINGSOFTDEP(tvp))
|
||||
softdep_change_linkcnt(xp);
|
||||
}
|
||||
VN_POLLEVENT(tdvp, POLLWRITE);
|
||||
if (doingdirectory && !DOINGSOFTDEP(tvp)) {
|
||||
/*
|
||||
* Truncate inode. The only stuff left in the directory
|
||||
@ -1182,8 +1183,9 @@ ufs_rename(ap)
|
||||
tcnp->cn_cred, tcnp->cn_proc)) != 0)
|
||||
goto bad;
|
||||
}
|
||||
VN_KNOTE(tdvp, NOTE_WRITE);
|
||||
vput(tdvp);
|
||||
VN_POLLEVENT(tvp, POLLNLINK); /* XXX this right? */
|
||||
VN_KNOTE(tvp, NOTE_DELETE);
|
||||
vput(tvp);
|
||||
xp = NULL;
|
||||
}
|
||||
@ -1238,6 +1240,7 @@ ufs_rename(ap)
|
||||
error = ufs_dirremove(fdvp, xp, fcnp->cn_flags, 0);
|
||||
xp->i_flag &= ~IN_RENAME;
|
||||
}
|
||||
VN_KNOTE(fvp, NOTE_RENAME);
|
||||
if (dp)
|
||||
vput(fdvp);
|
||||
if (xp)
|
||||
@ -1314,10 +1317,10 @@ ufs_mkdir(ap)
|
||||
#ifdef QUOTA
|
||||
struct ucred ucred, *ucp;
|
||||
ucp = cnp->cn_cred;
|
||||
#endif I
|
||||
#endif
|
||||
/*
|
||||
* If we are hacking owners here, (only do this where told to)
|
||||
* and we are not giving it TOO root, (would subvert quotas)
|
||||
* and we are not giving it TO root, (would subvert quotas)
|
||||
* then go ahead and give it to the other user.
|
||||
* The new directory also inherits the SUID bit.
|
||||
* If user's UID and dir UID are the same,
|
||||
@ -1426,7 +1429,6 @@ ufs_mkdir(ap)
|
||||
(void)BUF_WRITE(bp);
|
||||
goto bad;
|
||||
}
|
||||
VN_POLLEVENT(dvp, POLLWRITE); /* XXX right place? */
|
||||
/*
|
||||
* Directory set up, now install its entry in the parent directory.
|
||||
*
|
||||
@ -1447,6 +1449,7 @@ ufs_mkdir(ap)
|
||||
|
||||
bad:
|
||||
if (error == 0) {
|
||||
VN_KNOTE(dvp, NOTE_WRITE);
|
||||
*ap->a_vpp = tvp;
|
||||
} else {
|
||||
dp->i_effnlink--;
|
||||
@ -1537,7 +1540,7 @@ ufs_rmdir(ap)
|
||||
}
|
||||
goto out;
|
||||
}
|
||||
VN_POLLEVENT(dvp, POLLWRITE|POLLNLINK);
|
||||
VN_KNOTE(dvp, NOTE_WRITE | NOTE_LINK);
|
||||
cache_purge(dvp);
|
||||
/*
|
||||
* Truncate inode. The only stuff left in the directory is "." and
|
||||
@ -1557,7 +1560,7 @@ ufs_rmdir(ap)
|
||||
}
|
||||
cache_purge(vp);
|
||||
out:
|
||||
VN_POLLEVENT(vp, POLLNLINK);
|
||||
VN_KNOTE(vp, NOTE_DELETE);
|
||||
return (error);
|
||||
}
|
||||
|
||||
@ -1582,7 +1585,7 @@ ufs_symlink(ap)
|
||||
vpp, ap->a_cnp);
|
||||
if (error)
|
||||
return (error);
|
||||
VN_POLLEVENT(ap->a_dvp, POLLWRITE);
|
||||
VN_KNOTE(ap->a_dvp, NOTE_WRITE);
|
||||
vp = *vpp;
|
||||
len = strlen(ap->a_target);
|
||||
if (len < vp->v_mount->mnt_maxsymlinklen) {
|
||||
@ -2086,11 +2089,11 @@ ufs_makeinode(mode, dvp, vpp, cnp)
|
||||
#ifdef QUOTA
|
||||
struct ucred ucred, *ucp;
|
||||
ucp = cnp->cn_cred;
|
||||
#endif I
|
||||
#endif
|
||||
/*
|
||||
* If we are not the owner of the directory,
|
||||
* and we are hacking owners here, (only do this where told to)
|
||||
* and we are not giving it TOO root, (would subvert quotas)
|
||||
* and we are not giving it TO root, (would subvert quotas)
|
||||
* then go ahead and give it to the other user.
|
||||
* Note that this drops off the execute bits for security.
|
||||
*/
|
||||
@ -2301,5 +2304,3 @@ ufs_vnoperatespec(ap)
|
||||
{
|
||||
return (VOCALL(ufs_specop_p, ap->a_desc->vdesc_offset, ap));
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user