summaryrefslogtreecommitdiff
path: root/sys/compat/linux/common/linux_oldselect.c
diff options
context:
space:
mode:
authorfvdl <fvdl@NetBSD.org>1998-03-01 02:20:01 +0000
committerfvdl <fvdl@NetBSD.org>1998-03-01 02:20:01 +0000
commite5bc90f40cf5f81854c72bcc45b85a560fdb066f (patch)
treec56929ae8db5281f5a9bdae505c93059defcd4a6 /sys/compat/linux/common/linux_oldselect.c
parent1ad6fdb33fd15b73040fdd0f5feabbd73782a4d3 (diff)
Merge with Lite2 + local changes
Diffstat (limited to 'sys/compat/linux/common/linux_oldselect.c')
-rw-r--r--sys/compat/linux/common/linux_oldselect.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/sys/compat/linux/common/linux_oldselect.c b/sys/compat/linux/common/linux_oldselect.c
index 4ff60904624..c71b4e0bc40 100644
--- a/sys/compat/linux/common/linux_oldselect.c
+++ b/sys/compat/linux/common/linux_oldselect.c
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_oldselect.c,v 1.38 1998/02/20 18:09:04 mycroft Exp $ */
+/* $NetBSD: linux_oldselect.c,v 1.39 1998/03/01 02:23:03 fvdl Exp $ */
/*
* Copyright (c) 1995 Frank van der Linden
@@ -799,9 +799,6 @@ linux_sys_getdents(p, v, retval)
vp = (struct vnode *)fp->f_data;
- if (vp->v_type != VDIR) /* XXX vnode readdir op should do this */
- return (EINVAL);
-
if ((error = VOP_GETATTR(vp, &va, p->p_ucred, p)))
return error;
@@ -817,10 +814,8 @@ linux_sys_getdents(p, v, retval)
oldcall = 0;
}
buf = malloc(buflen, M_TEMP, M_WAITOK);
- ncookies = buflen / 16;
- cookiebuf = malloc(ncookies * sizeof(*cookiebuf), M_TEMP, M_WAITOK);
- VOP_LOCK(vp);
+ vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
off = fp->f_offset;
again:
aiov.iov_base = buf;
@@ -836,8 +831,8 @@ again:
* First we read into the malloc'ed buffer, then
* we massage it into user space, one record at a time.
*/
- error = VOP_READDIR(vp, &auio, fp->f_cred, &eofflag, cookiebuf,
- ncookies);
+ error = VOP_READDIR(vp, &auio, fp->f_cred, &eofflag, &cookiebuf,
+ &ncookies);
if (error)
goto out;
@@ -908,7 +903,7 @@ again:
eof:
*retval = nbytes - resid;
out:
- VOP_UNLOCK(vp);
+ VOP_UNLOCK(vp, 0);
free(cookiebuf, M_TEMP);
free(buf, M_TEMP);
return error;