Date: Mon, 17 Aug 1998 18:24:09 -0600 From: Brad Huntting <huntting@glarp.com> To: freebsd-bugs@FreeBSD.ORG Cc: tetsuya@secom-sis.co.jp, huntting@glarp.com Subject: flock() EOPNOTSUPP for special files Message-ID: <199808180024.SAA00393@hunkular.glarp.com>
next in thread | raw e-mail | index | archive | help
Dear FreeBSD folk: I was having a problem using flock() on a tty device. In the process of investigating the problem I found that advisory locking is not supported on special files at all. This is contrary to nearly every other implementation of flock() I can find (flock(open(/dev/tty)) works find on linux, hpux10, bsdos3, sunos5, openbsd). The patch below will allow flock() to work on any special device. Note that this does not change the behavior of fcntl() since it check f_type before calling VOP_ADVLOCK. Other open trouble tickets which are probably caused by this bug (or feature) include "kern/4243" and "ports/3205". thanx much, brad *** kern/kern_descrip.c.orig Sat Dec 21 12:04:24 1996 --- kern/kern_descrip.c Mon Aug 17 17:16:10 1998 *************** *** 927,934 **** if ((unsigned)uap->fd >= fdp->fd_nfiles || (fp = fdp->fd_ofiles[uap->fd]) == NULL) return (EBADF); - if (fp->f_type != DTYPE_VNODE) - return (EOPNOTSUPP); vp = (struct vnode *)fp->f_data; lf.l_whence = SEEK_SET; lf.l_start = 0; --- 927,932 ---- *** miscfs/specfs/spec_vnops.c.orig Sun Oct 6 15:19:33 1996 --- miscfs/specfs/spec_vnops.c Mon Aug 17 18:08:52 1998 *************** *** 62,67 **** --- 62,72 ---- #include <miscfs/specfs/specdev.h> + #include <ufs/ufs/quota.h> + #include <ufs/ufs/inode.h> + #include <ufs/ufs/ufsmount.h> + #include <ufs/ufs/ufs_extern.h> + static int spec_ebadf __P((void)); static int spec_getattr __P((struct vop_getattr_args *)); *************** *** 712,718 **** } */ *ap; { ! return (EOPNOTSUPP); } /* --- 717,723 ---- } */ *ap; { ! return ufs_advlock(ap); } /* To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199808180024.SAA00393>