Question about fcntl64
Florian Weimer
fweimer@redhat.com
Thu Sep 13 08:10:00 GMT 2018
On 09/13/2018 03:10 AM, Hongzhi, Song wrote:
> 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_;})
> ---
The expectation in glibc 2.28 is that you use fcntl64 with struct
flock64, just as you would use struct stat64 with fstat64. (Without
-D_FILE_OFFSET_BITS=64, of course.)
Thanks,
Florian
More information about the Libc-help
mailing list