[fpc-pascal] File region locking unde Linux
ajv
info at vogelaar-electronics.com
Mon May 4 09:35:00 CEST 2009
Dear Jonas Maebe,
Thank you very much for the research you have done on this subject.
I was unaware of the power of strace, I have never used this
application, I will go into it.
I see your name in the referred bug, I think you are the maintainer of
this subject?
Do I have to report this as a bug or is it included in the mentioned bug?
Best regards, Anthony Vogelaar
==================================================================
Jonas Maebe wrote:
>
> On 03 May 2009, at 14:51, Jonas Maebe wrote:
>
>> On 03 May 2009, at 14:09, ajv wrote:
>>
>>> With Region Do Begin
>>> l_type := F_WRLCK; l_whence := SEEK_SET;
>>> l_start := 10; l_len := 20
>>> End;
>>> If FpFcntl (F, F_SETLK, Region) = -1 Then
>>> WriteLn ('unable to apply writelock'); // <-- OK
>>> Sleep (20000); // Sleep 20 Sec
>>> FpClose (F);
>>> End.
>>> --------------------------------------------------------------------------------------
>>>
>>> Then within 20 seconds i start test to obtain a readlock on 80.
>>> This fails. Why? What am I doing wrong?
>>
>> Your test works fine under Solaris. It's a bug somewhere in the FPC
>> Linux units. strace shows this for your first program:
>>
>> fcntl(3, F_SETLK, {type=F_WRLCK, whence=SEEK_SET, start=10, len=0}) = 0
>>
>> As you can see, "len=0" is passed to the system call (instead of
>> len=20), so it locks the entire file. That's the reason why the other
>> program is unable to lock anything else.
>
> It's similar to http://bugs.freepascal.org/view.php?id=13363 : the
> kernel's off_t is 32 bit on 32 bit systems. It's defined as 64 bit in
> the Linux rtl for all platforms.
>
>
> Jonas
> _______________________________________________
> fpc-pascal maillist - fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>
>
More information about the fpc-pascal
mailing list