delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/10/28/03:39:26

Date: Sat, 28 Oct 2000 09:40:12 +0200
From: "Eli Zaretskii" <eliz AT is DOT elta DOT co DOT il>
Sender: halo1 AT zahav DOT net DOT il
To: djgpp AT delorie DOT com
Message-Id: <7263-Sat28Oct2000094012+0200-eliz@is.elta.co.il>
X-Mailer: Emacs 20.6 (via feedmail 8.3.emacs20_6 I) and Blat ver 1.8.5h
In-reply-to: <8tcusl$e46$1@nnrp1.deja.com> (falin@my-deja.com)
Subject: Re: fcntl(), flock() and lock()
References: <8tcusl$e46$1 AT nnrp1 DOT deja DOT com>
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

> From: falin AT my-deja DOT com
> Newsgroups: comp.os.msdos.djgpp
> Date: Fri, 27 Oct 2000 22:16:59 GMT
> 
> Now, I cannot use directly none of the three
> versions with DJGPP. DOS version uses interrupt
> calls, Windows version uses Windows services and
> Linux version uses fcntl() to control file
> locking.

I don't see why can't you use the DOS version.  DJGPP supports
interrupt calls, like other DOS-based compilers do.  You might need to
change the calls a little bit (see sections 18.1, 18.2, 18.4, and 18.5
in the DJGPP FAQ, for some details), but other than that, you should
be okay.

> My question is if anybody knows if it is possible
> to implement locking services of fcntl() to
> compile this without change with Linux GCC and
> DJGPP.

Yes, this, too, is possible.  You need to use the function _dos_lock
to implement the same functionality.  Note that on plain DOS (and
Windows 3.1), the file-locking calls need SHARE.EXE to be loaded, or
else they will fail.

> I want not to fight next month with a database
> fail caused by a bad use of file locking.

If your program is going to run on a DOS machine (not on Windows),
there's no much chance some other program could access the same
database at the same time.  So a simple band-aid would be to provide
no-op stubs for functions that lock and unlock records in the
database, and avoid the complications of actually messing with DOS
interrupts.

- Raw text -


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