From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f7344,a91218dc783abc21 X-Google-Attributes: gidf7344,public X-Google-Thread: 1164f8,a91218dc783abc21 X-Google-Attributes: gid1164f8,public X-Google-ArrivalTime: 1993-09-17 03:50:22 PST Xref: gmd.de comp.sys.dec:10193 comp.os.vms:30837 Path: gmd.de!newsserver.jvnc.net!howland.reston.ans.net!wupost!cs.utexas.edu!swrinde!elroy.jpl.nasa.gov!nntp-server.caltech.edu!SOL1.GPS.CALTECH.EDU!CARL From: carl@SOL1.GPS.CALTECH.EDU (Carl J Lydick) Newsgroups: comp.sys.dec,comp.os.vms Subject: Re: lockf equivalent on VMS Date: 17 Sep 1993 10:31:14 GMT Organization: HST Wide Field/Planetary Camera Distribution: world Message-ID: <27c3liINNbi9@gap.caltech.edu> References: <27akeo$5ga$1@cs.widener.edu> Reply-To: carl@SOL1.GPS.CALTECH.EDU NNTP-Posting-Host: sol1.gps.caltech.edu In article <27akeo$5ga$1@cs.widener.edu>, YOUNG@tattoo.cs.widener.edu (Rob Young) writes: = =I tried asking about this earlier with no results. Basically we are testing =for exclusive access to a file. On the Un*x side it is something like: = = lock = (fd, F_TEST, 0) = =fd may or may not be opened and we have to verify that we are the only =ones looking at it. The file on the VMS side is opened shr=put among =other flags. Thought that trying a shr=nil on it would work but alas =if the file is already opened this returns success. So... I am trying =to come up with a scheme that bypasses going back and adding DEQ, ENQ =stuff everywhere. One idea is to do a DCL call to "show dev/files/nosys" =and if that file appears there, then someone has it open. This is not =elegant but would get the job done. Have you tried also specifying fac = FAB$M_PUT | FAB$M_GET (sorry, I don't know how to do this in the VAXC RTL open() routine). I just tried running the following programs: #include rms main() { struct FAB my_fab; my_fab = cc$rms_fab; my_fab.fab$l_fna = "SYS$LOGIN:LOGIN.COM"; my_fab.fab$b_fns = strlen(my_fab.fab$l_fna); my_fab.fab$b_fac = FAB$M_GET; my_fab.fab$b_shr = FAB$M_SHRPUT | FAB$M_SHRGET | FAB$M_SHRDEL | FAB$M_SHRUPD; printf("%08X\n", SYS$OPEN(&my_fab)); LIB$SPAWN(); } and #include rms main() { struct FAB my_fab; my_fab = cc$rms_fab; my_fab.fab$l_fna = "SYS$LOGIN:LOGIN.COM"; my_fab.fab$b_fns = strlen(my_fab.fab$l_fna); my_fab.fab$b_fac = FAB$M_GET | FAB$M_PUT; my_fab.fab$b_shr = FAB$M_NIL; printf("%08X\n", SYS$OPEN(&my_fab)); LIB$SPAWN(); } I first ran the first program, then the second. The former gave a status of %X00010001 on the open (success); the latter gave a status of %X0001828a: %RMS-E-FLK, file currently locked by another user If this doesn't work, then perhaps you'd repost, this time including code fragments so we have some idea as to what you're asking. -------------------------------------------------------------------------------- Carl J Lydick | INTERnet: CARL@SOL1.GPS.CALTECH.EDU | NSI/HEPnet: SOL1::CARL Disclaimer: Hey, I understand VAXen and VMS. That's what I get paid for. My understanding of astronomy is purely at the amateur level (or below). So unless what I'm saying is directly related to VAX/VMS, don't hold me or my organization responsible for it. If it IS related to VAX/VMS, you can try to hold me responsible for it, but my organization had nothing to do with it.