about summary refs log tree commit diff
path: root/nptl
diff options
context:
space:
mode:
authorMike Crowe <mac@mcrowe.com>2019-06-24 19:48:14 +0000
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2019-07-12 13:36:25 +0000
commit9d20e22e46d891b929a72b0f35586e079eb083fd (patch)
tree9a019e3719e6ae633b0e4094eb8c1ce2e7f434d3 /nptl
parent59213094c84ec723efd2775a2ce8e4678e77f453 (diff)
downloadglibc-9d20e22e46d891b929a72b0f35586e079eb083fd.tar.gz
glibc-9d20e22e46d891b929a72b0f35586e079eb083fd.tar.xz
glibc-9d20e22e46d891b929a72b0f35586e079eb083fd.zip
nptl: Add POSIX-proposed pthread_mutex_clocklock
Add POSIX-proposed pthread_mutex_clocklock function that works like
pthread_mutex_timedlock but takes a clockid parameter to measure the
abstime parameter against.

	* sysdeps/nptl/pthread.h: Add pthread_mutex_clocklock.
	* nptl/DESIGN-systemtap-probes.txt: Likewise.
	* nptl/pthread_mutex_timedlock.c
	(__pthread_mutex_clocklock_common): Rename from
	__pthread_mutex_timedlock and add clockid parameter. Pass this
	parameter to lll_clocklock and lll_clocklock_elision in place of
	CLOCK_REALTIME. (__pthread_mutex_clocklock): New function to add
	LIBC_PROBE and validate clockid parameter before calling
	__pthread_mutex_clocklock_common. (__pthread_mutex_timedlock): New
	implementation to add LIBC_PROBE and calls
	__pthread_mutex_clocklock_common passing CLOCK_REALTIME as the
	clockid.
	* nptl/Makefile: Add tst-mutex11.c.
	* nptl/tst-abstime.c (th): Add tests for pthread_mutex_clocklock.
	* nptl/tst-mutex11.c: New tests for passing invalid and unsupported
	clockid parameters to pthread_mutex_clocklock.
	* nptl/tst-mutex5.c (do_test_clock): Rename from do_test and take
	clockid parameter to indicate which clock to be used. Call
	pthread_mutex_timedlock or pthread_mutex_clocklock as appropriate.
	(do_test): Call do_test_clock to separately test
	pthread_mutex_timedlock, pthread_mutex_clocklock(CLOCK_REALTIME)
	and pthread_mutex_clocklock(CLOCK_MONOTONIC).
	* nptl/tst-mutex9.c: Likewise.
	* nptl/Versions (GLIBC_2.30): Add pthread_mutex_clocklock.
	* sysdeps/unix/sysv/linux/aarch64/libpthread.abilist (GLIBC_2.30):
	Likewise.
	* sysdeps/unix/sysv/linux/alpha/libpthread.abilist (GLIBC_2.30):
	Likewise.
	* sysdeps/unix/sysv/linux/arm/libpthread.abilist (GLIBC_2.30):
	Likewise.
	* sysdeps/unix/sysv/linux/csky/libpthread.abilist (GLIBC_2.30):
	Likewise.
	* sysdeps/unix/sysv/linux/hppa/libpthread.abilist (GLIBC_2.30):
	Likewise.
	* sysdeps/unix/sysv/linux/i386/libpthread.abilist (GLIBC_2.30):
	Likewise.
	* sysdeps/unix/sysv/linux/ia64/libpthread.abilist (GLIBC_2.30):
	Likewise.
	* sysdeps/unix/sysv/linux/m68k/coldfire/libpthread.abilist
	(GLIBC_2.30): Likewise.
	* sysdeps/unix/sysv/linux/m68k/m680x0/libpthread.abilist
	(GLIBC_2.30): Likewise.
	* sysdeps/unix/sysv/linux/microblaze/libpthread.abilist
	(GLIBC_2.30): Likewise.
	* sysdeps/unix/sysv/linux/mips/mips32/libpthread.abilist
	(GLIBC_2.30): Likewise.
	* sysdeps/unix/sysv/linux/mips/mips64/libpthread.abilist
	(GLIBC_2.30): Likewise.
	* sysdeps/unix/sysv/linux/nios2/libpthread.abilist (GLIBC_2.30):
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/libpthread.abilist
	(GLIBC_2.30): Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libpthread.abilist
	(GLIBC_2.30): Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libpthread.abilist
	(GLIBC_2.30): Likewise.
	* sysdeps/unix/sysv/linux/riscv/rv64/libpthread.abilist
	(GLIBC_2.30): Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-32/libpthread.abilist
	(GLIBC_2.30): Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-64/libpthread.abilist
	(GLIBC_2.30): Likewise.
	* sysdeps/unix/sysv/linux/sh/libpthread.abilist (GLIBC_2.30):
	Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc32/libpthread.abilist
	(GLIBC_2.30): Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc64/libpthread.abilist
	(GLIBC_2.30): Likewise.
	* sysdeps/unix/sysv/linux/x86_64/64/libpthread.abilist
	(GLIBC_2.30): Likewise.
	* sysdeps/unix/sysv/linux/x86_64/x32/libpthread.abilist
	(GLIBC_2.30): Likewise.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Diffstat (limited to 'nptl')
