Mail Archives: djgpp/2003/05/05/04:45:18
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 -