[LTP] [PATCH 2/5] fcntl41: test for owner values on OFD posix locks

Alexander Aring aahringo@redhat.com
Fri Jun 30 22:00:55 CEST 2023


Hi,

On Wed, Jun 21, 2023 at 5:38 AM Petr Vorel <pvorel@suse.cz> wrote:
>
> Hi Alexander,
>
> > diff --git a/testcases/kernel/syscalls/fcntl/fcntl41.c b/testcases/kernel/syscalls/fcntl/fcntl41.c
> > new file mode 100644
> > index 000000000..40d14ff02
> > --- /dev/null
> > +++ b/testcases/kernel/syscalls/fcntl/fcntl41.c
> ...
> > +#include <sys/wait.h>
> > +
> > +#include "tst_test.h"
> > +
> > +static int fd, fd2;
> > +
> > +void do_child1(void)
> > +{
> > +     const struct flock fl_0_0 = {
> > +             .l_type = F_WRLCK,
> > +             .l_whence = SEEK_SET,
> > +             .l_start = 0L,
> > +             .l_len = 1L,
> > +     };
> > +
> > +     tst_res(TINFO, "thread1 waits for thread2 to lock 1-1");
> > +     TST_CHECKPOINT_WAIT(1);
> > +
> > +     tst_res(TINFO, "thread1 lock region 0-0 - It should block");
> > +     SAFE_FCNTL(fd2, F_OFD_SETLKW, &fl_0_0);
> F_OFD_SETLKW is undefined on old Cent0S 7, we still support:
> https://github.com/pevik/ltp/actions/runs/5331934790/jobs/9660442246
>
> You need to use our fallback to avoid this.
>
> #include "lapi/fcntl.h"
>
> We also have fcntl_common.h, which is used for F_OFD_* (fcntl_compat(),
> you may need to use it. It also includes lapi/fcntl.h.
>

ok.

- Alex



More information about the ltp mailing list