Question about fcntl64
Hongzhi, Song
hongzhi.song@windriver.com
Thu Sep 13 02:26:00 GMT 2018
Append source code link:
https://github.com/linux-test-project/ltp/blob/7599ff232b98b4f8440e1410e8721822995877e2/testcases/kernel/syscalls/fcntl/fcntl34.c#L79
The problem is prompt on qemux86.
Thanks,
Hongzhi
On 2018å¹´09æ13æ¥ 09:10, Hongzhi, Song wrote:
>
>
> On 2018å¹´09æ13æ¥ 01:32, Florian Weimer wrote:
>> On 09/12/2018 04:23 PM, Hongzhi, Song wrote:
>>> Testcase source code: ltp/testcases/kernel/syscalls/fcntl/fcntl34.c
>>>
>>>
>>> In function 'thread_fn_01', struct flock64 lck.l_len is set '1'.
>>>
>>> thread_fn_01 ---> SAFE_FCNTL(fd, F_OFD_SETLKW, &lck) ---> fcntl64
>>
>> Please quote the relevant parts of the source code. What is SAFE_FNCTL?
>>
>
> OK,
>
> 1.part of source code: ltp/testcases/kernel/syscalls/fcntl/fcntl34.c
> ---
> struct flock64 lck = {
> Â Â Â Â Â Â Â Â .l_whence = SEEK_SET,
>       .l_start = 0,
> --->   .l_len   = 1, <---
> };
> lck.l_type = F_WRLCK
> SAFE_FCNTL(fd, F_OFD_SETLKW, &lck);
> ---
>
> 2.SAFE_FCNTL is defined as a macro:
> ---
> #define SAFE_FCNTL(fd, cmd, ...)Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â \
> Â Â ---> ({int tst_ret_ = fcntl(fd, cmd, ##__VA_ARGS__);Â Â Â Â \ <---
>      tst_ret_ == -1 ?                                 \
>       tst_brk(TBROK | TERRNO,                         \
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "fcntl(%i,%s,...) failed", fd, #cmd), 0 \
> Â Â Â Â : tst_ret_;})
> ---
>
> 3. I used "strace -f ./fcntl34" found that: l_len was changed to '0'.
>
> fcntl64(6, F_OFD_SETLKW, {l_type=F_WRLCK, l_whence=SEEK_SET,
> l_start=0, ---> l_len=0 <---}
>
> 4. The question is that l_len was set '1', but why it is changed to
> '0' when it is passed to fcntl64.
>
> Thanks,
> --Hongzhi
>
>> Thanks,
>> Florian
>>
>
>
More information about the Libc-help
mailing list