-rw-r--r--nptl/DESIGN-systemtap-probes.txt3
-rw-r--r--nptl/Makefile2
-rw-r--r--nptl/Versions1
-rw-r--r--nptl/pthread_cond_wait.c9
-rw-r--r--nptl/pthread_mutex_timedlock.c40
-rw-r--r--nptl/tst-abstime.c2
-rw-r--r--nptl/tst-mutex11.c69
-rw-r--r--nptl/tst-mutex5.c37
-rw-r--r--nptl/tst-mutex9.c24
9 files changed, 160 insertions, 27 deletions
diff --git a/nptl/DESIGN-systemtap-probes.txt b/nptl/DESIGN-systemtap-probes.txt
index ac972a9542..6a62e25532 100644
--- a/nptl/DESIGN-systemtap-probes.txt
+++ b/nptl/DESIGN-systemtap-probes.txt
@@ -32,6 +32,9 @@ mutex_entry   - probe for entry to the pthread_mutex_lock function
               arg1 = address of mutex lock
 mutex_timedlock_entry - probe for entry to the pthread_mutex_timedlock function
                       arg1 = address of mutex lock, arg2 = address of timespec
+mutex_clocklock_entry - probe for entry to the pthread_mutex_clocklock function
+                      arg1 = address of mutex lock, arg2 = clockid,
+		      arg3 = address of timespec
 mutex_release - probe for pthread_mutex_unlock after the successful release of a
                 mutex lock
               arg1 = address of mutex lock
diff --git a/nptl/Makefile b/nptl/Makefile
index 106a981297..0567e77a79 100644
--- a/nptl/Makefile
+++ b/nptl/Makefile
@@ -244,7 +244,7 @@ LDLIBS-tst-minstack-throw = -lstdc++
 
 tests = tst-attr1 tst-attr2 tst-attr3 tst-default-attr \
 	tst-mutex1 tst-mutex2 tst-mutex3 tst-mutex4 tst-mutex5 tst-mutex6 \
-	tst-mutex7 tst-mutex9 tst-mutex10 tst-mutex5a tst-mutex7a \
+	tst-mutex7 tst-mutex9 tst-mutex10 tst-mutex11 tst-mutex5a tst-mutex7a \
 	tst-mutex7robust tst-mutexpi1 tst-mutexpi2 tst-mutexpi3 tst-mutexpi4 \
 	tst-mutexpi5 tst-mutexpi5a tst-mutexpi6 tst-mutexpi7 tst-mutexpi7a \
 	tst-mutexpi9 \
