Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!cmcl2!rutgers!ucla-cs!zen!ucbvax!sdcsvax!ricko From: ricko@sdcsvax.UCSD.EDU (Rick Ord) Newsgroups: comp.sys.pyramid Subject: flock on Pyramid OSx 4.0 and MH Message-ID: <3757@sdcsvax.UCSD.EDU> Date: Thu, 27-Aug-87 15:10:34 EDT Article-I.D.: sdcsvax.3757 Posted: Thu Aug 27 15:10:34 1987 Date-Received: Sat, 29-Aug-87 11:53:11 EDT Organization: University of California, San Diego Lines: 65 Keywords: MH, flock, Pyramid OSx 4.0 Subject: MH and flock in Pyramid OSx 4.0 Disclaimer: I usually don't read comp.mail.mh so please disregard if this has been posted before. I am cross-posting to comp.sys.pyramid even though Pyramid does not include MH on their distribution tape. Description: I recently put up the new Pyramid OSx 4.0 and had complaints from some users about MH not working. In particular, simple commands like "inc" returned errors indicating it could not open and lock their spooled mail file. It turns out that Pyramid has incorporated the UCB flock and ATT lockf locking mechanisms into the same vnode (inode) -level record locking routine. What this all means is that the functionality of ATT lockf is now imposed on UCB flock. Under UCB's flock, you could throw an exclusive advisory lock on a file openned for RDONLY. Under ATT's lockf, you can only throw an exclusive advisory lock on a file openned for WRONLY or RDWR. As always, a shared lock can be thrown on a file openned for RDONLY. So, programs that had used flock to exclusively lock a file RDONLY will not work - MH is just such a program. Fix: Below is a diff of /usr/src/new/mh/zotnet/mts/lock.c Since this is library routine compiled into the utilities, you will have to recompile and install from the top level after installing this fix. Good Luck, Rick ----------------------------------------------------------------------------- Rick Ord UCSD Academic Computing Center C-010 Rm. 1101-2A (APM) La Jolla, Ca. 92093 UUCP: ...sdcsvax!ricko (619) 534-4067 ARPA: ricko@sdcsvax.ucsd.edu ----------------------------------------------------------------------------- RCS file: RCS/lock.c,v retrieving revision 1.1 diff -c -r1.1 lock.c *** /tmp/,RCSt1021950 Thu Aug 27 10:51:01 1987 --- lock.c Thu Aug 27 10:50:37 1987 *************** *** 188,194 for (i = 0; i < 5; i++) { if ((fd = open (file, access | O_NDELAY)) == NOTOK) return NOTOK; ! if (flock (fd, LOCK_EX | LOCK_NB) != NOTOK) return fd; j = errno; (void) close (fd); --- 188,194 ----- for (i = 0; i < 5; i++) { if ((fd = open (file, access | O_NDELAY)) == NOTOK) return NOTOK; ! if (flock (fd,((access ? LOCK_EX : LOCK_SH) | LOCK_NB)) != NOTOK) return fd; j = errno; (void) close (fd);