This is the mail archive of the libc-help@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Question about fcntl64


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]