From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <98017990115264.tru64-unix-managers.marc@archive.invalid> From: Peyton Bland Date: Mon, 22 Jan 2001 16:11:43 +0000 To: tru64-unix-managers Subject: SUMMARY: exclOpen X-MARC-Message: https://marc.info/?l=tru64-unix-managers&m=98017990115264 Hi, The original question: On our 4.0F system, an executable called exclOpen (in /usr/sbin) is used in the rcmgr script to implement a locking mechanism. I can't find a man page on exclOpen, and it is not on our 4.0D system. Since it's also not on a Solaris system that I have access to, I assume that it is a fairly recent Compaq-specific utility. It's pretty easy to figure-out how it works, but I was curious for more info as it may be a useful utility. (By the way, the man page for open(2)/creat(2) mentions an O_EXCL switch, so I guess that's a key part of exclOpen.) Any comments? Thanks to the following for their quick replies. Each one was educational -- that's hard to beat! And it's always great to hear from folks from the Compaq side of the fence. It's been said many times before, but this is a GREAT group! Regards to all, Peyton Bland University of Michigan, Dept. of Radiology ------------------ >From Colin.Walters@compaq.com... If it was in V4.0x base OS, that script is gone from the V5.0 and later base OS, unless: o You are running a cluster and the script is cluster-specific. o It was put there by an optional subset or an application. I cannot turn up any reference to exclOpen running a string search on the entire docset and manpages. However, the string O_EXCL is found in the following places: open(2) Messages (Guide to Realtime Programming) Shared Memory (Guide to Realtime Programming) Semaphores (Guide to Realtime Programming) mq_open(3) sem_open(3) shm_open(3) proc(4) mc(7) ksh93(1CDE) dbopen(3) Apologies for the lack of info. It is not unusual for temporary utilities to be undocumented when we know they are to be short-lived. Consequently, it is risky to make use of any scripts and utilities that are not documented. They might vanish in the next release. I know that rcmgr and rc.config have been greatly modified in the last few releases (to support clusters) and this might have been a temporary part of those rc* changes. ---------------- >From Dr. Thomas P. Blinn, tpb@zk3.dec.com... You got the idea. It should never have been put into a "standard" place, it should have been somewhere like /usr/lbin. Its only purpose is to get a real lock on a file, since "rcmgr" is a shell script and thus has no way to get exclusive access (through normal shell mechanisms) to the files it needs to update. And if it doesn't have exclusive access, it can screw up the files. (Creating a file and checking for the presence of that file doesn't work; you can't avoid race conditions in shell logic, you need something more primitive.) Think "major hack" and you'll be on the right track. I could probably get the source for you; I'm sure it's encumbered only by us, not by any external party, but it's probably not generally useful as written. ---------------- >From John P Speno ... Looks like it takes an argument as a filename to create and tries to open that file with O_WRONLY|O_CREAT|O_EXCL flags set. If that file exists, or it can't open, it gives you an error message. That's about it. P.S. I used a system call tracer to see the arguments to open().