This is the mail archive of the libc-alpha@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: [PATCH] Fix Linux fcntl OFD locks on unsupported kernels


On 07/27/2018 09:12 AM, Adhemerval Zanella wrote:
> This patch make the OFD tests return unsupported if kernel does not
> support OFD locks (it was added on 3.15).
> 
> Checked on a ia64-linux-gnu with Linux 3.14.
> 
> 	* sysdeps/unix/sysv/linux/tst-ofdlocks.c: Return unsupported if
> 	kernel does not support OFD locks.
> 	* sysdeps/unix/sysv/linux/tst-ofdlocks-compat.c: Likewise.

OK with parenthesis removal fix noted by Rical and Andreas.
OK since Florian's suggestion of %m is withdrawn.

OK for master.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>

> ---
>  ChangeLog                                     | 6 ++++++
>  sysdeps/unix/sysv/linux/tst-ofdlocks-compat.c | 7 ++++++-
>  sysdeps/unix/sysv/linux/tst-ofdlocks.c        | 7 ++++++-
>  3 files changed, 18 insertions(+), 2 deletions(-)
> 
> diff --git a/sysdeps/unix/sysv/linux/tst-ofdlocks-compat.c b/sysdeps/unix/sysv/linux/tst-ofdlocks-compat.c
> index 03c4abf..8da5a0b 100644
> --- a/sysdeps/unix/sysv/linux/tst-ofdlocks-compat.c
> +++ b/sysdeps/unix/sysv/linux/tst-ofdlocks-compat.c
> @@ -62,7 +62,12 @@ do_test (void)
>      .l_start  = (off64_t)INT32_MAX + 1024,
>      .l_len    = 1024,
>    };
> -  TEST_VERIFY_EXIT (fcntl (temp_fd, F_OFD_SETLKW, &lck64) == 0);
> +  int ret = fcntl (temp_fd, F_OFD_SETLKW, &lck64);
> +  if (ret == -1 && errno == EINVAL)
> +    /* OFD locks are only available on Linux 3.15.  */
> +    FAIL_UNSUPPORTED ("fcntl (F_OFD_SETLKW) not supported)");

OK, extra paren's noted by Rical/Andreas.

> +
> +  TEST_VERIFY_EXIT (ret == 0);

OK.

>  
>    /* Open file description locks placed through the same open file description
>       (either by same file descriptor or a duplicated one created by fork,
> diff --git a/sysdeps/unix/sysv/linux/tst-ofdlocks.c b/sysdeps/unix/sysv/linux/tst-ofdlocks.c
> index bd345e9..66c7856 100644
> --- a/sysdeps/unix/sysv/linux/tst-ofdlocks.c
> +++ b/sysdeps/unix/sysv/linux/tst-ofdlocks.c
> @@ -46,7 +46,12 @@ do_test (void)
>      .l_start  = (off64_t)INT32_MAX + 1024,
>      .l_len    = 1024,
>    };
> -  TEST_VERIFY_EXIT (fcntl64 (temp_fd, F_OFD_SETLKW, &lck64) == 0);
> +  int ret = fcntl64 (temp_fd, F_OFD_SETLKW, &lck64);
> +  if (ret == -1 && errno == EINVAL)
> +    /* OFD locks are only available on Linux 3.15.  */
> +    FAIL_UNSUPPORTED ("fcntl (F_OFD_SETLKW) not supported)");
> +

OK, extra paren noted by Rical/Andreas.

> +  TEST_VERIFY_EXIT (ret == 0);

OK.

>  
>    /* Open file description locks placed through the same open file description
>       (either by same file descriptor or a duplicated one created by fork,
> 

Cheers,
Carlos.


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