On Sat, 2 Nov 2002, Przemyslaw Czerpak wrote:

> The newest Samba use fcntl64 (63 bit lock area) with kernel 2.4
> I guess it is the problem. When I last time checked DOSEMU it
> used only normal fcntl and cleared the highest bit in lock address.
> It has to be changed to avoid such lock problems.

This could well be the case, thanks. The fundamental problem seems to be
that file offsets in DOS are unsigned 32-bit whereas in Unix they are
signed (off_t/loff_t).

Right now, for LOCK_FILE_REGION (as opposed to the locking bits used when
opening a  file), for the struct flock larg, larg.l_len is masked with
~0xc0000000 so even the *two* highest bits are cleared.

For l_start, the top two bits are shifted like this:
0xc0000020 becomes 0x3000020.
because " /* the offset is often strange - remove 2 of its bits if either of
             the top two bits are set. Shift the top ones by two bits. This
             still allows OLE2 apps to operate, but should stop lockd from
             dieing */ "

it means though that if the relevant file is greater than 256 MB things
can go horribly wrong.

Now with fcntl64 we can probably avoid this wizardry but will probably
also need to use open64 instead of open and check the kernel version at
runtime?

$ man fcntl64
No manual entry for fcntl64

Hmm :(

Bart

-
To unsubscribe from this list: send the line "unsubscribe linux-msdos" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to