delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2003/05/05/04:45:18

From: =?ISO-8859-1?Q?Rafael_Garc=EDa?= <rafael AT geninfor DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: database engine?
Date: Mon, 05 May 2003 10:37:10 +0200
Organization: Telefonica Data Espagna
Lines: 80
Message-ID: <3EB622B6.1030404@geninfor.com>
References: <3EB0676B DOT 5030501 AT hotmail DOT com> <3EB22B01 DOT 2040707 AT geninfor DOT com> <3EB56728 DOT 1040008 AT hotmail DOT com>
NNTP-Posting-Host: 80-24-251-44.uc.nombres.ttd.es
Mime-Version: 1.0
X-Trace: nsnmrro2-gest.nuria.telefonica-data.net 1052123830 22831 80.24.251.44 (5 May 2003 08:37:10 GMT)
X-Complaints-To: usenet AT nsnmrro2-gest DOT nuria DOT telefonica-data DOT net
NNTP-Posting-Date: Mon, 5 May 2003 08:37:10 +0000 (UTC)
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.0.1) Gecko/20020826
X-Accept-Language: en-us, en
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Bill Hart wrote:
> 
> I presently own C Database Toolchest I bought for use with Turbo 
> C years ago.  I like the Mix package but have been unable to move it to 
> DJGPP because there is no canned make file for this compiler.  I don't 
> have the knowlege/experience to manually recompile the library without 
> an explicit set of instructions.

If you insert all the files of the package in your project list and 
compile it, you should have some msg we can begin to work with.

If it has to do with locking via fnctl() you can do something like this 
(added "ifdef" blocks, compare with your source of cb_lock_area from uio.c)


/* ------------------------------------------------------------------------

         cb_lock_area - put a record lock on a file region

         Return OK or ERROR.
*/

int cb_lock_area(int fd, unsigned long location, long size, int tries,
    long delay, long timeout)
{
    struct timeval time, stoptime;
    struct timezone tz;
#ifdef UNIX
    int    locktype;
#endif
    int    usetimeout = 1;

    if (tries * delay < timeout) timeout = tries * delay;
#ifdef UNIX
    {struct flock lock;
    if ((fcntl(fd, F_GETFL) & O_ACCMODE) == O_RDONLY) locktype = F_RDLCK;
    else locktype = F_WRLCK;

    lock.l_whence = SEEK_SET;
    lock.l_start = location;
    lock.l_type = locktype;
    lock.l_len = size;
    if (fcntl(fd, F_SETLK, &lock) == 0) return I_OK; }
#else  // DOS/WIN
    if (lock(fd,location,size)==0) return I_OK;
#endif
    if (tries < 2) return I_ERROR;

    if (gettimeofday(&time, &tz) == -1) usetimeout = 0;
    else {
       stoptime.tv_sec = time.tv_sec + timeout / 1000;
       stoptime.tv_usec = time.tv_usec + 1000 * (timeout % 1000);
       while (stoptime.tv_usec > 1000000) {
          stoptime.tv_sec++;
          stoptime.tv_usec -= 1000000;
          }
       }

    while (--tries > 0) {
       usleep(delay*1000);
#ifdef UNIX
       {struct flock lock;
       lock.l_whence = SEEK_SET;
       lock.l_start = location;
       lock.l_type = locktype;;
       lock.l_len = size;
       if (fcntl(fd, F_SETLK, &lock) == 0) return I_OK; }
#else  // DOS/WIN
       if (lock(fd,location,size)==0) return I_OK;
#endif
       if (usetimeout && gettimeofday(&time, &tz) == 0) {
          if (time.tv_sec > stoptime.tv_sec) return I_ERROR;
          if (time.tv_sec == stoptime.tv_sec && time.tv_usec > 
stoptime.tv_usec)
             return I_ERROR;
          }
       }
    return I_OK;
} /* cb_lock_area */

- Raw text -


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