diff --git a/nptl/Versions b/nptl/Versions
index f504877f2a..f2ea2b32a1 100644
--- a/nptl/Versions
+++ b/nptl/Versions
@@ -279,6 +279,7 @@ libpthread {
   GLIBC_2.30 {
     sem_clockwait; pthread_cond_clockwait;
     pthread_rwlock_clockrdlock; pthread_rwlock_clockwrlock;
+    pthread_mutex_clocklock;
   }
 
   GLIBC_PRIVATE {
diff --git a/nptl/pthread_cond_wait.c b/nptl/pthread_cond_wait.c
index 558f930cd2..68ec754003 100644
--- a/nptl/pthread_cond_wait.c
+++ b/nptl/pthread_cond_wait.c
@@ -655,6 +655,10 @@ __pthread_cond_timedwait (pthread_cond_t *cond, pthread_mutex_t *mutex,
                     ? CLOCK_MONOTONIC : CLOCK_REALTIME;
   return __pthread_cond_wait_common (cond, mutex, clockid, abstime);
 }
+versioned_symbol (libpthread, __pthread_cond_wait, pthread_cond_wait,
+		  GLIBC_2_3_2);
+versioned_symbol (libpthread, __pthread_cond_timedwait, pthread_cond_timedwait,
+		  GLIBC_2_3_2);
 
 /* See __pthread_cond_wait_common.  */
 int
@@ -677,9 +681,4 @@ __pthread_cond_clockwait (pthread_cond_t *cond, pthread_mutex_t *mutex,
 
   return __pthread_cond_wait_common (cond, mutex, clockid, abstime);
 }
-
-versioned_symbol (libpthread, __pthread_cond_wait, pthread_cond_wait,
-		  GLIBC_2_3_2);
-versioned_symbol (libpthread, __pthread_cond_timedwait, pthread_cond_timedwait,
-		  GLIBC_2_3_2);
 weak_alias (__pthread_cond_clockwait, pthread_cond_clockwait);
diff --git a/nptl/pthread_mutex_timedlock.c b/nptl/pthread_mutex_timedlock.c
index 10a9989a67..52c258e33d 100644
--- a/nptl/pthread_mutex_timedlock.c
+++ b/nptl/pthread_mutex_timedlock.c
@@ -42,15 +42,14 @@
 #endif
 
 int
-__pthread_mutex_timedlock (pthread_mutex_t *mutex,
-			   const struct timespec *abstime)
+__pthread_mutex_clocklock_common (pthread_mutex_t *mutex,
+				  clockid_t clockid,
+				  const struct timespec *abstime)
 {
   int oldval;
   pid_t id = THREAD_GETMEM (THREAD_SELF, tid);
   int result = 0;
 
-  LIBC_PROBE (mutex_timedlock_entry, 2, mutex, abstime);
-
   /* We must not check ABSTIME here.  If the thread does not block
      abstime must not be checked for a valid value.  */
 
@@ -76,7 +75,7 @@ __pthread_mutex_timedlock (pthread_mutex_t *mutex,
 	}
 
       /* We have to get the mutex.  */
-      result = lll_clocklock (mutex->__data.__lock, CLOCK_REALTIME, abstime,
+      result = lll_clocklock (mutex->__data.__lock, clockid, abstime,
 			      PTHREAD_MUTEX_PSHARED (mutex));
 
       if (result != 0)
@@ -99,7 +98,7 @@ __pthread_mutex_timedlock (pthread_mutex_t *mutex,
       FORCE_ELISION (mutex, goto elision);
     simple:
       /* Normal mutex.  */
-      result = lll_clocklock (mutex->__data.__lock, CLOCK_REALTIME, abstime,
+      result = lll_clocklock (mutex->__data.__lock, clockid, abstime,
 			      PTHREAD_MUTEX_PSHARED (mutex));
       break;
 
@@ -108,7 +107,7 @@ __pthread_mutex_timedlock (pthread_mutex_t *mutex,
       /* Don't record ownership */
       return lll_clocklock_elision (mutex->__data.__lock,
 				    mutex->__data.__spins,
-				    CLOCK_REALTIME, abstime,
+				    clockid, abstime,
 				    PTHREAD_MUTEX_PSHARED (mutex));
 
 
@@ -126,7 +125,7 @@ __pthread_mutex_timedlock (pthread_mutex_t *mutex,
 	      if (cnt++ >= max_cnt)
 		{
 		  result = lll_clocklock (mutex->__data.__lock,
-					  CLOCK_REALTIME, abstime,
+					  clockid, abstime,
 					  PTHREAD_MUTEX_PSHARED (mutex));
 		  break;
 		}
@@ -269,7 +268,7 @@ __pthread_mutex_timedlock (pthread_mutex_t *mutex,
 
 	  /* Block using the futex.  */
 	  int err = lll_futex_clock_wait_bitset (&mutex->__data.__lock,
-	      oldval, CLOCK_REALTIME, abstime,
+	      oldval, clockid, abstime,
 	      PTHREAD_ROBUST_MUTEX_PSHARED (mutex));
 	  /* The futex call timed out.  */
 	  if (err == -ETIMEDOUT)
@@ -405,7 +404,7 @@ __pthread_mutex_timedlock (pthread_mutex_t *mutex,
 		    struct timespec reltime;
 		    struct timespec now;
 
-		    INTERNAL_SYSCALL (clock_gettime, __err, 2, CLOCK_REALTIME,
+		    INTERNAL_SYSCALL (clock_gettime, __err, 2, clockid,
 				      &now);
 		    reltime.tv_sec = abstime->tv_sec - now.tv_sec;
 		    reltime.tv_nsec = abstime->tv_nsec - now.tv_nsec;
@@ -623,4 +622,25 @@ __pthread_mutex_timedlock (pthread_mutex_t *mutex,
  out:
   return result;
 }
+
+int
+__pthread_mutex_clocklock (pthread_mutex_t *mutex,
+			   clockid_t clockid,
+			   const struct timespec *abstime)
+{
+  if (__glibc_unlikely (!lll_futex_supported_clockid (clockid)))
+    return EINVAL;
+
+  LIBC_PROBE (mutex_clocklock_entry, 3, mutex, clockid, abstime);
+  return __pthread_mutex_clocklock_common (mutex, clockid, abstime);
+}
+weak_alias (__pthread_mutex_clocklock, pthread_mutex_clocklock)
+
+int
+__pthread_mutex_timedlock (pthread_mutex_t *mutex,
+			   const struct timespec *abstime)
+{
+  LIBC_PROBE (mutex_timedlock_entry, 2, mutex, abstime);
+  return __pthread_mutex_clocklock_common (mutex, CLOCK_REALTIME, abstime);
+}
 weak_alias (__pthread_mutex_timedlock, pthread_mutex_timedlock)
diff --git a/nptl/tst-abstime.c b/nptl/tst-abstime.c
index c5040c591a..30dea4d5b4 100644
--- a/nptl/tst-abstime.c
+++ b/nptl/tst-abstime.c
@@ -36,6 +36,8 @@ th (void *arg)
   struct timespec t = { -2, 0 };
 
   TEST_COMPARE (pthread_mutex_timedlock (&m1, &t), ETIMEDOUT);
+  TEST_COMPARE (pthread_mutex_clocklock (&m1, CLOCK_REALTIME, &t), ETIMEDOUT);
+  TEST_COMPARE (pthread_mutex_clocklock (&m1, CLOCK_MONOTONIC, &t), ETIMEDOUT);
   TEST_COMPARE (pthread_rwlock_timedrdlock (&rw1, &t), ETIMEDOUT);
   TEST_COMPARE (pthread_rwlock_timedwrlock (&rw2, &t), ETIMEDOUT);
   TEST_COMPARE (pthread_rwlock_clockrdlock (&rw1, CLOCK_REALTIME, &t),
diff --git a/nptl/tst-mutex11.c b/nptl/tst-mutex11.c
new file mode 100644
index 0000000000..dc1055e090
--- /dev/null
+++ b/nptl/tst-mutex11.c
@@ -0,0 +1,69 @@
+/* Test unsupported/bad clocks passed to pthread_mutex_clocklock.
+
+   Copyright (C) 2019 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <errno.h>
+#include <pthread.h>
+#include <stdio.h>
+#include <time.h>
+#include <unistd.h>
+#include <support/check.h>
+
+static pthread_mutex_t mut = PTHREAD_MUTEX_INITIALIZER;
+
+static void test_bad_clockid (clockid_t clockid)
+{
+  const struct timespec ts = {0,0};
+  TEST_COMPARE (pthread_mutex_clocklock (&mut, clockid, &ts), EINVAL);
+}
+
+#define NOT_A_VALID_CLOCK 123456
+
+static int
+do_test (void)
+{
+  /* These clocks are meaningless to pthread_mutex_clocklock.  */
+#if defined(CLOCK_PROCESS_CPUTIME_ID)
+  test_bad_clockid (CLOCK_PROCESS_CPUTIME_ID);
+#endif
+#if defined(CLOCK_THREAD_CPUTIME_ID)
+  test_bad_clockid (CLOCK_PROCESS_CPUTIME_ID);
+#endif
+
+  /* These clocks might be meaningful, but are currently unsupported by
+     pthread_mutex_clocklock.  */
+#if defined(CLOCK_REALTIME_COARSE)
+  test_bad_clockid (CLOCK_REALTIME_COARSE);
+#endif
+#if defined(CLOCK_MONOTONIC_RAW)
+  test_bad_clockid (CLOCK_MONOTONIC_RAW);
+#endif
+#if defined(CLOCK_MONOTONIC_COARSE)
+  test_bad_clockid (CLOCK_MONOTONIC_COARSE);
+#endif
+#if defined(CLOCK_BOOTTIME)
+  test_bad_clockid (CLOCK_BOOTTIME);
+#endif
+
+  /* This is a completely invalid clock.  */
+  test_bad_clockid (NOT_A_VALID_CLOCK);
+
+  return 0;
+}
+
+#include <support/test-driver.c>
diff --git a/nptl/tst-mutex5.c b/nptl/tst-mutex5.c
index fb27152ecc..7e236ade4d 100644
--- a/nptl/tst-mutex5.c
+++ b/nptl/tst-mutex5.c
@@ -32,12 +32,17 @@
 # define TYPE PTHREAD_MUTEX_NORMAL
 #endif
 
+/* A bogus clock value that tells run_test to use
+   pthread_mutex_timedlock rather than pthread_mutex_clocklock.  */
+#define CLOCK_USE_TIMEDLOCK (-1)
 
 static int
-do_test (void)
+do_test_clock (clockid_t clockid, const char *fnname)
 {
   pthread_mutex_t m;
   pthread_mutexattr_t a;
+  const clockid_t clockid_for_get =
+    (clockid == CLOCK_USE_TIMEDLOCK) ? CLOCK_REALTIME : clockid;
 
   TEST_COMPARE (pthread_mutexattr_init (&a), 0);
   TEST_COMPARE (pthread_mutexattr_settype (&a, TYPE), 0);
@@ -62,16 +67,23 @@ do_test (void)
     FAIL_EXIT1 ("mutex_trylock succeeded");
 
   /* Wait 2 seconds.  */
-  struct timespec ts_timeout = timespec_add (xclock_now (CLOCK_REALTIME),
+  struct timespec ts_timeout = timespec_add (xclock_now (clockid_for_get),
                                              make_timespec (2, 0));
 
-  TEST_COMPARE (pthread_mutex_timedlock (&m, &ts_timeout), ETIMEDOUT);
-  TEST_TIMESPEC_BEFORE_NOW (ts_timeout, CLOCK_REALTIME);
+  if (clockid == CLOCK_USE_TIMEDLOCK)
+    TEST_COMPARE (pthread_mutex_timedlock (&m, &ts_timeout), ETIMEDOUT);
+  else
+    TEST_COMPARE (pthread_mutex_clocklock (&m, clockid, &ts_timeout),
+		  ETIMEDOUT);
+  TEST_TIMESPEC_BEFORE_NOW (ts_timeout, clockid_for_get);
 
   /* The following makes the ts value invalid.  */
   ts_timeout.tv_nsec += 1000000000;
 
-  TEST_COMPARE (pthread_mutex_timedlock (&m, &ts_timeout), EINVAL);
+  if (clockid == CLOCK_USE_TIMEDLOCK)
+    TEST_COMPARE (pthread_mutex_timedlock (&m, &ts_timeout), EINVAL);
+  else
+    TEST_COMPARE (pthread_mutex_clocklock (&m, clockid, &ts_timeout), EINVAL);
   TEST_COMPARE (pthread_mutex_unlock (&m), 0);
 
   const struct timespec ts_start = xclock_now (CLOCK_REALTIME);
@@ -79,9 +91,12 @@ do_test (void)
   /* Wait 2 seconds.  */
   ts_timeout = timespec_add (ts_start, make_timespec (2, 0));
 
-  TEST_COMPARE (pthread_mutex_timedlock (&m, &ts_timeout), 0);
+  if (clockid == CLOCK_USE_TIMEDLOCK)
+    TEST_COMPARE (pthread_mutex_timedlock (&m, &ts_timeout), 0);
+  else
+    TEST_COMPARE (pthread_mutex_clocklock (&m, clockid, &ts_timeout), 0);
 
-  const struct timespec ts_end = xclock_now (CLOCK_REALTIME);
+  const struct timespec ts_end = xclock_now (clockid_for_get);
 
   /* Check that timedlock didn't delay.  We use a limit of 0.1 secs.  */
   TEST_TIMESPEC_BEFORE (ts_end,
@@ -93,4 +108,12 @@ do_test (void)
   return 0;
 }
 
+static int do_test (void)
+{
+  do_test_clock (CLOCK_USE_TIMEDLOCK, "timedlock");
+  do_test_clock (CLOCK_REALTIME, "clocklock(realtime)");
+  do_test_clock (CLOCK_MONOTONIC, "clocklock(monotonic)");
+  return 0;
+}
+
 #include <support/test-driver.c>
diff --git a/nptl/tst-mutex9.c b/nptl/tst-mutex9.c
index e9fd8e2859..c0d218542f 100644
--- a/nptl/tst-mutex9.c
+++ b/nptl/tst-mutex9.c
@@ -31,9 +31,15 @@
 #include <support/xunistd.h>
 
 
-static int
-do_test (void)
+/* A bogus clock value that tells run_test to use pthread_mutex_timedlock
+   rather than pthread_mutex_clocklock.  */
+#define CLOCK_USE_TIMEDLOCK (-1)
+
+static void
+do_test_clock (clockid_t clockid)
 {
+  const clockid_t clockid_for_get =
+    (clockid == CLOCK_USE_TIMEDLOCK) ? CLOCK_REALTIME : clockid;
   size_t ps = sysconf (_SC_PAGESIZE);
   char tmpfname[] = "/tmp/tst-mutex9.XXXXXX";
   char data[ps];
@@ -95,10 +101,13 @@ do_test (void)
       if (pthread_mutex_unlock (m) == 0)
         FAIL_EXIT1 ("child: mutex_unlock succeeded");
 
-      const struct timespec ts = timespec_add (xclock_now (CLOCK_REALTIME),
+      const struct timespec ts = timespec_add (xclock_now (clockid_for_get),
                                                make_timespec (0, 500000000));
 
-      TEST_COMPARE (pthread_mutex_timedlock (m, &ts), ETIMEDOUT);
+      if (clockid == CLOCK_USE_TIMEDLOCK)
+        TEST_COMPARE (pthread_mutex_timedlock (m, &ts), ETIMEDOUT);
+      else
+        TEST_COMPARE (pthread_mutex_clocklock (m, clockid, &ts), ETIMEDOUT);
 
       alarm (1);
 
@@ -117,7 +126,14 @@ do_test (void)
   if (! WIFSIGNALED (status))
     FAIL_EXIT1 ("child not killed by signal");
   TEST_COMPARE (WTERMSIG (status), SIGALRM);
+}
 
+static int
+do_test (void)
+{
+  do_test_clock (CLOCK_USE_TIMEDLOCK);
+  do_test_clock (CLOCK_REALTIME);
+  do_test_clock (CLOCK_MONOTONIC);
   return 0;
 }