From owner-freebsd-bugs Mon Aug 17 17:25:02 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id RAA28603 for freebsd-bugs-outgoing; Mon, 17 Aug 1998 17:25:02 -0700 (PDT) (envelope-from owner-freebsd-bugs@FreeBSD.ORG) Received: from hunkular.glarp.com (hunkular.glarp.com [199.117.25.251]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id RAA28586 for ; Mon, 17 Aug 1998 17:24:52 -0700 (PDT) (envelope-from huntting@glarp.com) Received: from hunkular.glarp.com (localhost.glarp.com [127.0.0.1]) by hunkular.glarp.com (8.8.8/8.8.8) with ESMTP id SAA00393; Mon, 17 Aug 1998 18:24:09 -0600 (MDT) (envelope-from huntting@hunkular.glarp.com) Message-Id: <199808180024.SAA00393@hunkular.glarp.com> To: freebsd-bugs@FreeBSD.ORG Cc: tetsuya@secom-sis.co.jp, huntting@glarp.com Subject: flock() EOPNOTSUPP for special files Date: Mon, 17 Aug 1998 18:24:09 -0600 From: Brad Huntting Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org 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 + #include + #include + #include + #include + 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