about summary refs log tree commit diff
path: root/sysdeps/unix/sysv/linux
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>2018-07-27 10:07:14 -0300
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2018-07-27 14:48:06 -0300
commit2c6da2f48769ca37b22088fe65bdcb4b0f319b80 (patch)
treef858c8c42949fbdb68415247ea2d9c802b24ba61 /sysdeps/unix/sysv/linux
parentda80612d6114815db698bf891fb751e7962d1c11 (diff)
downloadglibc-2c6da2f48769ca37b22088fe65bdcb4b0f319b80.tar.gz
glibc-2c6da2f48769ca37b22088fe65bdcb4b0f319b80.tar.xz
glibc-2c6da2f48769ca37b22088fe65bdcb4b0f319b80.zip
Fix Linux fcntl OFD locks on unsupported kernels
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.
Diffstat (limited to 'sysdeps/unix/sysv/linux')
-rw-r--r--sysdeps/unix/sysv/linux/tst-ofdlocks-compat.c7
-rw-r--r--sysdeps/unix/sysv/linux/tst-ofdlocks.c7
2 files changed, 12 insertions, 2 deletions
diff --git a/sysdeps/unix/sysv/linux/tst-ofdlocks-compat.c b/sysdeps/unix/sysv/linux/tst-ofdlocks-compat.c
index 03c4abfeff..aaf65af0db 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");
+
+  TEST_VERIFY_EXIT (ret == 0);
 
   /* 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 bd345e9b64..a660bab6dd 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");
+
+  TEST_VERIFY_EXIT (ret == 0);
 
   /* Open file description locks placed through the same open file description
      (either by same file descriptor or a duplicated one created by fork,