Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!samsung!uunet!mq!alan From: alan@mq.COM (Alan H. Mintz) Newsgroups: comp.databases Subject: Re: rlock() in SCO foxbase+. Keywords: foxbase, rlock Message-ID: <79@mq.COM> Date: 24 Sep 90 21:22:18 GMT References: <553@safn2.UUCP> Organization: Micro-Quick Systems, Inc. Lines: 45 In article <553@safn2.UUCP>, rey@safn2.UUCP (rey) writes: > Set up is SCO Unix 3.2.2 on Compaq 386. SCO Foxbase+. > > Could some one please explain rlock() in foxbase+. I am converting > Dbase single user programs. > > Who owns the lock? (Same question as who can write to an rlocked record.) > a) The foxbase procedure that called rlock() sucessfully. > b) The work area that called rlock() sucessfully. > c) The process (pid). > d) The user (uid). > e) The tty? The Foxbase+ session (process) "owns" the lock(s). What this means is that YOU may do REPLACEs on the record that YOU locked. The record remains locked until you UNLOCK or USE the area that you performed the lock in, or perform another rlock() in that area. > I think the answer is a). When I rlock() then call another > procedure I cannot append. But that doesn't seem correct design. APPENDs require flock() (which cannot be performed on a file that is rloc()d by another user. Note that you can flock() a file in which YOU have rlocked a record - the flock() simply supercedes the rlock(). > My Dbase IV guide talks about rlock() being cumlative up to 50 locks. > On the same record? Can only 50 different records be locked? It would be impossible to have more than one lock on the same record. The number of record locks possible for a given Foxbase+ session is equal to the number of database areas that can be open at once, namely 10 :( > How are the locks implemented? Are they in the .dbf file header or > in the record being locked or in shared memory (Which I > don't think I am using). It appears that they are implemented in shared memory. There is no difference in the hex dumps of the database while the file is closed, open, rlock()d, or flock()d. There is also no diff in the inode tables (from pstat) (i.e. Fox does not use UNIX file locks). -- < Alan H. Mintz | Voice +1 714 980 1034 > < Micro-Quick Systems, Inc. | FAX +1 714 944 3995 > < 10384 Hillside Road | uucp: ...!uunet!mq!alan > < Alta Loma, CA 91701 USA | Internet: alan@MQ.COM >