Re: file lock() and share.exe

John Charlton
2003-09-20T22:51:32Z

On Friday 12 September 2003 09:42, John Charlton wrote:
> On Friday 12 September 2003 06:21, Bart Oldeman wrote:
> > On Thu, 11 Sep 2003, John Charlton wrote:
> > > I have a dos application compiled with djgpp compiler in dosemu. A
> > > call to the lock() function which works in native freedos (beta 8)
> > > always returns -1 (failed) in dosemu. I first used dosemu 1.0.2.0
> > > which installs with SuSE Linux 8.2 distribution. I just installed
> > > dosemu-1.1.5 and observe the exact same behavior. The freedos version
> > > used with dosemu-1.1.5 is:
> > > FreeDOS kernel version 1.1.24c (Build 2024c) [Jun 10 2001 22:25:01]
> >
> > you'll need to upgrade your freedos kernel. Replace your kernel.sys with
> > v. 2031 at http://freedos.sourceforge.net (fat16/32 doesn't matter).
> >
> > Beware of "unzip" and uppercase: use "unzip -L" otherwise you end up with
> > KERNEL.SYS and kernel.sys.
> >
> > share.exe has absolutely no effect on the "network drives" (from
> > lredir) that DOSEMU uses by default.
> >
> > Bart
>
> Thank you. This definitely does the trick! Works as advertised. No
> share.exe loaded the lock works.
>
> --John

I now have dosemu 1.1.5.0 with kernel v. 2031 fat 16 as recommended above. It
fixes the lock() problem I was having including file lock() on an Iredir NFS
mounted file system. After some testing, I have found a problem with this
kernel (2031) which occurs both on native freedos boot or using dosemu
1.1.5.0. The problem occurs using stdin input and fgets() calls. They work
one or two times then return junk without waiting for an endline enter
sequence. Here is the function that returns without waiting for the keyboard
enter/end of line:

void chkkbd(void)
{
int ch;
char str[80];

fprintf(stderr, "Hit enter to continue, s to stop, q to quit
immediately...");
fgets(str, 80, stdin);
fputs(str, stderr);
ch = str[0];
if (ch == 's' || ch == 'S') {
bStop = TRUE;
}
if (ch == 'q' || ch == 'Q') {
bQuit = TRUE;
}
}

It is a pretty basic function. I did use getchar() at first, with the same
result. This function works as intended with kernel 1.1.26a (2026a) or in
linux. With kernel 2031 it behaves as described above and if you rerun the
same program it crashes the dosemu session.

Is there an earlier kernel I can use to solve the share/lock issue and not
introduce this stdin problem?

--John