delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2000/10/23/20:14:02

Message-Id: <4.3.1.0.20001023200320.00afcac0@pop5.banet.net>
X-Sender: usbanet DOT farley3 AT pop5 DOT banet DOT net
X-Mailer: QUALCOMM Windows Eudora Version 4.3.1
Date: Mon, 23 Oct 2000 20:14:37 -0400
To: djgpp-workers AT delorie DOT com
From: "Peter J. Farley III" <pjfarley AT banet DOT net>
Subject: Re: New versions of perl require "flock" or working "fcntl(fh,
F_SETLK/W,...)"
In-Reply-To: <Pine.SUN.3.91.1001023172313.15701G-100000@is>
References: <4 DOT 3 DOT 1 DOT 0 DOT 20001023101622 DOT 00af2d10 AT pop5 DOT banet DOT net>
Mime-Version: 1.0
Reply-To: djgpp-workers AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp-workers AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

At 05:31 PM 10/23/00 +0200, you wrote:
<Snipped
 >> But "lock" just calls "_dos_lock"
 >
 >Yup.  Seems like my memory betrayed me, I didn't remember that the 
one
 >called the other.  Sorry for the noise.

No problem.  Been there, done that. ;)

 >> which issues INT 21/AH=5C, which
 >> requires SHARE in plain DOS, if I'm reading Ralf Brown's list
 >> correctly.
 >
 >That's correct, SHARE is required in plain DOS and on Windows 3.x, 
for
 >this function to work.

Good, then I'm not as complete an illiterate as I thought I might be. 
:)

 >> My reading of Ralf Brown's list may be incorrect here, but I think
 >> INT21/5C will return an error unless SHARE or some network 
providing
 >> the "advisory lock" function is loaded.  Am I wrong about that?
 >
 >You are not wrong.  What I was asking was whether you should care 
about
 >these failures, in this context.  Given that no other application 
would
 >be ever able to access the storage on a single-task DOS machine,
 >where's the problem?

Good point.  In that context, perl should not care one way or the 
other.

 >> (Mis-spellings not mine, pasted verbatim.)  The functions of this
 >> extension that fail are "lock_store" and "lock_retrieve", which 
each
 >> perform an "flock" before storing or retrieving, respectively.
 >
 >It strikes me that Perl could ignore the error in locking when it 
runs
 >on plain DOS.  Windows is another matter; but on Windows VSHARE 
is >always loaded and does the job.
 >
 >So I'd suggest to write flock that uses 21/51, and add some ifdef'ed
 >code to Perl that if flock fails on DOS, to ignore the 
failure.  (If >you don't know how to tell whether you run on Windows, 
check out Int
 >2Fh/AX=1600h.)

OK, let me restate what I need to do so I don't get it wrong:

1.	Implement flock and fcntl(... F_SETLK/W, ...) using _dos_lock
	(INT21/5C) as a base function
2.	Add flock to the libc headers (where? unistd.h?)
3.	Add a DJGPP wrappper function for perl to call as flock; this is
	needed so that the perl flock implementation can ignore errors
	when running under plain DOS (using INT 2Fh/AX=1600h)
	Q:  Do I need to test for Win3.1, or do *all* win versions load
	    vshare as you said?

Thanks for your help.  I may (no, probably *will*) be returning here 
for questions as implementation proceeds.
---------------------------------------------------------
Peter J. Farley III (pjfarley AT dorsai DOT org OR
                      pjfarley AT banet DOT net)

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019